-
Notifications
You must be signed in to change notification settings - Fork 2k
leptonica: add version 1.83.0 #14864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 12 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
8a049ef
Add leptonica 1.83.0
theirix 680c86e
Modernize with rm_safe
theirix afdd5dd
Add new options for libwebp and openjpeg from 1.83.0
theirix abed4de
Fix whitespaces in inline patching for 1.83.0
theirix 44481b6
Consolidate handling webp, openjpeg options
theirix ccab369
Use find_package(GIFLIB)
theirix a7e6711
Add required fields to yaml
theirix 70c954f
Update patch metadata
theirix 41ee149
Revert "Use find_package(GIFLIB)"
theirix e055c41
Use openjpeg 2.4.0 for Leptonica older thatn 1.83.0
theirix 85adf72
Improve patching for 1.82.0
theirix 2ba033f
Try to link to target openjp2
theirix 5615073
Prefer CMake for openjpeg
theirix 5f49683
Fix patching pkg_check_modules for older versions
theirix 5e7bef4
Always depend on latest openjpeg
theirix 82ae5a3
Bump libpng dependency
theirix File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
import os | ||
import textwrap | ||
|
||
required_conan_version = ">=1.52.0" | ||
required_conan_version = ">=1.53.0" | ||
|
||
|
||
class LeptonicaConan(ConanFile): | ||
|
@@ -55,18 +55,9 @@ def configure(self): | |
if self.options.with_tiff: | ||
self.options["libtiff"].jpeg = self.options.with_jpeg | ||
if self.options.shared: | ||
try: | ||
del self.options.fPIC | ||
except Exception: | ||
pass | ||
try: | ||
del self.settings.compiler.libcxx | ||
except Exception: | ||
pass | ||
try: | ||
del self.settings.compiler.cppstd | ||
except Exception: | ||
pass | ||
self.options.rm_safe("fPIC") | ||
self.settings.rm_safe("compiler.cppstd") | ||
self.settings.rm_safe("compiler.libcxx") | ||
|
||
def layout(self): | ||
cmake_layout(self, src_folder="src") | ||
|
@@ -85,7 +76,11 @@ def requirements(self): | |
if self.options.with_tiff: | ||
self.requires("libtiff/4.4.0") | ||
if self.options.with_openjpeg: | ||
self.requires("openjpeg/2.5.0") | ||
if Version(self.version) >= "1.83.0": | ||
# newer leptonica can autodetect any openjpeg version | ||
self.requires("openjpeg/2.5.0") | ||
else: | ||
self.requires("openjpeg/2.4.0") | ||
if self.options.with_webp: | ||
self.requires("libwebp/1.2.4") | ||
|
||
|
@@ -108,6 +103,9 @@ def generate(self): | |
tc.variables["STATIC"] = not self.options.shared | ||
tc.variables["BUILD_PROG"] = False | ||
tc.variables["SW_BUILD"] = False | ||
if Version(self.version) >= "1.83.0": | ||
tc.variables["LIBWEBP_SUPPORT"] = self.options.with_webp | ||
tc.variables["OPENJPEG_SUPPORT"] = self.options.with_openjpeg | ||
tc.generate() | ||
deps = CMakeDeps(self) | ||
deps.generate() | ||
|
@@ -139,47 +137,64 @@ def _patch_sources(self): | |
replace_in_file(self, cmakelists_src, "${GIF_LIBRARIES}", "GIF::GIF") | ||
if not self.options.with_gif: | ||
replace_in_file(self, cmakelists_src, "if (GIF_LIBRARIES)", "if(0)") | ||
replace_in_file(self, cmake_configure, "if (GIF_FOUND)", "if(0)") | ||
if Version(self.version) >= "1.83.0": | ||
replace_in_file(self, cmake_configure, "if(GIF_FOUND)", "if(0)") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would love to see patches for this project in the future 🙏 |
||
else: | ||
replace_in_file(self, cmake_configure, "if (GIF_FOUND)", "if(0)") | ||
## libjpeg | ||
replace_in_file(self, cmakelists_src, "${JPEG_LIBRARIES}", "JPEG::JPEG") | ||
if not self.options.with_jpeg: | ||
replace_in_file(self, cmakelists_src, "if (JPEG_LIBRARIES)", "if(0)") | ||
replace_in_file(self, cmake_configure, "if (JPEG_FOUND)", "if(0)") | ||
if Version(self.version) >= "1.83.0": | ||
replace_in_file(self, cmake_configure, "if(JPEG_FOUND)", "if(0)") | ||
else: | ||
replace_in_file(self, cmake_configure, "if (JPEG_FOUND)", "if(0)") | ||
## libpng | ||
replace_in_file(self, cmakelists_src, "${PNG_LIBRARIES}", "PNG::PNG") | ||
if not self.options.with_png: | ||
replace_in_file(self, cmakelists_src, "if (PNG_LIBRARIES)", "if(0)") | ||
replace_in_file(self, cmake_configure, "if (PNG_FOUND)", "if(0)") | ||
if Version(self.version) >= "1.83.0": | ||
replace_in_file(self, cmake_configure, "if(PNG_FOUND)", "if(0)") | ||
else: | ||
replace_in_file(self, cmake_configure, "if (PNG_FOUND)", "if(0)") | ||
## libtiff | ||
replace_in_file(self, cmakelists_src, "${TIFF_LIBRARIES}", "TIFF::TIFF") | ||
if not self.options.with_tiff: | ||
replace_in_file(self, cmakelists_src, "if (TIFF_LIBRARIES)", "if(0)") | ||
replace_in_file(self, cmake_configure, "if (TIFF_FOUND)", "if(0)") | ||
if Version(self.version) >= "1.83.0": | ||
replace_in_file(self, cmake_configure, "if(TIFF_FOUND)", "if(0)") | ||
else: | ||
replace_in_file(self, cmake_configure, "if (TIFF_FOUND)", "if(0)") | ||
## 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, "if(NOT JP2K)", "if(0)") | ||
replace_in_file(self, cmakelists_src, | ||
"if (JP2K_FOUND)", | ||
"if (JP2K_FOUND)\n" | ||
"target_link_directories(leptonica PRIVATE ${JP2K_LIBRARY_DIRS})\n" | ||
"target_compile_definitions(leptonica PRIVATE ${JP2K_CFLAGS_OTHER})") | ||
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)") | ||
replace_in_file(self, cmakelists_src, "${JP2K_LIBRARIES}", "openjp2") | ||
if Version(self.version) < "1.83.0": | ||
# versions below 1.83.0 do not have an option toggle | ||
replace_in_file(self, cmakelists, "if(NOT JP2K)", "if(0)") | ||
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: | ||
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)") | ||
|
||
## libwebp | ||
replace_in_file(self, cmakelists, "if(NOT WEBP)", "if(0)") | ||
if Version(self.version) < "1.83.0": | ||
# versions below 1.83.0 do not have an option toggle | ||
replace_in_file(self, cmakelists, "if(NOT WEBP)", "if(0)") | ||
if Version(self.version) >= "1.79.0": | ||
replace_in_file(self, cmakelists, "if(NOT WEBPMUX)", "if(0)") | ||
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)") | ||
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.79.0": | ||
replace_in_file(self, cmakelists, "if(NOT WEBPMUX)", "if(0)") | ||
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)") | ||
|
||
# Remove detection of fmemopen() on macOS < 10.13 | ||
# CheckFunctionExists will find it in the link library. | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
versions: | ||
"1.83.0": | ||
folder: all | ||
"1.82.0": | ||
folder: all | ||
"1.81.0": | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.