lol
1{ lib
2, stdenv
3, fetchFromGitLab
4, nix-update-script
5
6, autoreconfHook
7, pkg-config
8, sphinx
9
10, lerc
11, libdeflate
12, libjpeg
13, xz
14, zlib
15
16 # for passthru.tests
17, libgeotiff
18, python3Packages
19, imagemagick
20, graphicsmagick
21, gdal
22, openimageio
23, freeimage
24, testers
25}:
26
27stdenv.mkDerivation (finalAttrs: {
28 pname = "libtiff";
29 version = "4.6.0";
30
31 src = fetchFromGitLab {
32 owner = "libtiff";
33 repo = "libtiff";
34 rev = "v${finalAttrs.version}";
35 hash = "sha256-qCg5qjsPPynCHIg0JsPJldwVdcYkI68zYmyNAKUCoyw=";
36 };
37
38 patches = [
39 # FreeImage needs this patch
40 ./headers.patch
41 # libc++abi 11 has an `#include <version>`, this picks up files name
42 # `version` in the project's include paths
43 ./rename-version.patch
44 ];
45
46 postPatch = ''
47 mv VERSION VERSION.txt
48 '';
49
50 outputs = [ "bin" "dev" "dev_private" "out" "man" "doc" ];
51
52 postFixup = ''
53 moveToOutput include/tif_config.h $dev_private
54 moveToOutput include/tif_dir.h $dev_private
55 moveToOutput include/tif_hash_set.h $dev_private
56 moveToOutput include/tiffiop.h $dev_private
57 '';
58
59 # If you want to change to a different build system, please make
60 # sure cross-compilation works first!
61 nativeBuildInputs = [ autoreconfHook pkg-config sphinx ];
62
63 buildInputs = [
64 lerc
65 ];
66
67 # TODO: opengl support (bogus configure detection)
68 propagatedBuildInputs = [
69 libdeflate
70 libjpeg
71 xz
72 zlib
73 ];
74
75 enableParallelBuilding = true;
76
77 doCheck = true;
78
79 passthru = {
80 tests = {
81 inherit libgeotiff imagemagick graphicsmagick gdal openimageio freeimage;
82 inherit (python3Packages) pillow imread;
83 pkg-config = testers.hasPkgConfigModules {
84 package = finalAttrs.finalPackage;
85 };
86 };
87 updateScript = nix-update-script { };
88 };
89
90 meta = with lib; {
91 description = "Library and utilities for working with the TIFF image file format";
92 homepage = "https://libtiff.gitlab.io/libtiff";
93 changelog = "https://libtiff.gitlab.io/libtiff/releases/v${finalAttrs.version}.html";
94 license = licenses.libtiff;
95 platforms = platforms.unix ++ platforms.windows;
96 pkgConfigModules = [ "libtiff-4" ];
97 maintainers = teams.geospatial.members;
98 };
99})