From 73967e0eca06093e02b2bc7faee8e668eab4e83d Mon Sep 17 00:00:00 2001 From: Pascal Wittmann Date: Thu, 24 Mar 2016 20:21:07 +0100 Subject: [PATCH] jbig2enc: fix build --- ...5fe7e73d7ed95c9e12b52dd4984723f865fa.patch | 47 +++++++++++++++++++ pkgs/tools/graphics/jbig2enc/default.nix | 5 ++ 2 files changed, 52 insertions(+) create mode 100644 pkgs/tools/graphics/jbig2enc/53ce5fe7e73d7ed95c9e12b52dd4984723f865fa.patch diff --git a/pkgs/tools/graphics/jbig2enc/53ce5fe7e73d7ed95c9e12b52dd4984723f865fa.patch b/pkgs/tools/graphics/jbig2enc/53ce5fe7e73d7ed95c9e12b52dd4984723f865fa.patch new file mode 100644 index 000000000000..13e18fd04476 --- /dev/null +++ b/pkgs/tools/graphics/jbig2enc/53ce5fe7e73d7ed95c9e12b52dd4984723f865fa.patch @@ -0,0 +1,47 @@ +From 53ce5fe7e73d7ed95c9e12b52dd4984723f865fa Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zdenko=20Podobn=C3=BD?= +Date: Sun, 6 Apr 2014 21:25:27 +0200 +Subject: [PATCH] fix build with leptonica 1.70 + +--- + configure.ac | 1 + + src/jbig2.cc | 13 +++++++++---- + 2 files changed, 10 insertions(+), 4 deletions(-) + +diff --git a/configure.ac b/configure.ac +index fe37c22..753a607 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -55,6 +55,7 @@ AC_CHECK_LIB([lept], [findFileFormatStream], [], [ + echo "Error! Leptonica not detected." + exit -1 + ]) ++AC_CHECK_FUNCS(expandBinaryPower2Low,,) + # test for function - it should detect leptonica dependecies + + # Check for possible dependancies of leptonica. +diff --git a/src/jbig2.cc b/src/jbig2.cc +index e10f042..515c1ef 100644 +--- a/src/jbig2.cc ++++ b/src/jbig2.cc +@@ -130,11 +130,16 @@ segment_image(PIX *pixb, PIX *piximg) { + // input color image, so we have to do it this way... + // is there a better way? + // PIX *pixd = pixExpandBinary(pixd4, 4); +- PIX *pixd = pixCreate(piximg->w, piximg->h, 1); +- pixCopyResolution(pixd, piximg); +- if (verbose) pixInfo(pixd, "mask image: "); +- expandBinaryPower2Low(pixd->data, pixd->w, pixd->h, pixd->wpl, ++ PIX *pixd; ++#ifdef HAVE_EXPANDBINARYPOWER2LOW ++ pixd = pixCreate(piximg->w, piximg->h, 1); ++ pixCopyResolution(pixd, piximg); ++ expandBinaryPower2Low(pixd->data, pixd->w, pixd->h, pixd->wpl, + pixd4->data, pixd4->w, pixd4->h, pixd4->wpl, 4); ++#else ++ pixd = pixExpandBinaryPower2(pixd4, 4); ++#endif ++ if (verbose) pixInfo(pixd, "mask image: "); + + pixDestroy(&pixd4); + pixDestroy(&pixsf4); diff --git a/pkgs/tools/graphics/jbig2enc/default.nix b/pkgs/tools/graphics/jbig2enc/default.nix index 71f0789286a1..8d0b7d2d9f49 100644 --- a/pkgs/tools/graphics/jbig2enc/default.nix +++ b/pkgs/tools/graphics/jbig2enc/default.nix @@ -8,6 +8,11 @@ propagatedBuildInputs = [ leptonica zlib libwebp giflib libjpeg libpng libtiff ]; + patches = [ + # https://github.com/agl/jbig2enc/commit/53ce5fe7e73d7ed95c9e12b52dd4984723f865fa + ./53ce5fe7e73d7ed95c9e12b52dd4984723f865fa.patch + ]; + # This is necessary, because the resulting library has # /tmp/nix-build-jbig2enc/src/.libs before /nix/store/jbig2enc/lib # in its rpath, which means that patchelf --shrink-rpath removes