about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/libtiff
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libtiff')
-rw-r--r--nixpkgs/pkgs/development/libraries/libtiff/default.nix51
-rw-r--r--nixpkgs/pkgs/development/libraries/libtiff/headers.patch13
2 files changed, 64 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libtiff/default.nix b/nixpkgs/pkgs/development/libraries/libtiff/default.nix
new file mode 100644
index 000000000000..2fad29888982
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libtiff/default.nix
@@ -0,0 +1,51 @@
+{ lib, stdenv
+, fetchurl
+
+, pkg-config
+, cmake
+
+, zlib
+, libjpeg
+, xz
+}:
+
+stdenv.mkDerivation rec {
+  version = "4.1.0";
+  pname = "libtiff";
+
+  src = fetchurl {
+    url = "https://download.osgeo.org/libtiff/tiff-${version}.tar.gz";
+    sha256 = "0d46bdvxdiv59lxnb0xz9ywm8arsr6xsapi5s6y6vnys2wjz6aax";
+  };
+
+  cmakeFlags = if stdenv.isDarwin then [
+    "-DCMAKE_SKIP_BUILD_RPATH=OFF"
+  ] else null;
+
+  # FreeImage needs this patch
+  patches = [ ./headers.patch ];
+
+  outputs = [ "bin" "dev" "dev_private" "out" "man" "doc" ];
+
+  postFixup = ''
+    moveToOutput include/tif_dir.h $dev_private
+    moveToOutput include/tif_config.h $dev_private
+    moveToOutput include/tiffiop.h $dev_private
+  '';
+
+  nativeBuildInputs = [ cmake pkg-config ];
+
+  propagatedBuildInputs = [ zlib libjpeg xz ]; #TODO: opengl support (bogus configure detection)
+
+  enableParallelBuilding = true;
+
+  doInstallCheck = true;
+  installCheckTarget = "test";
+
+  meta = with lib; {
+    description = "Library and utilities for working with the TIFF image file format";
+    homepage = "http://download.osgeo.org/libtiff";
+    license = licenses.libtiff;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libtiff/headers.patch b/nixpkgs/pkgs/development/libraries/libtiff/headers.patch
new file mode 100644
index 000000000000..5a00502ef281
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libtiff/headers.patch
@@ -0,0 +1,13 @@
+diff -ruN a/libtiff/CMakeLists.txt b/libtiff/CMakeLists.txt
+--- a/libtiff/CMakeLists.txt	2019-05-31 13:05:22.849705817 +0000
++++ b/libtiff/CMakeLists.txt	2020-11-27 21:50:03.527831837 +0000
+@@ -42,6 +42,9 @@
+   libtiffxx.map)
+ 
+ set(tiff_HEADERS
++  tiffiop.h
++  ${CMAKE_CURRENT_BINARY_DIR}/tif_config.h
++  tif_dir.h
+   tiff.h
+   tiffio.h
+   tiffvers.h)