Skip to content

Commit

Permalink
libtiff >= 4.5.1: fix case sensitiity issue for discovery of jbig, lz…
Browse files Browse the repository at this point in the history
…ma 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 <[email protected]>
  • Loading branch information
SpaceIm and jcar87 authored Jan 7, 2025
1 parent eac98bd commit 04911c6
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 31 deletions.
11 changes: 5 additions & 6 deletions recipes/libtiff/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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")
27 changes: 27 additions & 0 deletions recipes/libtiff/all/patches/4.5.1-0001-cmake-dependencies.patch
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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()
8 changes: 0 additions & 8 deletions recipes/libtiff/all/test_v1_package/CMakeLists.txt

This file was deleted.

17 changes: 0 additions & 17 deletions recipes/libtiff/all/test_v1_package/conanfile.py

This file was deleted.

0 comments on commit 04911c6

Please sign in to comment.