Skip to content

Commit

Permalink
leptonica: add new version 1.85.0 (#25669)
Browse files Browse the repository at this point in the history
* leptonica: add version 1.85.0

* support new variables
  • Loading branch information
toge authored Nov 12, 2024
1 parent df2900e commit bd4fcb1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
3 changes: 3 additions & 0 deletions recipes/leptonica/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"1.85.0":
url: "https://github.com/DanBloomberg/leptonica/archive/1.85.0.tar.gz"
sha256: "c01376bce0379d4ea4bc2ec5d5cbddaa49e2f06f88242619ab8c059e21adf233"
"1.83.1":
url: "https://github.com/DanBloomberg/leptonica/archive/1.83.1.tar.gz"
sha256: "4289d0a4224b614010072253531c0455a33a4d7c7a0017fe7825ed382290c0da"
Expand Down
30 changes: 20 additions & 10 deletions recipes/leptonica/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,15 @@ def generate(self):
tc = CMakeToolchain(self)
tc.variables["BUILD_PROG"] = False
tc.variables["SW_BUILD"] = False
if Version(self.version) >= "1.83.0":
if Version(self.version) >= "1.85.0":
tc.variables["ENABLE_ZLIB"] = self.options.with_zlib
tc.variables["ENABLE_PNG"] = self.options.with_png
tc.variables["ENABLE_GIF"] = self.options.with_gif
tc.variables["ENABLE_JPEG"] = self.options.with_jpeg
tc.variables["ENABLE_TIFF"] = self.options.with_tiff
tc.variables["ENABLE_WEBP"] = self.options.with_webp
tc.variables["ENABLE_OPENJPEG"] = self.options.with_openjpeg
elif Version(self.version) >= "1.83.0":
tc.variables["LIBWEBP_SUPPORT"] = self.options.with_webp
tc.variables["OPENJPEG_SUPPORT"] = self.options.with_openjpeg
tc.generate()
Expand Down Expand Up @@ -145,7 +153,8 @@ def _patch_sources(self):
## We have to be more aggressive with dependencies found with pkgconfig
## Injection of libdirs is ensured by conan_basic_setup()
## openjpeg
replace_in_file(self, cmakelists_src, "${JP2K_LIBRARIES}", "openjp2")
if Version(self.version) < "1.85.0":
replace_in_file(self, cmakelists_src, "${JP2K_LIBRARIES}", "openjp2")
if Version(self.version) < "1.83.0":
# pkgconfig is prefered to CMake. Disable pkgconfig so only CMake is used
replace_in_file(self, cmakelists, "pkg_check_modules(JP2K libopenjp2>=2.0 QUIET)", "")
Expand All @@ -154,7 +163,7 @@ def _patch_sources(self):
if not self.options.with_openjpeg:
replace_in_file(self, cmakelists_src, "if (JP2K_FOUND)", "if(0)")
replace_in_file(self, cmake_configure, "if (JP2K_FOUND)", "if(0)")
else:
elif Version(self.version) < "1.85.0":
replace_in_file(self, cmakelists, "set(JP2K_INCLUDE_DIRS ${OPENJPEG_INCLUDE_DIRS})", "set(JP2K_INCLUDE_DIRS ${OpenJPEG_INCLUDE_DIRS})")
if not self.options.with_openjpeg:
replace_in_file(self, cmake_configure, "if (JP2K_FOUND)", "if(0)")
Expand All @@ -167,13 +176,14 @@ def _patch_sources(self):
if not self.options.with_webp:
replace_in_file(self, cmakelists_src, "if (WEBP_FOUND)", "if(0)")
replace_in_file(self, cmake_configure, "if (WEBP_FOUND)", "if(0)")
if Version(self.version) >= "1.83.0" or self.options.with_webp:
replace_in_file(self, cmakelists_src,
"if (WEBP_FOUND)",
"if (WEBP_FOUND)\n"
"target_link_directories(leptonica PRIVATE ${WEBP_LIBRARY_DIRS} ${WEBPMUX_LIBRARY_DIRS})\n"
"target_compile_definitions(leptonica PRIVATE ${WEBP_CFLAGS_OTHER} ${WEBPMUX_CFLAGS_OTHER})")
replace_in_file(self, cmakelists_src, "${WEBP_LIBRARIES}", "${WEBP_LIBRARIES} ${WEBPMUX_LIBRARIES}")
if Version(self.version) < "1.85.0":
if Version(self.version) >= "1.83.0" and self.options.with_webp:
replace_in_file(self, cmakelists_src,
"if (WEBP_FOUND)",
"if (WEBP_FOUND)\n"
"target_link_directories(leptonica PRIVATE ${WEBP_LIBRARY_DIRS} ${WEBPMUX_LIBRARY_DIRS})\n"
"target_compile_definitions(leptonica PRIVATE ${WEBP_CFLAGS_OTHER} ${WEBPMUX_CFLAGS_OTHER})")
replace_in_file(self, cmakelists_src, "${WEBP_LIBRARIES}", "${WEBP_LIBRARIES} ${WEBPMUX_LIBRARIES}")

# Remove detection of fmemopen() on macOS < 10.13
# CheckFunctionExists will find it in the link library.
Expand Down
2 changes: 2 additions & 0 deletions recipes/leptonica/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"1.85.0":
folder: all
"1.83.1":
folder: all
"1.82.0":
Expand Down

0 comments on commit bd4fcb1

Please sign in to comment.