zipline: refactor environment variables (#377101)
[NixPkgs.git] / pkgs / by-name / li / libtiff / package.nix
blob03564fced8022ca0379af0a01b7160027e3beefa
2   lib,
3   stdenv,
4   fetchFromGitLab,
5   fetchpatch,
6   nix-update-script,
8   cmake,
9   pkg-config,
10   sphinx,
12   lerc,
13   libdeflate,
14   libjpeg,
15   libwebp,
16   xz,
17   zlib,
18   zstd,
20   # for passthru.tests
21   libgeotiff,
22   python3Packages,
23   imagemagick,
24   graphicsmagick,
25   gdal,
26   openimageio,
27   freeimage,
28   testers,
31 stdenv.mkDerivation (finalAttrs: {
32   pname = "libtiff";
33   version = "4.7.0";
35   src = fetchFromGitLab {
36     owner = "libtiff";
37     repo = "libtiff";
38     rev = "v${finalAttrs.version}";
39     hash = "sha256-SuK9/a6OUAumEe1kz1itFJGKxJzbmHkBVLMnyXhIwmQ=";
40   };
42   patches = [
43     # libc++abi 11 has an `#include <version>`, this picks up files name
44     # `version` in the project's include paths
45     ./rename-version.patch
46     ./static.patch
47   ];
49   postPatch = ''
50     mv VERSION VERSION.txt
51   '';
53   outputs = [
54     "bin"
55     "dev"
56     "dev_private"
57     "out"
58     "man"
59     "doc"
60   ];
62   postFixup = ''
63     mkdir -p $dev_private/include
64     mv -t $dev_private/include \
65       libtiff/tif_config.h \
66       ../libtiff/tif_dir.h \
67       ../libtiff/tif_hash_set.h \
68       ../libtiff/tiffiop.h
69   '';
71   nativeBuildInputs = [
72     cmake
73     pkg-config
74     sphinx
75   ];
77   buildInputs = [
78     lerc
79     zstd
80   ];
82   # TODO: opengl support (bogus configure detection)
83   propagatedBuildInputs = [
84     libdeflate
85     libjpeg
86     # libwebp depends on us; this will cause infinite
87     # recursion otherwise
88     (libwebp.override { tiffSupport = false; })
89     xz
90     zlib
91     zstd
92   ];
94   cmakeFlags = [
95     "-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON"
96   ];
98   enableParallelBuilding = true;
100   doCheck = true;
101   # Avoid flakiness like https://gitlab.com/libtiff/libtiff/-/commit/94f6f7315b1
102   enableParallelChecking = false;
104   passthru = {
105     tests = {
106       inherit
107         libgeotiff
108         imagemagick
109         graphicsmagick
110         gdal
111         openimageio
112         freeimage
113         ;
114       inherit (python3Packages) pillow imread;
115       pkg-config = testers.hasPkgConfigModules {
116         package = finalAttrs.finalPackage;
117       };
118     };
119     updateScript = nix-update-script { };
120   };
122   meta = with lib; {
123     description = "Library and utilities for working with the TIFF image file format";
124     homepage = "https://libtiff.gitlab.io/libtiff";
125     changelog = "https://libtiff.gitlab.io/libtiff/releases/v${finalAttrs.version}.html";
126     license = licenses.libtiff;
127     platforms = platforms.unix ++ platforms.windows;
128     pkgConfigModules = [ "libtiff-4" ];
129     maintainers = teams.geospatial.members;
130   };