From 04911c61af10b04a3f85b4ba7c3ee740d32c3aab Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 7 Jan 2025 17:47:14 +0100 Subject: [PATCH] libtiff >= 4.5.1: fix case sensitiity issue for discovery of jbig, lzma and zstd (#26209) * fix case sensitiity issue for discovery of jbig, lzma and zstd in libtiff >= 4.5.1 * restore patch for jbg_newlen check check_symbol_exists() is broken with old CMakeDeps generator, so this patch is still required * libtiff: use newer libdeflate --------- Co-authored-by: Luis Caro Campos <3535649+jcar87@users.noreply.github.com> --- recipes/libtiff/all/conanfile.py | 11 ++++---- .../4.5.1-0001-cmake-dependencies.patch | 27 +++++++++++++++++++ .../all/test_v1_package/CMakeLists.txt | 8 ------ .../libtiff/all/test_v1_package/conanfile.py | 17 ------------ 4 files changed, 32 insertions(+), 31 deletions(-) delete mode 100644 recipes/libtiff/all/test_v1_package/CMakeLists.txt delete mode 100644 recipes/libtiff/all/test_v1_package/conanfile.py diff --git a/recipes/libtiff/all/conanfile.py b/recipes/libtiff/all/conanfile.py index 52a5afb9847a5..4e360689a1960 100644 --- a/recipes/libtiff/all/conanfile.py +++ b/recipes/libtiff/all/conanfile.py @@ -65,7 +65,7 @@ def requirements(self): if self.options.zlib: self.requires("zlib/[>=1.2.11 <2]") if self.options.libdeflate: - self.requires("libdeflate/1.19") + self.requires("libdeflate/[>=1.19 <=1.22]") #tested with this range if self.options.lzma: self.requires("xz_utils/[>=5.4.5 <6]") if self.options.jpeg == "libjpeg": @@ -117,10 +117,13 @@ def generate(self): tc.generate() deps = CMakeDeps(self) if Version(self.version) >= "4.5.1": + deps.set_property("jbig", "cmake_file_name", "JBIG") deps.set_property("jbig", "cmake_target_name", "JBIG::JBIG") + deps.set_property("xz_utils", "cmake_file_name", "liblzma") deps.set_property("xz_utils", "cmake_target_name", "liblzma::liblzma") deps.set_property("libdeflate", "cmake_file_name", "Deflate") deps.set_property("libdeflate", "cmake_target_name", "Deflate::Deflate") + deps.set_property("zstd", "cmake_file_name", "ZSTD") deps.generate() def _patch_sources(self): @@ -185,8 +188,4 @@ def package_info(self): if self.options.zstd: self.cpp_info.requires.append("zstd::zstd") if self.options.webp: - self.cpp_info.requires.append("libwebp::libwebp") - - # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed - self.cpp_info.names["cmake_find_package"] = "TIFF" - self.cpp_info.names["cmake_find_package_multi"] = "TIFF" + self.cpp_info.requires.append("libwebp::webp") diff --git a/recipes/libtiff/all/patches/4.5.1-0001-cmake-dependencies.patch b/recipes/libtiff/all/patches/4.5.1-0001-cmake-dependencies.patch index 761950e496109..7f9f61471aceb 100644 --- a/recipes/libtiff/all/patches/4.5.1-0001-cmake-dependencies.patch +++ b/recipes/libtiff/all/patches/4.5.1-0001-cmake-dependencies.patch @@ -1,3 +1,16 @@ +diff --git a/cmake/JBIGCodec.cmake b/cmake/JBIGCodec.cmake +index a4350028..4cb01552 100644 +--- a/cmake/JBIGCodec.cmake ++++ b/cmake/JBIGCodec.cmake +@@ -34,7 +34,7 @@ if(JBIG_FOUND) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${JBIG_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES}) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${JBIG_LIBRARIES}) +- check_symbol_exists(jbg_newlen "jbig.h" HAVE_JBG_NEWLEN) ++ set(HAVE_JBG_NEWLEN TRUE) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE}) + endif() diff --git a/cmake/JPEGCodec.cmake b/cmake/JPEGCodec.cmake index 8455a3ec..09fe975a 100644 --- a/cmake/JPEGCodec.cmake @@ -29,3 +42,17 @@ index 8455a3ec..09fe975a 100644 endif() if (NOT HAVE_JPEGTURBO_DUAL_MODE_8_12) +diff --git a/cmake/LZMACodec.cmake b/cmake/LZMACodec.cmake +index c51afe82..53ef874e 100644 +--- a/cmake/LZMACodec.cmake ++++ b/cmake/LZMACodec.cmake +@@ -28,7 +28,7 @@ + set(LZMA_SUPPORT FALSE) + find_package(liblzma) + +-option(lzma "use liblzma (required for LZMA2 compression)" ${LIBLZMA_FOUND}) +-if (lzma AND LIBLZMA_FOUND) ++option(lzma "use liblzma (required for LZMA2 compression)" ${liblzma_FOUND}) ++if (lzma AND liblzma_FOUND) + set(LZMA_SUPPORT TRUE) + endif() diff --git a/recipes/libtiff/all/test_v1_package/CMakeLists.txt b/recipes/libtiff/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index 0d20897301b68..0000000000000 --- a/recipes/libtiff/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package - ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libtiff/all/test_v1_package/conanfile.py b/recipes/libtiff/all/test_v1_package/conanfile.py deleted file mode 100644 index 19e6a0c06e3d8..0000000000000 --- a/recipes/libtiff/all/test_v1_package/conanfile.py +++ /dev/null @@ -1,17 +0,0 @@ -from conans import ConanFile, CMake, tools -import os - - -class TestPackageConan(ConanFile): - settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" - - def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() - - def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True)