diff --git a/pkgs/development/libraries/libtiff/aarch64-darwin.nix b/pkgs/development/libraries/libtiff/aarch64-darwin.nix new file mode 100644 index 00000000000..5de481066f6 --- /dev/null +++ b/pkgs/development/libraries/libtiff/aarch64-darwin.nix @@ -0,0 +1,53 @@ +{ lib, stdenv +, fetchurl + +, pkg-config +, cmake + +, libdeflate +, libjpeg +, xz +, zlib +}: + +stdenv.mkDerivation rec { + pname = "libtiff"; + version = "4.2.0"; + + src = fetchurl { + url = "https://download.osgeo.org/libtiff/tiff-${version}.tar.gz"; + sha256 = "1jrkjv0xya9radddn8idxvs2gqzp3l2b1s8knlizmn7ad3jq817b"; + }; + + cmakeFlags = lib.optional stdenv.isDarwin "-DCMAKE_SKIP_BUILD_RPATH=OFF"; + + # FreeImage needs this patch + patches = [ ./headers-cmake.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 = [ libjpeg xz zlib ]; #TODO: opengl support (bogus configure detection) + + buildInputs = [ libdeflate ]; # TODO: move all propagatedBuildInputs to buildInputs. + + enableParallelBuilding = true; + + doInstallCheck = true; + installCheckTarget = "test"; + + meta = with lib; { + description = "Library and utilities for working with the TIFF image file format"; + homepage = "https://libtiff.gitlab.io/libtiff"; + changelog = "https://libtiff.gitlab.io/libtiff/v${version}.html"; + license = licenses.libtiff; + platforms = platforms.unix; + }; +} diff --git a/pkgs/development/libraries/libtiff/default.nix b/pkgs/development/libraries/libtiff/default.nix index 035b0ab55ad..ea246790020 100644 --- a/pkgs/development/libraries/libtiff/default.nix +++ b/pkgs/development/libraries/libtiff/default.nix @@ -10,6 +10,8 @@ , zlib }: +#FIXME: fix aarch64-darwin build and get rid of ./aarch64-darwin.nix + stdenv.mkDerivation rec { pname = "libtiff"; version = "4.3.0"; diff --git a/pkgs/development/libraries/libtiff/headers-cmake.patch b/pkgs/development/libraries/libtiff/headers-cmake.patch new file mode 100644 index 00000000000..5a00502ef28 --- /dev/null +++ b/pkgs/development/libraries/libtiff/headers-cmake.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) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5d3e942ca5a..8725cd73e97 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17088,7 +17088,9 @@ in libtifiles2 = callPackage ../development/libraries/libtifiles2 { }; - libtiff = callPackage ../development/libraries/libtiff { }; + libtiff = if stdenv.isDarwin && stdenv.isAarch64 + then callPackage ../development/libraries/libtiff/aarch64-darwin.nix { } + else callPackage ../development/libraries/libtiff { }; libtiger = callPackage ../development/libraries/libtiger { };