aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/tiff
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/tiff
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/tiff')
-rw-r--r--vcpkg/ports/tiff/FindCMath.patch33
-rw-r--r--vcpkg/ports/tiff/portfile.cmake100
-rw-r--r--vcpkg/ports/tiff/prefer-config.diff55
-rw-r--r--vcpkg/ports/tiff/usage9
-rw-r--r--vcpkg/ports/tiff/vcpkg-cmake-wrapper.cmake.in123
-rw-r--r--vcpkg/ports/tiff/vcpkg.json86
6 files changed, 406 insertions, 0 deletions
diff --git a/vcpkg/ports/tiff/FindCMath.patch b/vcpkg/ports/tiff/FindCMath.patch
new file mode 100644
index 0000000..02eefde
--- /dev/null
+++ b/vcpkg/ports/tiff/FindCMath.patch
@@ -0,0 +1,33 @@
+diff --git a/cmake/FindCMath.cmake b/cmake/FindCMath.cmake
+index ad92218..9c8247f 100644
+--- a/cmake/FindCMath.cmake
++++ b/cmake/FindCMath.cmake
+@@ -31,6 +31,15 @@ include(CheckSymbolExists)
+ include(CheckLibraryExists)
+
+ check_symbol_exists(pow "math.h" CMath_HAVE_LIBC_POW)
++set(CMAKE_FIND_LIBRARY_SUFFIXES_SAVE "${CMAKE_FIND_LIBRARY_SUFFIXES}")
++if(VCPKG_CRT_LINKAGE STREQUAL "static")
++ list(PREPEND CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_STATIC_LIBRARY_SUFFIX}")
++endif()
++find_library(CMath_LIBRARY_PATH m PATHS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES})
++if(CMath_LIBRARY_PATH)
++ set(CMath_LIBRARY m CACHE STRING "Math link library")
++endif()
++set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES_SAVE}")
+ find_library(CMath_LIBRARY NAMES m)
+
+ if(NOT CMath_HAVE_LIBC_POW)
+@@ -61,7 +70,11 @@ if(CMath_FOUND)
+ endif()
+
+ if(NOT TARGET CMath::CMath)
+- if(CMath_LIBRARIES)
++ if(CMath_LIBRARIES STREQUAL "m")
++ add_library(CMath::CMath INTERFACE IMPORTED)
++ set_target_properties(CMath::CMath PROPERTIES
++ INTERFACE_LINK_LIBRARIES m)
++ elseif(CMath_LIBRARIES)
+ add_library(CMath::CMath UNKNOWN IMPORTED)
+ set_target_properties(CMath::CMath PROPERTIES
+ IMPORTED_LOCATION "${CMath_LIBRARY}")
diff --git a/vcpkg/ports/tiff/portfile.cmake b/vcpkg/ports/tiff/portfile.cmake
new file mode 100644
index 0000000..da77b24
--- /dev/null
+++ b/vcpkg/ports/tiff/portfile.cmake
@@ -0,0 +1,100 @@
+vcpkg_from_gitlab(
+ GITLAB_URL https://gitlab.com
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO libtiff/libtiff
+ REF "v${VERSION}"
+ SHA512 dcdabe2598db33a973d06f0009dd528aa1f38813bd6015e2595097b838a42240f9ccbe7524b5235ea2f4207a10d5d706339c7a6f4772b531e00a20281a00f67b
+ HEAD_REF master
+ PATCHES
+ FindCMath.patch
+ prefer-config.diff
+)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ cxx tiff-cxx
+ jpeg jpeg
+ jpeg CMAKE_REQUIRE_FIND_PACKAGE_JPEG
+ libdeflate libdeflate
+ libdeflate CMAKE_REQUIRE_FIND_PACKAGE_Deflate
+ lerc lerc
+ lerc CMAKE_REQUIRE_FIND_PACKAGE_LERC
+ lzma lzma
+ lzma CMAKE_REQUIRE_FIND_PACKAGE_liblzma
+ tools tiff-tools
+ webp webp
+ webp CMAKE_REQUIRE_FIND_PACKAGE_WebP
+ zip zlib
+ zip CMAKE_REQUIRE_FIND_PACKAGE_ZLIB
+ zstd zstd
+ zstd CMAKE_REQUIRE_FIND_PACKAGE_ZSTD
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ -Dtiff-docs=OFF
+ -Dtiff-contrib=OFF
+ -Dtiff-tests=OFF
+ -Djbig=OFF # This is disabled by default due to GPL/Proprietary licensing.
+ -Djpeg12=OFF
+ -DCMAKE_DISABLE_FIND_PACKAGE_OpenGL=ON
+ -DCMAKE_DISABLE_FIND_PACKAGE_GLUT=ON
+ -DZSTD_HAVE_DECOMPRESS_STREAM=ON
+ -DHAVE_JPEGTURBO_DUAL_MODE_8_12=OFF
+ OPTIONS_DEBUG
+ -DCMAKE_DEBUG_POSTFIX=d # tiff sets "d" for MSVC only.
+ MAYBE_UNUSED_VARIABLES
+ CMAKE_DISABLE_FIND_PACKAGE_GLUT
+ CMAKE_DISABLE_FIND_PACKAGE_OpenGL
+ ZSTD_HAVE_DECOMPRESS_STREAM
+)
+
+vcpkg_cmake_install()
+
+# CMake config wasn't packaged in the past and is not yet usable now,
+# cf. https://gitlab.com/libtiff/libtiff/-/merge_requests/496
+# vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/tiff")
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/cmake" "${CURRENT_PACKAGES_DIR}/debug/lib/cmake")
+
+set(_file "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libtiff-4.pc")
+if(EXISTS "${_file}")
+ vcpkg_replace_string("${_file}" "-ltiff" "-ltiffd")
+endif()
+vcpkg_fixup_pkgconfig()
+
+file(REMOVE_RECURSE
+ "${CURRENT_PACKAGES_DIR}/debug/include"
+ "${CURRENT_PACKAGES_DIR}/debug/share"
+)
+
+configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY)
+
+if ("tools" IN_LIST FEATURES)
+ vcpkg_copy_tools(TOOL_NAMES
+ fax2ps
+ fax2tiff
+ pal2rgb
+ ppm2tiff
+ raw2tiff
+ tiff2bw
+ tiff2pdf
+ tiff2ps
+ tiff2rgba
+ tiffcmp
+ tiffcp
+ tiffcrop
+ tiffdither
+ tiffdump
+ tiffinfo
+ tiffmedian
+ tiffset
+ tiffsplit
+ AUTO_CLEAN
+ )
+endif()
+
+vcpkg_copy_pdbs()
+file(COPY "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md")
diff --git a/vcpkg/ports/tiff/prefer-config.diff b/vcpkg/ports/tiff/prefer-config.diff
new file mode 100644
index 0000000..5ca4b07
--- /dev/null
+++ b/vcpkg/ports/tiff/prefer-config.diff
@@ -0,0 +1,55 @@
+diff --git a/cmake/LERCCodec.cmake b/cmake/LERCCodec.cmake
+index c21dad3d..3d06367f 100644
+--- a/cmake/LERCCodec.cmake
++++ b/cmake/LERCCodec.cmake
+@@ -26,7 +26,10 @@
+ # libLerc
+ set(LERC_SUPPORT FALSE)
+ set(LERC_STATIC FALSE)
+-find_package(LERC)
++find_package(LERC NAMES unofficial-lerc)
++if(TARGET unofficial::Lerc::Lerc)
++ add_library(LERC::LERC ALIAS unofficial::Lerc::Lerc)
++endif()
+ option(lerc "use libLerc (required for LERC compression)" ${LERC_FOUND})
+ if (lerc AND LERC_FOUND AND ZIP_SUPPORT)
+ set(LERC_SUPPORT TRUE)
+diff --git a/cmake/WebPCodec.cmake b/cmake/WebPCodec.cmake
+index 1d676a78..77769171 100644
+--- a/cmake/WebPCodec.cmake
++++ b/cmake/WebPCodec.cmake
+@@ -26,7 +26,7 @@
+ # libwebp
+ set(WEBP_SUPPORT FALSE)
+
+-find_package(WebP)
++find_package(WebP CONFIG)
+
+ option(webp "use libwebp (required for WEBP compression)" ${WebP_FOUND})
+
+diff --git a/cmake/ZSTDCodec.cmake b/cmake/ZSTDCodec.cmake
+index 3fac861a..2957aa3a 100644
+--- a/cmake/ZSTDCodec.cmake
++++ b/cmake/ZSTDCodec.cmake
+@@ -28,7 +28,7 @@
+ set(ZSTD_SUPPORT FALSE)
+ set(ZSTD_USABLE FALSE)
+
+-find_package(ZSTD)
++find_package(ZSTD NAMES zstd)
+
+ if(ZSTD_FOUND)
+ if(TARGET zstd::libzstd_shared)
+diff --git a/libtiff/CMakeLists.txt b/libtiff/CMakeLists.txt
+index 2d76d1ee..68502a35 100755
+--- a/libtiff/CMakeLists.txt
++++ b/libtiff/CMakeLists.txt
+@@ -161,7 +161,7 @@ if(JBIG_SUPPORT)
+ endif()
+ if(LERC_SUPPORT)
+ target_link_libraries(tiff PRIVATE LERC::LERC)
+- if(LERC_VERSION_STRING VERSION_GREATER_EQUAL "4.0")
++ if(1)
+ string(APPEND tiff_requires_private " Lerc")
+ else()
+ list(APPEND tiff_libs_private_list "${LERC_LIBRARY}")
diff --git a/vcpkg/ports/tiff/usage b/vcpkg/ports/tiff/usage
new file mode 100644
index 0000000..d47265b
--- /dev/null
+++ b/vcpkg/ports/tiff/usage
@@ -0,0 +1,9 @@
+tiff is compatible with built-in CMake targets:
+
+ find_package(TIFF REQUIRED)
+ target_link_libraries(main PRIVATE TIFF::TIFF)
+
+tiff provides pkg-config modules:
+
+ # Tag Image File Format (TIFF) library.
+ libtiff-4
diff --git a/vcpkg/ports/tiff/vcpkg-cmake-wrapper.cmake.in b/vcpkg/ports/tiff/vcpkg-cmake-wrapper.cmake.in
new file mode 100644
index 0000000..c80e75a
--- /dev/null
+++ b/vcpkg/ports/tiff/vcpkg-cmake-wrapper.cmake.in
@@ -0,0 +1,123 @@
+cmake_policy(PUSH)
+cmake_policy(SET CMP0012 NEW)
+cmake_policy(SET CMP0057 NEW)
+set(z_vcpkg_tiff_find_options "")
+if("REQUIRED" IN_LIST ARGS)
+ list(APPEND z_vcpkg_tiff_find_options "REQUIRED")
+endif()
+if("QUIET" IN_LIST ARGS)
+ list(APPEND z_vcpkg_tiff_find_options "QUIET")
+endif()
+
+_find_package(${ARGS})
+
+if(TIFF_FOUND AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
+ include(SelectLibraryConfigurations)
+ set(z_vcpkg_tiff_link_libraries "")
+ set(z_vcpkg_tiff_libraries "")
+ if("@webp@")
+ find_package(WebP CONFIG ${z_vcpkg_tiff_find_options})
+ list(APPEND z_vcpkg_tiff_link_libraries "\$<LINK_ONLY:WebP::webp>")
+ list(APPEND z_vcpkg_tiff_libraries ${WebP_LIBRARIES})
+ endif()
+ if("@lzma@")
+ find_package(LibLZMA ${z_vcpkg_tiff_find_options})
+ list(APPEND z_vcpkg_tiff_link_libraries "\$<LINK_ONLY:LibLZMA::LibLZMA>")
+ list(APPEND z_vcpkg_tiff_libraries ${LIBLZMA_LIBRARIES})
+ endif()
+ if("@jpeg@")
+ find_package(JPEG ${z_vcpkg_tiff_find_options})
+ list(APPEND z_vcpkg_tiff_link_libraries "\$<LINK_ONLY:JPEG::JPEG>")
+ list(APPEND z_vcpkg_tiff_libraries ${JPEG_LIBRARIES})
+ endif()
+ if("@zstd@")
+ find_package(zstd CONFIG ${z_vcpkg_tiff_find_options})
+ set(z_vcpkg_tiff_zstd_target_property "IMPORTED_LOCATION_")
+ if(TARGET zstd::libzstd_shared)
+ set(z_vcpkg_tiff_zstd "\$<LINK_ONLY:zstd::libzstd_shared>")
+ set(z_vcpkg_tiff_zstd_target zstd::libzstd_shared)
+ if(WIN32)
+ set(z_vcpkg_tiff_zstd_target_property "IMPORTED_IMPLIB_")
+ endif()
+ else()
+ set(z_vcpkg_tiff_zstd "\$<LINK_ONLY:zstd::libzstd_static>")
+ set(z_vcpkg_tiff_zstd_target zstd::libzstd_static)
+ endif()
+ get_target_property(z_vcpkg_tiff_zstd_configs "${z_vcpkg_tiff_zstd_target}" IMPORTED_CONFIGURATIONS)
+ foreach(z_vcpkg_config IN LISTS z_vcpkg_tiff_zstd_configs)
+ get_target_property(ZSTD_LIBRARY_${z_vcpkg_config} "${z_vcpkg_tiff_zstd_target}" "${z_vcpkg_tiff_zstd_target_property}${z_vcpkg_config}")
+ endforeach()
+ select_library_configurations(ZSTD)
+ if(NOT TARGET ZSTD::ZSTD)
+ add_library(ZSTD::ZSTD INTERFACE IMPORTED)
+ set_property(TARGET ZSTD::ZSTD APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${z_vcpkg_tiff_zstd})
+ endif()
+ list(APPEND z_vcpkg_tiff_link_libraries ${z_vcpkg_tiff_zstd})
+ list(APPEND z_vcpkg_tiff_libraries ${ZSTD_LIBRARIES})
+ unset(z_vcpkg_tiff_zstd)
+ unset(z_vcpkg_tiff_zstd_configs)
+ unset(z_vcpkg_config)
+ unset(z_vcpkg_tiff_zstd_target)
+ endif()
+ if("@lerc@")
+ find_package(unofficial-lerc ${z_vcpkg_tiff_find_options})
+ get_target_property(z_vcpkg_lerc_configs unofficial::Lerc::Lerc IMPORTED_CONFIGURATIONS)
+ foreach(z_vcpkg_property IN ITEMS IMPORTED_IMPLIB_ IMPORTED_LOCATION_)
+ foreach(z_vcpkg_config IN LISTS z_vcpkg_lerc_configs)
+ get_target_property(Z_VCPKG_LERC_LIBRARY_${z_vcpkg_config} unofficial::Lerc::Lerc "${z_vcpkg_property}${z_vcpkg_config}")
+ endforeach()
+ select_library_configurations(Z_VCPKG_LERC)
+ if(Z_VCPKG_LERC_LIBRARIES)
+ break()
+ endif()
+ endforeach()
+ list(APPEND z_vcpkg_tiff_link_libraries "\$<LINK_ONLY:unofficial::Lerc::Lerc>")
+ list(APPEND z_vcpkg_tiff_libraries ${Z_VCPKG_LERC_LIBRARIES})
+ unset(z_vcpkg_config)
+ unset(z_vcpkg_lerc_configs)
+ unset(z_vcpkg_property)
+ unset(Z_VCPKG_LERC_FOUND)
+ endif()
+ if("@libdeflate@")
+ find_package(libdeflate ${z_vcpkg_tiff_find_options})
+ set(z_vcpkg_property "IMPORTED_LOCATION_")
+ if(TARGET libdeflate::libdeflate_shared)
+ set(z_vcpkg_libdeflate_target libdeflate::libdeflate_shared)
+ if(WIN32)
+ set(z_vcpkg_property "IMPORTED_IMPLIB_")
+ endif()
+ else()
+ set(z_vcpkg_libdeflate_target libdeflate::libdeflate_static)
+ endif()
+ get_target_property(z_vcpkg_libdeflate_configs "${z_vcpkg_libdeflate_target}" IMPORTED_CONFIGURATIONS)
+ foreach(z_vcpkg_config IN LISTS z_vcpkg_libdeflate_configs)
+ get_target_property(Z_VCPKG_DEFLATE_LIBRARY_${z_vcpkg_config} "${z_vcpkg_libdeflate_target}" "${z_vcpkg_property}${z_vcpkg_config}")
+ endforeach()
+ select_library_configurations(Z_VCPKG_DEFLATE)
+ list(APPEND z_vcpkg_tiff_link_libraries "\$<LINK_ONLY:${z_vcpkg_libdeflate_target}>")
+ list(APPEND z_vcpkg_tiff_libraries ${Z_VCPKG_DEFLATE_LIBRARIES})
+ unset(z_vcpkg_config)
+ unset(z_vcpkg_libdeflate_configs)
+ unset(z_vcpkg_libdeflate_target)
+ unset(z_vcpkg_property)
+ unset(Z_VCPKG_DEFLATE_FOUND)
+ endif()
+ if("@zlib@")
+ find_package(ZLIB ${z_vcpkg_tiff_find_options})
+ list(APPEND z_vcpkg_tiff_link_libraries "\$<LINK_ONLY:ZLIB::ZLIB>")
+ list(APPEND z_vcpkg_tiff_libraries ${ZLIB_LIBRARIES})
+ endif()
+ if(UNIX)
+ list(APPEND z_vcpkg_tiff_link_libraries m)
+ list(APPEND z_vcpkg_tiff_libraries m)
+ endif()
+
+ if(TARGET TIFF::TIFF)
+ set_property(TARGET TIFF::TIFF APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${z_vcpkg_tiff_link_libraries})
+ endif()
+ list(APPEND TIFF_LIBRARIES ${z_vcpkg_tiff_libraries})
+ unset(z_vcpkg_tiff_link_libraries)
+ unset(z_vcpkg_tiff_libraries)
+endif()
+unset(z_vcpkg_tiff_find_options)
+cmake_policy(POP)
diff --git a/vcpkg/ports/tiff/vcpkg.json b/vcpkg/ports/tiff/vcpkg.json
new file mode 100644
index 0000000..12a878d
--- /dev/null
+++ b/vcpkg/ports/tiff/vcpkg.json
@@ -0,0 +1,86 @@
+{
+ "name": "tiff",
+ "version": "4.7.1",
+ "description": "A library that supports the manipulation of TIFF image files",
+ "homepage": "https://libtiff.gitlab.io/libtiff/",
+ "license": "libtiff",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "default-features": [
+ "jpeg",
+ "lzma",
+ "zip"
+ ],
+ "features": {
+ "cxx": {
+ "description": "Build C++ libtiffxx library"
+ },
+ "jpeg": {
+ "description": "Support JPEG compression in TIFF image files",
+ "dependencies": [
+ "libjpeg-turbo"
+ ]
+ },
+ "lerc": {
+ "description": "Support LERC compression",
+ "dependencies": [
+ "lerc",
+ {
+ "name": "tiff",
+ "default-features": false,
+ "features": [
+ "zip"
+ ]
+ }
+ ]
+ },
+ "libdeflate": {
+ "description": "Use libdeflate for faster ZIP support",
+ "dependencies": [
+ "libdeflate",
+ {
+ "name": "tiff",
+ "default-features": false,
+ "features": [
+ "zip"
+ ]
+ }
+ ]
+ },
+ "lzma": {
+ "description": "Support LZMA compression in TIFF image files",
+ "dependencies": [
+ "liblzma"
+ ]
+ },
+ "tools": {
+ "description": "Build tools"
+ },
+ "webp": {
+ "description": "Support WEBP compression in TIFF image files",
+ "dependencies": [
+ "libwebp"
+ ]
+ },
+ "zip": {
+ "description": "Support ZIP/deflate compression in TIFF image files",
+ "dependencies": [
+ "zlib"
+ ]
+ },
+ "zstd": {
+ "description": "Support ZSTD compression in TIFF image files",
+ "dependencies": [
+ "zstd"
+ ]
+ }
+ }
+}