jbig2enc: 0.28 -> 0.29

add patch for building with leptonica 1.83
This commit is contained in:
Robert Scott 2023-01-28 13:29:19 +00:00
parent bf5873bad5
commit b573c6a116
2 changed files with 32 additions and 54 deletions

View File

@ -1,47 +0,0 @@
From 53ce5fe7e73d7ed95c9e12b52dd4984723f865fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zdenko=20Podobn=C3=BD?= <zdenop@gmail.com>
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);

View File

@ -1,21 +1,45 @@
{ lib, stdenv, fetchFromGitHub, leptonica, zlib, libwebp, giflib, libjpeg, libpng, libtiff }:
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, leptonica
, zlib
, libwebp
, giflib
, libjpeg
, libpng
, libtiff
, autoreconfHook
}:
stdenv.mkDerivation rec {
pname = "jbig2enc";
version = "0.28";
version = "0.29";
src = fetchFromGitHub {
owner = "agl";
repo = "jbig2enc";
rev = "${version}-dist";
hash = "sha256-Y3IVTjvO5tqn/O076y/llnTyenKpbx1WyT/JFZ/s0VY=";
rev = version;
hash = "sha256-IAL4egXgaGmCilzcryjuvOoHhahyrfGWY68GBfXXgAM=";
};
propagatedBuildInputs = [ leptonica zlib libwebp giflib libjpeg libpng libtiff ];
buildInputs = [ autoreconfHook ];
propagatedBuildInputs = [
leptonica
zlib
libwebp
giflib
libjpeg
libpng
libtiff
];
patches = [
# https://github.com/agl/jbig2enc/commit/53ce5fe7e73d7ed95c9e12b52dd4984723f865fa
./53ce5fe7e73d7ed95c9e12b52dd4984723f865fa.patch
(fetchpatch {
name = "fix-build-leptonica-1.83.patch";
url = "https://github.com/agl/jbig2enc/commit/ea050190466f5336c69c6a11baa1cb686677fcab.patch";
hash = "sha256-+kScjFgDEU9F7VOUNAhm2XBjGm49fzAH8hYhmTm8xv8=";
})
];
# This is necessary, because the resulting library has
@ -31,5 +55,6 @@ stdenv.mkDerivation rec {
description = "Encoder for the JBIG2 image compression format";
license = lib.licenses.asl20;
platforms = lib.platforms.all;
homepage = "https://github.com/agl/jbig2enc";
};
}