summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2017-04-08 00:11:14 +0200
committeraszlig <aszlig@redmoonstudios.org>2017-04-11 03:21:29 +0200
commit42bb63f803c5f8e84a4ff7c86c9be37c8264f409 (patch)
tree0a9c61557d82fad3df8560a862aa586e6cb9fcf6 /pkgs
parent288a79187cdb6e92c8354b3e06cebbdc8ad65d4a (diff)
downloadnixpkgs-42bb63f803c5f8e84a4ff7c86c9be37c8264f409.tar
nixpkgs-42bb63f803c5f8e84a4ff7c86c9be37c8264f409.tar.gz
nixpkgs-42bb63f803c5f8e84a4ff7c86c9be37c8264f409.tar.bz2
nixpkgs-42bb63f803c5f8e84a4ff7c86c9be37c8264f409.tar.lz
nixpkgs-42bb63f803c5f8e84a4ff7c86c9be37c8264f409.tar.xz
nixpkgs-42bb63f803c5f8e84a4ff7c86c9be37c8264f409.tar.zst
nixpkgs-42bb63f803c5f8e84a4ff7c86c9be37c8264f409.zip
leptonica: 1.72 -> 1.74.1
The changes are a bit too big to include it here in the commit message,
so if you want the details of what changed, please visit this URL:

http://leptonica.org/source/version-notes.html

I have also provided openjpeg, giflib and libwebp as dependencies so
that Leptonica is able to read/write those file formats.

Additionally I've added a patch that uses pkgconfig to resolve all
dependencies (except giflib), because unlike AC_CHECK_LIB() the
PKG_CHECK_MODULES() macro defines *_LIBS variables to include the linker
search path.

Unfortunately that patch alone is not enough, because the *_LIBS
variable are substituted by the upstream configure.ac to *not* include
the linker search paths, so we need to remove the AC_SUBST() calls
within PKG_CHECK_MODULES().

The only dependency that's not yet using PKG_CHECK_MODULES() is giflib,
because giflib doesn't have a pkg-config description file, therefore
we're using substituteInPlace to insert the linker search path after the
lept.pc file was generated by configure.

Another thing that we no longer need is the dependency on libpng version
1.2, because Leptonica now also works with more recent libpng versions.

Tested by building the package itself and also the following packages
that immediately depend on leptonica:

 * k2pdfopt
 * tesseract
 * jbig2enc

All of these packages succeeded to build on x86_64-linux.

The main reason why I'm bumping Leptonica to version 1.74.1 is that we
need at least version 1.74 to bump Tesseract to the latest upstream
version.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/libraries/leptonica/default.nix36
-rw-r--r--pkgs/top-level/all-packages.nix4
2 files changed, 31 insertions, 9 deletions
diff --git a/pkgs/development/libraries/leptonica/default.nix b/pkgs/development/libraries/leptonica/default.nix
index eacab92d36b..b9b6c3c7c24 100644
--- a/pkgs/development/libraries/leptonica/default.nix
+++ b/pkgs/development/libraries/leptonica/default.nix
@@ -1,14 +1,38 @@
-{stdenv, fetchurl, libpng, libtiff, libjpeg, zlib}:
+{ stdenv, fetchurl, fetchpatch, autoreconfHook, pkgconfig
+, giflib, libjpeg, libpng, libtiff, libwebp, openjpeg, zlib
+}:
 
-stdenv.mkDerivation {
-  name = "leptonica-1.72";
+stdenv.mkDerivation rec {
+  name = "leptonica-${version}";
+  version = "1.74.1";
 
   src = fetchurl {
-    url = http://www.leptonica.org/source/leptonica-1.72.tar.gz;
-    sha256 = "0mhzvqs0im04y1cpcc1yma70hgdac1frf33h73m9z3356bfymmbr";
+    url = "http://www.leptonica.org/source/${name}.tar.gz";
+    sha256 = "0qpcidvv6igybrrhj0m6j47g642c8sk1qn4dpj82mgd38xx52skl";
   };
 
-  buildInputs = [ libpng libtiff libjpeg zlib ];
+  patches = stdenv.lib.singleton (fetchpatch {
+    # configure: Support pkg-config
+    url = "https://github.com/DanBloomberg/leptonica/commit/"
+        + "4476d162cc191a0fefb2ce434153e12bbf188664.patch";
+    sha256 = "1razzp2g49shfaravfqpxm3ivcd1r92lvqysll6nnf6d1wp9865s";
+  });
+
+  postPatch = ''
+    # Remove the AC_SUBST() macros on *_LIBS, because the *_LIBS variables will
+    # be automatically set by PKG_CHECK_MODULES() since autotools 0.24 and
+    # using the ones that are set here in Leptonica's configure.ac do not
+    # include -L linker flags.
+    sed -i -e '/PKG_CHECK_MODULES/,/^ *\])/s/AC_SUBST([^)]*)//' configure.ac
+
+    # The giflib package doesn't ship a pkg-config file, so we need to inject
+    # the linker search path.
+    substituteInPlace configure.ac --replace -lgif \
+      ${stdenv.lib.escapeShellArg "'-L${giflib}/lib -lgif'"}
+  '';
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ giflib libjpeg libpng libtiff libwebp openjpeg zlib ];
 
   meta = {
     description = "Image processing and analysis library";
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 38b92de3d55..7062bedd9b1 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -8059,9 +8059,7 @@ with pkgs;
 
   levmar = callPackage ../development/libraries/levmar { };
 
-  leptonica = callPackage ../development/libraries/leptonica {
-    libpng = libpng12;
-  };
+  leptonica = callPackage ../development/libraries/leptonica { };
 
   lib3ds = callPackage ../development/libraries/lib3ds { };