as requested by Miod a port of tumble

tumble is a somewhat rustic utility that takes jpeg pictures OR 1 bit
tiff b&w pictures and creates a pdf out of them, see the README for more
details

okay jca@
This commit is contained in:
espie 2020-04-25 14:02:14 +00:00
parent e4ea4b8323
commit 2411a45b07
7 changed files with 145 additions and 0 deletions

35
graphics/tumble/Makefile Normal file
View File

@ -0,0 +1,35 @@
# $OpenBSD: Makefile,v 1.1.1.1 2020/04/25 14:02:14 espie Exp $
# author says so
ONLY_FOR_ARCHS= ${LE_ARCHS}
COMMENT = convert pictures into pdf book
GH_PROJECT = tumble
GH_ACCOUNT = brouhaha
GH_TAGNAME = v0.36
CATEGORIES = graphics textproc
# GPL V2
PERMIT_PACKAGE = Yes
WANTLIB = c jpeg m netpbm tiff z
NO_TEST = Yes
USE_GMAKE = Yes
BUILD_DEPENDS = devel/bison
LIB_DEPENDS = graphics/tiff \
graphics/jpeg \
graphics/netpbm
DEBUG_PACKAGES = ${BUILD_PACKAGES}
do-install:
${INSTALL_PROGRAM} ${WRKBUILD}/tumble ${PREFIX}/bin
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/tumble
${INSTALL_DATA} ${WRKSRC}/README ${PREFIX}/share/doc/tumble
.include <bsd.port.mk>

2
graphics/tumble/distinfo Normal file
View File

@ -0,0 +1,2 @@
SHA256 (tumble-0.36.tar.gz) = e54HiEFrgSkgODHafu9TELZxMlUD55qiL9kegitUuXg=
SIZE (tumble-0.36.tar.gz) = 51945

View File

@ -0,0 +1,34 @@
$OpenBSD: patch-Makefile,v 1.1.1.1 2020/04/25 14:02:14 espie Exp $
Index: Makefile
--- Makefile.orig
+++ Makefile
@@ -33,26 +33,9 @@
CTL_LANG=1
-CFLAGS = -Wall -Wno-unused-function -Wno-unused-but-set-variable
-LDFLAGS =
+CFLAGS += -I${LOCALBASE}/include
+LDFLAGS += -L${LOCALBASE}/lib
LDLIBS = -ltiff -ljpeg -lnetpbm -lz -lm
-
-ifdef DEBUG
-CFLAGS := $(CFLAGS) -g
-LDFLAGS := $(LDFLAGS) -g
-else
-CFLAGS := $(CFLAGS) -O3
-endif
-
-ifdef EFENCE
-LDLIBS := $(LDLIBS) -lefence -lpthread
-endif
-
-ifdef STATIC
-LDLIBS := -Wl,-static $(LDLIBS)
-endif
-
-
LEX = flex
YACC = bison
YFLAGS = -d -v

View File

@ -0,0 +1,22 @@
$OpenBSD: patch-bitblt_g4_c,v 1.1.1.1 2020/04/25 14:02:14 espie Exp $
Index: bitblt_g4.c
--- bitblt_g4.c.orig
+++ bitblt_g4.c
@@ -215,6 +215,7 @@ static uint32_t g4_find_pixel (uint8_t *buf,
return (width);
}
+#define absdiff(a, b) ((a) < (b) ? (b)-(a) : (a) - (b))
static void g4_encode_row (struct bit_buffer *buf,
uint32_t width,
@@ -253,7 +254,7 @@ static void g4_encode_row (struct bit_buffer *buf,
fprintf (stderr, "pass\n");
#endif
}
- else if (abs (a1 - b1) <= 3)
+ else if (absdiff(a1, b1) <= 3)
{
/* vertical mode */
write_bits (buf,

View File

@ -0,0 +1,24 @@
$OpenBSD: patch-tumble_tiff_c,v 1.1.1.1 2020/04/25 14:02:14 espie Exp $
get rid of insane header testing:
- TiFFFdOpen is perfectly capable of detecting tiff files
- FILE* and fd are two different layers
Index: tumble_tiff.c
--- tumble_tiff.c.orig
+++ tumble_tiff.c
@@ -67,6 +67,7 @@ static bool close_tiff_input_file (void)
static bool open_tiff_input_file (FILE *f, char *name)
{
+#if 0
uint8_t buf [2];
size_t l;
@@ -79,6 +80,7 @@ static bool open_tiff_input_file (FILE *f, char *name)
if (! (((buf [0] == 0x49) && (buf [1] == 0x49)) ||
((buf [0] == 0x4d) && (buf [1] == 0x4d))))
return (0);
+#endif
tiff_in = TIFFFdOpen (fileno (f), name, "r");
if (! tiff_in)

24
graphics/tumble/pkg/DESCR Normal file
View File

@ -0,0 +1,24 @@
Tumble is a utility to construct PDF files from one or more image
files. Supported input image file formats are JPEG, and black and
white 1-bit TIFF (single- or multi-page).
Black and white images will be encoded in the PDF output using
lossless Group 4 fax compression (ITU-T recommendation T.6). This
provides a very good compression ratio for text and line art. JPEG
images will be preserved with the original coding.
The general command line syntax is:
tumble [options] <input>... -o <output.pdf>
The options in this mode are:
-v verbose
-b <fmt> create bookmarks
If the "-b" option is given, bookmarks will be created using the
format string, which may contain arbitrary text and/or the following
format specifiers:
%F file name, sans suffix e.g., "foo.tif" will just appear as "foo"
%p page number of input file, useful for multipage TIFF files

View File

@ -0,0 +1,4 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2020/04/25 14:02:14 espie Exp $
@bin bin/tumble
share/doc/tumble/
share/doc/tumble/README