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