summary refs log tree commit diff
path: root/pkgs/development/libraries/jbig2enc/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/jbig2enc/default.nix')
-rw-r--r--pkgs/development/libraries/jbig2enc/default.nix60
1 files changed, 60 insertions, 0 deletions
diff --git a/pkgs/development/libraries/jbig2enc/default.nix b/pkgs/development/libraries/jbig2enc/default.nix
new file mode 100644
index 00000000000..26b21aa7c95
--- /dev/null
+++ b/pkgs/development/libraries/jbig2enc/default.nix
@@ -0,0 +1,60 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, fetchpatch
+, leptonica
+, zlib
+, libwebp
+, giflib
+, libjpeg
+, libpng
+, libtiff
+, autoreconfHook
+}:
+
+stdenv.mkDerivation rec {
+  pname = "jbig2enc";
+  version = "0.29";
+
+  src = fetchFromGitHub {
+    owner = "agl";
+    repo = "jbig2enc";
+    rev = version;
+    hash = "sha256-IAL4egXgaGmCilzcryjuvOoHhahyrfGWY68GBfXXgAM=";
+  };
+
+  buildInputs = [ autoreconfHook ];
+  propagatedBuildInputs = [
+    leptonica
+    zlib
+    libwebp
+    giflib
+    libjpeg
+    libpng
+    libtiff
+  ];
+
+  patches = [
+    (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
+  # /tmp/nix-build-jbig2enc/src/.libs before /nix/store/jbig2enc/lib
+  # in its rpath, which means that patchelf --shrink-rpath removes
+  # the /nix/store one.  By cleaning up before fixup, we ensure that
+  # the /tmp/nix-build-jbig2enc/src/.libs directory is gone.
+  preFixup = ''
+    make clean
+  '';
+
+  meta = {
+    description = "Encoder for the JBIG2 image compression format";
+    license = lib.licenses.asl20;
+    platforms = lib.platforms.all;
+    homepage = "https://github.com/agl/jbig2enc";
+  };
+}