nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 142 lines 3.1 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitLab, 5 nix-update-script, 6 7 cmake, 8 pkg-config, 9 sphinx, 10 11 lerc, 12 libdeflate, 13 libjpeg, 14 libwebp, 15 xz, 16 zlib, 17 zstd, 18 19 # Because lerc is C++ and static libraries don't track dependencies, 20 # that every downstream dependent of libtiff has to link with a C++ 21 # compiler, or the C++ standard library won't be linked, resulting 22 # in undefined symbol errors. Without systematic support for this 23 # in build systems, fixing this would require modifying the build 24 # system of every libtiff user. Hopefully at some point build 25 # systems will figure this out, and then we can enable this. 26 # 27 # See https://github.com/mesonbuild/meson/issues/14234 28 withLerc ? !stdenv.hostPlatform.isStatic, 29 30 # for passthru.tests 31 libgeotiff, 32 python3Packages, 33 imagemagick, 34 graphicsmagick, 35 gdal, 36 openimageio, 37 freeimage, 38 testers, 39}: 40 41stdenv.mkDerivation (finalAttrs: { 42 pname = "libtiff"; 43 version = "4.7.0"; 44 45 src = fetchFromGitLab { 46 owner = "libtiff"; 47 repo = "libtiff"; 48 rev = "v${finalAttrs.version}"; 49 hash = "sha256-SuK9/a6OUAumEe1kz1itFJGKxJzbmHkBVLMnyXhIwmQ="; 50 }; 51 52 patches = [ 53 # libc++abi 11 has an `#include <version>`, this picks up files name 54 # `version` in the project's include paths 55 ./rename-version.patch 56 ]; 57 58 postPatch = '' 59 mv VERSION VERSION.txt 60 ''; 61 62 outputs = [ 63 "bin" 64 "dev" 65 "dev_private" 66 "out" 67 "man" 68 "doc" 69 ]; 70 71 postFixup = '' 72 mkdir -p $dev_private/include 73 mv -t $dev_private/include \ 74 libtiff/tif_config.h \ 75 ../libtiff/tif_dir.h \ 76 ../libtiff/tif_hash_set.h \ 77 ../libtiff/tiffiop.h 78 ''; 79 80 nativeBuildInputs = [ 81 cmake 82 pkg-config 83 sphinx 84 ]; 85 86 buildInputs = [ 87 zstd 88 ] 89 ++ lib.optionals withLerc [ 90 lerc 91 ]; 92 93 # TODO: opengl support (bogus configure detection) 94 propagatedBuildInputs = [ 95 libdeflate 96 libjpeg 97 # libwebp depends on us; this will cause infinite 98 # recursion otherwise 99 (libwebp.override { tiffSupport = false; }) 100 xz 101 zlib 102 zstd 103 ]; 104 105 cmakeFlags = [ 106 "-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON" 107 ]; 108 109 enableParallelBuilding = true; 110 111 doCheck = true; 112 # Avoid flakiness like https://gitlab.com/libtiff/libtiff/-/commit/94f6f7315b1 113 enableParallelChecking = false; 114 115 passthru = { 116 tests = { 117 inherit 118 libgeotiff 119 imagemagick 120 graphicsmagick 121 gdal 122 openimageio 123 freeimage 124 ; 125 inherit (python3Packages) pillow imread; 126 pkg-config = testers.hasPkgConfigModules { 127 package = finalAttrs.finalPackage; 128 }; 129 }; 130 updateScript = nix-update-script { }; 131 }; 132 133 meta = with lib; { 134 description = "Library and utilities for working with the TIFF image file format"; 135 homepage = "https://libtiff.gitlab.io/libtiff"; 136 changelog = "https://libtiff.gitlab.io/libtiff/releases/v${finalAttrs.version}.html"; 137 license = licenses.libtiff; 138 platforms = platforms.unix ++ platforms.windows; 139 pkgConfigModules = [ "libtiff-4" ]; 140 teams = [ teams.geospatial ]; 141 }; 142})