Skip to content

Commit a0fa3ec

Browse files
Revert "(conan-io#14864) leptonica: add version 1.83.0"
This reverts commit 5ddac4f. This is being reverted because the options to turn off different graphic packages don't work (WEBP, etc.).
1 parent 74d1756 commit a0fa3ec

File tree

3 files changed

+33
-57
lines changed

3 files changed

+33
-57
lines changed

recipes/leptonica/all/conandata.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
sources:
2-
"1.83.0":
3-
url: "https://github.com/DanBloomberg/leptonica/archive/1.83.0.tar.gz"
4-
sha256: "14cf531c2219a1414e8e3c51a3caa5cf021a52e782c4a6561bf64d0ef2119282"
52
"1.82.0":
63
url: "https://github.com/DanBloomberg/leptonica/archive/1.82.0.tar.gz"
74
sha256: "40fa9ac1e815b91e0fa73f0737e60c9eec433a95fa123f95f2573dd3127dd669"
@@ -20,6 +17,3 @@ sources:
2017
patches:
2118
"1.78.0":
2219
- patch_file: "patches/fix-find-modules-variables.patch"
23-
patch_description: "CMake: robust handling of dependencies"
24-
patch_type: "portability"
25-
patch_source: "https://github.com/DanBloomberg/leptonica/pull/456"

recipes/leptonica/all/conanfile.py

Lines changed: 33 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import os
99
import textwrap
1010

11-
required_conan_version = ">=1.53.0"
11+
required_conan_version = ">=1.52.0"
1212

1313

1414
class LeptonicaConan(ConanFile):
@@ -55,9 +55,18 @@ def configure(self):
5555
if self.options.with_tiff:
5656
self.options["libtiff"].jpeg = self.options.with_jpeg
5757
if self.options.shared:
58-
self.options.rm_safe("fPIC")
59-
self.settings.rm_safe("compiler.cppstd")
60-
self.settings.rm_safe("compiler.libcxx")
58+
try:
59+
del self.options.fPIC
60+
except Exception:
61+
pass
62+
try:
63+
del self.settings.compiler.libcxx
64+
except Exception:
65+
pass
66+
try:
67+
del self.settings.compiler.cppstd
68+
except Exception:
69+
pass
6170

6271
def layout(self):
6372
cmake_layout(self, src_folder="src")
@@ -72,7 +81,7 @@ def requirements(self):
7281
if self.options.with_jpeg == "libjpeg-turbo":
7382
self.requires("libjpeg-turbo/2.1.4")
7483
if self.options.with_png:
75-
self.requires("libpng/1.6.39")
84+
self.requires("libpng/1.6.38")
7685
if self.options.with_tiff:
7786
self.requires("libtiff/4.4.0")
7887
if self.options.with_openjpeg:
@@ -99,9 +108,6 @@ def generate(self):
99108
tc.variables["STATIC"] = not self.options.shared
100109
tc.variables["BUILD_PROG"] = False
101110
tc.variables["SW_BUILD"] = False
102-
if Version(self.version) >= "1.83.0":
103-
tc.variables["LIBWEBP_SUPPORT"] = self.options.with_webp
104-
tc.variables["OPENJPEG_SUPPORT"] = self.options.with_openjpeg
105111
tc.generate()
106112
deps = CMakeDeps(self)
107113
deps.generate()
@@ -133,69 +139,47 @@ def _patch_sources(self):
133139
replace_in_file(self, cmakelists_src, "${GIF_LIBRARIES}", "GIF::GIF")
134140
if not self.options.with_gif:
135141
replace_in_file(self, cmakelists_src, "if (GIF_LIBRARIES)", "if(0)")
136-
if Version(self.version) >= "1.83.0":
137-
replace_in_file(self, cmake_configure, "if(GIF_FOUND)", "if(0)")
138-
else:
139-
replace_in_file(self, cmake_configure, "if (GIF_FOUND)", "if(0)")
142+
replace_in_file(self, cmake_configure, "if (GIF_FOUND)", "if(0)")
140143
## libjpeg
141144
replace_in_file(self, cmakelists_src, "${JPEG_LIBRARIES}", "JPEG::JPEG")
142145
if not self.options.with_jpeg:
143146
replace_in_file(self, cmakelists_src, "if (JPEG_LIBRARIES)", "if(0)")
144-
if Version(self.version) >= "1.83.0":
145-
replace_in_file(self, cmake_configure, "if(JPEG_FOUND)", "if(0)")
146-
else:
147-
replace_in_file(self, cmake_configure, "if (JPEG_FOUND)", "if(0)")
147+
replace_in_file(self, cmake_configure, "if (JPEG_FOUND)", "if(0)")
148148
## libpng
149149
replace_in_file(self, cmakelists_src, "${PNG_LIBRARIES}", "PNG::PNG")
150150
if not self.options.with_png:
151151
replace_in_file(self, cmakelists_src, "if (PNG_LIBRARIES)", "if(0)")
152-
if Version(self.version) >= "1.83.0":
153-
replace_in_file(self, cmake_configure, "if(PNG_FOUND)", "if(0)")
154-
else:
155-
replace_in_file(self, cmake_configure, "if (PNG_FOUND)", "if(0)")
152+
replace_in_file(self, cmake_configure, "if (PNG_FOUND)", "if(0)")
156153
## libtiff
157154
replace_in_file(self, cmakelists_src, "${TIFF_LIBRARIES}", "TIFF::TIFF")
158155
if not self.options.with_tiff:
159156
replace_in_file(self, cmakelists_src, "if (TIFF_LIBRARIES)", "if(0)")
160-
if Version(self.version) >= "1.83.0":
161-
replace_in_file(self, cmake_configure, "if(TIFF_FOUND)", "if(0)")
162-
else:
163-
replace_in_file(self, cmake_configure, "if (TIFF_FOUND)", "if(0)")
157+
replace_in_file(self, cmake_configure, "if (TIFF_FOUND)", "if(0)")
164158
## We have to be more aggressive with dependencies found with pkgconfig
165159
## Injection of libdirs is ensured by conan_basic_setup()
166160
## openjpeg
167-
replace_in_file(self, cmakelists_src, "${JP2K_LIBRARIES}", "openjp2")
168-
if Version(self.version) < "1.83.0":
169-
# pkgconfig is prefered to CMake. Disable pkgconfig so only CMake is used
170-
if Version(self.version) <= "1.78.0":
171-
replace_in_file(self, cmakelists, "pkg_check_modules(JP2K libopenjp2)", "")
172-
else:
173-
replace_in_file(self, cmakelists, "pkg_check_modules(JP2K libopenjp2>=2.0 QUIET)", "")
174-
# versions below 1.83.0 do not have an option toggle
175-
replace_in_file(self, cmakelists, "if(NOT JP2K)", "if(0)")
176-
if not self.options.with_openjpeg:
177-
replace_in_file(self, cmakelists_src, "if (JP2K_FOUND)", "if(0)")
178-
replace_in_file(self, cmake_configure, "if (JP2K_FOUND)", "if(0)")
179-
else:
180-
replace_in_file(self, cmakelists, "set(JP2K_INCLUDE_DIRS ${OPENJPEG_INCLUDE_DIRS})", "set(JP2K_INCLUDE_DIRS ${OpenJPEG_INCLUDE_DIRS})")
181-
if not self.options.with_openjpeg:
182-
replace_in_file(self, cmake_configure, "if(JP2K_FOUND)", "if(0)")
183-
161+
replace_in_file(self, cmakelists, "if(NOT JP2K)", "if(0)")
162+
replace_in_file(self, cmakelists_src,
163+
"if (JP2K_FOUND)",
164+
"if (JP2K_FOUND)\n"
165+
"target_link_directories(leptonica PRIVATE ${JP2K_LIBRARY_DIRS})\n"
166+
"target_compile_definitions(leptonica PRIVATE ${JP2K_CFLAGS_OTHER})")
167+
if not self.options.with_openjpeg:
168+
replace_in_file(self, cmakelists_src, "if (JP2K_FOUND)", "if(0)")
169+
replace_in_file(self, cmake_configure, "if (JP2K_FOUND)", "if(0)")
184170
## libwebp
185-
if Version(self.version) < "1.83.0":
186-
# versions below 1.83.0 do not have an option toggle
187-
replace_in_file(self, cmakelists, "if(NOT WEBP)", "if(0)")
188-
if Version(self.version) >= "1.79.0":
189-
replace_in_file(self, cmakelists, "if(NOT WEBPMUX)", "if(0)")
190-
if not self.options.with_webp:
191-
replace_in_file(self, cmakelists_src, "if (WEBP_FOUND)", "if(0)")
192-
replace_in_file(self, cmake_configure, "if (WEBP_FOUND)", "if(0)")
171+
replace_in_file(self, cmakelists, "if(NOT WEBP)", "if(0)")
193172
replace_in_file(self, cmakelists_src,
194173
"if (WEBP_FOUND)",
195174
"if (WEBP_FOUND)\n"
196175
"target_link_directories(leptonica PRIVATE ${WEBP_LIBRARY_DIRS} ${WEBPMUX_LIBRARY_DIRS})\n"
197176
"target_compile_definitions(leptonica PRIVATE ${WEBP_CFLAGS_OTHER} ${WEBPMUX_CFLAGS_OTHER})")
198177
replace_in_file(self, cmakelists_src, "${WEBP_LIBRARIES}", "${WEBP_LIBRARIES} ${WEBPMUX_LIBRARIES}")
178+
if Version(self.version) >= "1.79.0":
179+
replace_in_file(self, cmakelists, "if(NOT WEBPMUX)", "if(0)")
180+
if not self.options.with_webp:
181+
replace_in_file(self, cmakelists_src, "if (WEBP_FOUND)", "if(0)")
182+
replace_in_file(self, cmake_configure, "if (WEBP_FOUND)", "if(0)")
199183

200184
# Remove detection of fmemopen() on macOS < 10.13
201185
# CheckFunctionExists will find it in the link library.

recipes/leptonica/config.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
versions:
2-
"1.83.0":
3-
folder: all
42
"1.82.0":
53
folder: all
64
"1.81.0":

0 commit comments

Comments
 (0)