libtiff: switch back to CMake

Since libwebp was switched to CMake, the .la files that told static
builds which libraries had to be linked with libwebp are no longer
generated, breaking static builds. By switching libtiff to CMake too,
we can use the CMake files instead. (This is necessary, but not
sufficient, for static builds to work — a further patch is required.)

This was tried once before (in 96d50327bc59 ("libtiff: export private
headers for freeimage")), and I reverted it (in
5df9305b60d5 ("libtiff: fix cross by switching back to autoconf")),
because at the time, it broke cross compilation of libtiff. Things
seem to have settled since then, and this now cross compiles
correctly.

Fixes: 909c49149371 ("libwebp: build with CMake")

+23 -45
-16
pkgs/by-name/li/libtiff/headers.patch
··· 1 - export private headers for freeimage 2 - --- i/libtiff/Makefile.am 3 - +++ w/libtiff/Makefile.am 4 - @@ -36,8 +36,12 @@ EXTRA_DIST = \ 5 - tif_win32_versioninfo.rc 6 - 7 - libtiffinclude_HEADERS = \ 8 - + tif_config.h \ 9 - + tif_dir.h \ 10 - + tif_hash_set.h \ 11 - tiff.h \ 12 - tiffio.h \ 13 - + tiffiop.h \ 14 - tiffvers.h 15 - 16 - if HAVE_CXX
+12 -10
pkgs/by-name/li/libtiff/package.nix
··· 5 5 fetchpatch, 6 6 nix-update-script, 7 7 8 - autoreconfHook, 8 + cmake, 9 9 pkg-config, 10 10 sphinx, 11 11 ··· 40 40 }; 41 41 42 42 patches = [ 43 - # FreeImage needs this patch 44 - ./headers.patch 45 43 # libc++abi 11 has an `#include <version>`, this picks up files name 46 44 # `version` in the project's include paths 47 45 ./rename-version.patch ··· 61 59 ]; 62 60 63 61 postFixup = '' 64 - moveToOutput include/tif_config.h $dev_private 65 - moveToOutput include/tif_dir.h $dev_private 66 - moveToOutput include/tif_hash_set.h $dev_private 67 - moveToOutput include/tiffiop.h $dev_private 62 + mkdir -p $dev_private/include 63 + mv -t $dev_private/include \ 64 + libtiff/tif_config.h \ 65 + ../libtiff/tif_dir.h \ 66 + ../libtiff/tif_hash_set.h \ 67 + ../libtiff/tiffiop.h 68 68 ''; 69 69 70 - # If you want to change to a different build system, please make 71 - # sure cross-compilation works first! 72 70 nativeBuildInputs = [ 73 - autoreconfHook 71 + cmake 74 72 pkg-config 75 73 sphinx 76 74 ]; ··· 90 88 xz 91 89 zlib 92 90 zstd 91 + ]; 92 + 93 + cmakeFlags = [ 94 + "-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON" 93 95 ]; 94 96 95 97 enableParallelBuilding = true;
+11 -19
pkgs/by-name/li/libtiff/rename-version.patch
··· 1 - fix case-insensitive build 2 - --- a/Makefile.am 3 - +++ b/Makefile.am 4 - @@ -34,7 +34,7 @@ docfiles = \ 5 - README.md \ 6 - RELEASE-DATE \ 7 - TODO \ 8 - - VERSION 9 - + VERSION.txt 1 + diff --git a/cmake/AutotoolsVersion.cmake b/cmake/AutotoolsVersion.cmake 2 + index f93f5cf0..fd33df59 100644 3 + --- a/cmake/AutotoolsVersion.cmake 4 + +++ b/cmake/AutotoolsVersion.cmake 5 + @@ -41,7 +41,7 @@ set(LIBTIFF_VERSION "${LIBTIFF_MAJOR_VERSION}.${LIBTIFF_MINOR_VERSION}.${LIBTIFF 6 + set(LIBTIFF_VERSION_FULL "${LIBTIFF_VERSION}${LIBTIFF_ALPHA_VERSION}") 10 7 11 - EXTRA_DIST = \ 12 - placeholder.h \ 13 - @@ -68,7 +68,7 @@ NEW_LIBTIFF_RELEASE_DATE=$(shell date +"%Y%m%d") 14 - release: 15 - @(echo --- Setting release date to $(NEW_LIBTIFF_RELEASE_DATE) and release version to $(LIBTIFF_VERSION) ---) 16 - (rm -f $(top_srcdir)/RELEASE-DATE && echo $(NEW_LIBTIFF_RELEASE_DATE) > $(top_srcdir)/RELEASE-DATE) 17 - - (rm -f $(top_srcdir)/VERSION && echo $(LIBTIFF_VERSION) > $(top_srcdir)/VERSION) 18 - + (rm -f $(top_srcdir)/VERSION && echo $(LIBTIFF_VERSION) > $(top_srcdir)/VERSION.txt) 19 - (rm -f $(top_builddir)/libtiff/tiffvers.h && sed 's,LIBTIFF_VERSION,$(LIBTIFF_VERSION),;s,LIBTIFF_RELEASE_DATE,$(NEW_LIBTIFF_RELEASE_DATE),;s,LIBTIFF_MAJOR_VERSION,$(LIBTIFF_MAJOR_VERSION),;s,LIBTIFF_MINOR_VERSION,$(LIBTIFF_MINOR_VERSION),;s,LIBTIFF_MICRO_VERSION,$(LIBTIFF_MICRO_VERSION),' $(top_srcdir)/libtiff/tiffvers.h.in > $(top_builddir)/libtiff/tiffvers.h && sed -i 's,@,,g' $(top_builddir)/libtiff/tiffvers.h) 8 + # Get release version from file VERSION 9 + -FILE(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" LIBTIFF_RELEASE_VERSION) 10 + +FILE(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION.txt" LIBTIFF_RELEASE_VERSION) 20 11 21 - pkgconfigdir = $(libdir)/pkgconfig 12 + # Package date - get it from file RELEASE-DATE 13 + FILE(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/RELEASE-DATE" LIBTIFF_RELEASE_DATE)