diff --git a/recipes/exiv2/all/conandata.yml b/recipes/exiv2/all/conandata.yml index 63e5ef9836649..981b0a2937754 100644 --- a/recipes/exiv2/all/conandata.yml +++ b/recipes/exiv2/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.28.0": + url: "https://github.com/Exiv2/exiv2/releases/download/v0.28.0/exiv2-0.28.0-Source.tar.gz" + sha256: "89af3b5ef7277753ef7a7b5374ae017c6b9e304db3b688f1948e73e103491f3d" "0.27.5": url: "https://github.com/Exiv2/exiv2/releases/download/v0.27.5/exiv2-0.27.5-Source.tar.gz" sha256: "35a58618ab236a901ca4928b0ad8b31007ebdc0386d904409d825024e45ea6e2" @@ -6,6 +9,11 @@ sources: url: "https://github.com/Exiv2/exiv2/releases/download/v0.27.4/exiv2-0.27.4-Source.tar.gz" sha256: "84366dba7c162af9a7603bcd6c16f40fe0e9af294ba2fd2f66ffffb9fbec904e" patches: + "0.28.0": + - patch_file: "patches/0001-link-0.28.0.patch" + - patch_file: "patches/0004-find-expat-0.28.0.patch" + patch_description: "enforce usage of FindEXPAT.cmake" + patch_type: "conan" "0.27.5": - patch_file: "patches/0001-link-0.27.5.patch" - patch_file: "patches/0003-fix-ios.patch" diff --git a/recipes/exiv2/all/conanfile.py b/recipes/exiv2/all/conanfile.py index 34ee99761cacc..b5c3445fd34da 100644 --- a/recipes/exiv2/all/conanfile.py +++ b/recipes/exiv2/all/conanfile.py @@ -1,9 +1,12 @@ -from conan import ConanFile +from conan import ConanFile, conan_version from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout, CMakeDeps from conan.tools.files import get, copy, rmdir, save, export_conandata_patches, apply_conandata_patches -from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, check_min_vs +from conan.tools.scm import Version import os +import sys import textwrap required_conan_version = ">=1.53.0" @@ -26,6 +29,9 @@ class Exiv2Conan(ConanFile): "with_png": [True, False], "with_xmp": [False, "bundled", "external"], "with_curl": [True, False], + "with_brotli": [True, False], + "with_inih": [True, False], + "win_unicode": [True, False], } default_options = { "shared": False, @@ -33,6 +39,9 @@ class Exiv2Conan(ConanFile): "with_png": True, "with_xmp": "bundled", "with_curl": False, + "with_brotli": True, + "with_inih": True, + "win_unicode": False, } provides = [] @@ -43,6 +52,14 @@ def export_sources(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if Version(self.version) >= "0.28.0": + del self.options.win_unicode + else: + del self.options.with_brotli + del self.options.with_inih + + if self.settings.os == "Windows": + self.options.win_unicode = True def configure(self): if self.options.shared: @@ -58,14 +75,43 @@ def layout(self): def requirements(self): self.requires("libiconv/1.17") if self.options.with_png: - self.requires("libpng/1.6.39") + self.requires("libpng/1.6.40") self.requires("zlib/1.2.13") if self.options.with_xmp == "bundled": self.requires("expat/2.5.0") if self.options.with_curl: - self.requires("libcurl/7.87.0") + self.requires("libcurl/8.2.1") + if self.options.get_safe("with_brotli"): + self.requires("brotli/1.0.9") + if self.options.get_safe("with_inih"): + self.requires("inih/57") def validate(self): + if Version(self.version) >= "0.28.0": + min_cppstd = 17 + + if self.settings.compiler.cppstd: + check_min_cppstd(self, min_cppstd) + check_min_vs(self, 191) + + compilers_minimum_version = { + "gcc": "8", + "clang": "5", + "apple-clang": "10", + } + if not is_msvc(self): + minimum_version = compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{min_cppstd}, which your compiler does not fully support." + ) + elif conan_version.major == 2: + # FIXME: linter complains, but function is there + # https://docs.conan.io/2.0/reference/tools/build.html?highlight=check_min_cppstd#conan-tools-build-check-max-cppstd + check_max_cppstd = getattr(sys.modules['conan.tools.build'], 'check_max_cppstd') + # https://github.com/Exiv2/exiv2/tree/v0.27.7#217-building-with-c11-and-other-compilers + check_max_cppstd(self, 14) + if self.options.with_xmp == "external": raise ConanInvalidConfiguration("adobe-xmp-toolkit is not available on cci (yet)") @@ -84,6 +130,12 @@ def generate(self): tc.variables["EXIV2_ENABLE_WEBREADY"] = self.options.with_curl tc.variables["EXIV2_ENABLE_CURL"] = self.options.with_curl tc.variables["EXIV2_ENABLE_SSH"] = False + if Version(self.version) >= "0.28.0": + tc.variables["EXIV2_ENABLE_BMFF"] = self.options.with_brotli + tc.variables["EXIV2_ENABLE_BROTLI"] = self.options.with_brotli + tc.variables["EXIV2_ENABLE_INIH"] = self.options.with_inih + else: + tc.variables["EXIV2_ENABLE_WIN_UNICODE"] = self.options.win_unicode tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" if is_msvc(self): @@ -145,6 +197,10 @@ def package_info(self): self.cpp_info.components["exiv2lib"].requires.extend(["libpng::libpng", "zlib::zlib"]) if self.options.with_curl: self.cpp_info.components["exiv2lib"].requires.append("libcurl::libcurl") + if self.options.get_safe("with_brotli"): + self.cpp_info.components["exiv2lib"].requires.extend(["brotli::brotlidec", "brotli::brotlienc"]) + if self.options.get_safe("with_inih"): + self.cpp_info.components["exiv2lib"].requires.append("inih::inireader") if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.components["exiv2lib"].system_libs.extend(["pthread"]) @@ -154,14 +210,17 @@ def package_info(self): # component exiv2-xmp if self.options.with_xmp == "bundled": - self.cpp_info.components["exiv2-xmp"].set_property("cmake_target_name", "exiv2-xmp") - self.cpp_info.components["exiv2-xmp"].libs = ["exiv2-xmp"] - self.cpp_info.components["exiv2-xmp"].requires = [ "expat::expat" ] - self.cpp_info.components["exiv2lib"].requires.append("exiv2-xmp") + if Version(self.version) < "0.28.0": + self.cpp_info.components["exiv2-xmp"].set_property("cmake_target_name", "exiv2-xmp") + self.cpp_info.components["exiv2-xmp"].libs = ["exiv2-xmp"] + self.cpp_info.components["exiv2-xmp"].requires = [ "expat::expat" ] + self.cpp_info.components["exiv2lib"].requires.append("exiv2-xmp") + else: + self.cpp_info.components["exiv2lib"].requires.append("expat::expat") # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.components["exiv2lib"].build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.components["exiv2lib"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] - if self.options.with_xmp == "bundled": + if self.options.with_xmp == "bundled" and Version(self.version) < "0.28.0": self.cpp_info.components["exiv2-xmp"].build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.components["exiv2-xmp"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] diff --git a/recipes/exiv2/all/patches/0001-link-0.28.0.patch b/recipes/exiv2/all/patches/0001-link-0.28.0.patch new file mode 100644 index 0000000000000..0c0e5fa28d40c --- /dev/null +++ b/recipes/exiv2/all/patches/0001-link-0.28.0.patch @@ -0,0 +1,22 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 41a672e8..93370b5e 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -170,10 +170,10 @@ if (MSVC) + set_target_properties(exiv2lib PROPERTIES LINK_FLAGS "/ignore:4099") + endif() + +-set_target_properties( exiv2lib_int PROPERTIES +- POSITION_INDEPENDENT_CODE ON +- COMPILE_DEFINITIONS exiv2lib_EXPORTS +-) ++ ++ ++ ++ + + # NOTE: Cannot use target_link_libraries on OBJECT libraries with old versions of CMake + target_include_directories(exiv2lib_int PRIVATE ${ZLIB_INCLUDE_DIR}) +-- +2.33.0.windows.1 + diff --git a/recipes/exiv2/all/patches/0004-find-expat-0.28.0.patch b/recipes/exiv2/all/patches/0004-find-expat-0.28.0.patch new file mode 100644 index 0000000000000..07fb4804513c7 --- /dev/null +++ b/recipes/exiv2/all/patches/0004-find-expat-0.28.0.patch @@ -0,0 +1,16 @@ +diff --git a/cmake/findDependencies.cmake b/cmake/findDependencies.cmake +index 1075c303..d8b580d4 100644 +--- a/cmake/findDependencies.cmake ++++ b/cmake/findDependencies.cmake +@@ -60,7 +60,7 @@ if (EXIV2_ENABLE_XMP AND EXIV2_ENABLE_EXTERNAL_XMP) + message(FATAL_ERROR "EXIV2_ENABLE_XMP AND EXIV2_ENABLE_EXTERNAL_XMP are mutually exclusive. You can only choose one of them") + else() + if (EXIV2_ENABLE_XMP) +- find_package(EXPAT REQUIRED) ++ find_package(EXPAT REQUIRED MODULE) + elseif (EXIV2_ENABLE_EXTERNAL_XMP) + find_package(XmpSdk REQUIRED) + endif () +-- +2.33.0.windows.1 + diff --git a/recipes/exiv2/all/test_package/CMakeLists.txt b/recipes/exiv2/all/test_package/CMakeLists.txt index 3bd4318c428ba..69bbd22508c9b 100644 --- a/recipes/exiv2/all/test_package/CMakeLists.txt +++ b/recipes/exiv2/all/test_package/CMakeLists.txt @@ -5,3 +5,7 @@ find_package(exiv2 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} exiv2lib) + +if(${exiv2_VERSION} VERSION_GREATER_EQUAL "0.28.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() diff --git a/recipes/exiv2/config.yml b/recipes/exiv2/config.yml index 470d3a327a30b..01a5aa663306e 100644 --- a/recipes/exiv2/config.yml +++ b/recipes/exiv2/config.yml @@ -1,4 +1,6 @@ versions: + "0.28.0": + folder: all "0.27.5": folder: all "0.27.4":