From 2411a45b078d7a217e752df7d364516702dc3a0a Mon Sep 17 00:00:00 2001 From: espie Date: Sat, 25 Apr 2020 14:02:14 +0000 Subject: [PATCH] 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@ --- graphics/tumble/Makefile | 35 +++++++++++++++++++++ graphics/tumble/distinfo | 2 ++ graphics/tumble/patches/patch-Makefile | 34 ++++++++++++++++++++ graphics/tumble/patches/patch-bitblt_g4_c | 22 +++++++++++++ graphics/tumble/patches/patch-tumble_tiff_c | 24 ++++++++++++++ graphics/tumble/pkg/DESCR | 24 ++++++++++++++ graphics/tumble/pkg/PLIST | 4 +++ 7 files changed, 145 insertions(+) create mode 100644 graphics/tumble/Makefile create mode 100644 graphics/tumble/distinfo create mode 100644 graphics/tumble/patches/patch-Makefile create mode 100644 graphics/tumble/patches/patch-bitblt_g4_c create mode 100644 graphics/tumble/patches/patch-tumble_tiff_c create mode 100644 graphics/tumble/pkg/DESCR create mode 100644 graphics/tumble/pkg/PLIST diff --git a/graphics/tumble/Makefile b/graphics/tumble/Makefile new file mode 100644 index 00000000000..d62d970091f --- /dev/null +++ b/graphics/tumble/Makefile @@ -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 diff --git a/graphics/tumble/distinfo b/graphics/tumble/distinfo new file mode 100644 index 00000000000..37ccaf5c643 --- /dev/null +++ b/graphics/tumble/distinfo @@ -0,0 +1,2 @@ +SHA256 (tumble-0.36.tar.gz) = e54HiEFrgSkgODHafu9TELZxMlUD55qiL9kegitUuXg= +SIZE (tumble-0.36.tar.gz) = 51945 diff --git a/graphics/tumble/patches/patch-Makefile b/graphics/tumble/patches/patch-Makefile new file mode 100644 index 00000000000..10275078555 --- /dev/null +++ b/graphics/tumble/patches/patch-Makefile @@ -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 diff --git a/graphics/tumble/patches/patch-bitblt_g4_c b/graphics/tumble/patches/patch-bitblt_g4_c new file mode 100644 index 00000000000..0ecb435ba03 --- /dev/null +++ b/graphics/tumble/patches/patch-bitblt_g4_c @@ -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, diff --git a/graphics/tumble/patches/patch-tumble_tiff_c b/graphics/tumble/patches/patch-tumble_tiff_c new file mode 100644 index 00000000000..60e881ad78a --- /dev/null +++ b/graphics/tumble/patches/patch-tumble_tiff_c @@ -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) diff --git a/graphics/tumble/pkg/DESCR b/graphics/tumble/pkg/DESCR new file mode 100644 index 00000000000..85f09265e98 --- /dev/null +++ b/graphics/tumble/pkg/DESCR @@ -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] ... -o + +The options in this mode are: + + -v verbose + -b 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 diff --git a/graphics/tumble/pkg/PLIST b/graphics/tumble/pkg/PLIST new file mode 100644 index 00000000000..63040c12429 --- /dev/null +++ b/graphics/tumble/pkg/PLIST @@ -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