diff --git a/recipes/flex/all/test_package/CMakeUserPresets.json b/recipes/flex/all/test_package/CMakeUserPresets.json deleted file mode 100644 index 781f643..0000000 --- a/recipes/flex/all/test_package/CMakeUserPresets.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "version": 4, - "vendor": { - "conan": {} - }, - "include": [ - "build/gcc-12-x86_64-gnu17-release/generators/CMakePresets.json" - ] -} \ No newline at end of file diff --git a/recipes/glib/all/test_package/CMakeUserPresets.json b/recipes/glib/all/test_package/CMakeUserPresets.json deleted file mode 100644 index 6045161..0000000 --- a/recipes/glib/all/test_package/CMakeUserPresets.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "version": 4, - "vendor": { - "conan": {} - }, - "include": [ - "build/gcc-12-x86_64-gnu17-release/generators/CMakePresets.json", - "build/gcc-11.5-x86_64-17-release/generators/CMakePresets.json" - ] -} \ No newline at end of file diff --git a/recipes/harfbuzz/all/test_package/CMakeUserPresets.json b/recipes/harfbuzz/all/test_package/CMakeUserPresets.json deleted file mode 100644 index 6045161..0000000 --- a/recipes/harfbuzz/all/test_package/CMakeUserPresets.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "version": 4, - "vendor": { - "conan": {} - }, - "include": [ - "build/gcc-12-x86_64-gnu17-release/generators/CMakePresets.json", - "build/gcc-11.5-x86_64-17-release/generators/CMakePresets.json" - ] -} \ No newline at end of file diff --git a/recipes/jbig/all/CMakeLists.txt b/recipes/jbig/all/CMakeLists.txt new file mode 100644 index 0000000..d25dfd9 --- /dev/null +++ b/recipes/jbig/all/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.15) +project(jbig LANGUAGES C) + +include(GNUInstallDirs) + +if(MSVC) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) +endif() + +add_library(jbig + ${JBIG_SRC_DIR}/libjbig/jbig.c + ${JBIG_SRC_DIR}/libjbig/jbig_tab.c +) +target_include_directories(jbig PUBLIC ${JBIG_SRC_DIR}/libjbig) +if(MSVC AND BUILD_SHARED_LIBS) + target_compile_definitions(jbig PUBLIC _JBIGDLL_) +endif() + +install(TARGETS jbig + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + +install(FILES ${JBIG_SRC_DIR}/libjbig/jbig.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + +if(BUILD_EXECUTABLES) + add_executable(pbmtojbg ${JBIG_SRC_DIR}/pbmtools/pbmtojbg.c) + target_link_libraries(pbmtojbg PRIVATE jbig) + + add_executable(jbgtopbm ${JBIG_SRC_DIR}/pbmtools/jbgtopbm.c) + target_link_libraries(jbgtopbm PRIVATE jbig) + + install(TARGETS pbmtojbg jbgtopbm DESTINATION ${CMAKE_INSTALL_BINDIR}) +endif() diff --git a/recipes/jbig/all/conandata.yml b/recipes/jbig/all/conandata.yml new file mode 100644 index 0000000..53a4330 --- /dev/null +++ b/recipes/jbig/all/conandata.yml @@ -0,0 +1,8 @@ +sources: + "20160605": + sha256: "2669b49ee000150af7709b21c7656f1f6cbea09fd33116c40b41310adeb2b73e" + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/ImageMagick/jbig/archive/5d8f5f6fa71766ced5e828bf7bfff642ddb8a6ad.zip" +patches: + "20160605": + - patch_file: patches/0001-add-missing-export.patch + - patch_file: patches/0002-fix-msvc-export.patch diff --git a/recipes/jbig/all/conanfile.py b/recipes/jbig/all/conanfile.py new file mode 100644 index 0000000..7e4815f --- /dev/null +++ b/recipes/jbig/all/conanfile.py @@ -0,0 +1,74 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.microsoft import is_msvc +import os + +required_conan_version = ">=1.53.0" + + +class JBigConan(ConanFile): + name = "jbig" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ImageMagick/jbig" + description = "jbig for the Windows build of ImageMagick" + topics = ("jbig", "imagemagick", "window", "graphic") + license = "GPL-2.0" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "build_executables": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "build_executables": True, + } + + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + 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") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["JBIG_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["BUILD_EXECUTABLES"] = self.options.build_executables + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.build() + + def package(self): + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["jbig"] + if self.options.shared and is_msvc(self): + self.cpp_info.defines = ["_JBIGDLL_"] + + # TODO: to remove in conan v2 + if self.options.build_executables: + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/jbig/all/patches/0001-add-missing-export.patch b/recipes/jbig/all/patches/0001-add-missing-export.patch new file mode 100644 index 0000000..2f7ab98 --- /dev/null +++ b/recipes/jbig/all/patches/0001-add-missing-export.patch @@ -0,0 +1,9 @@ +--- a/libjbig/jbig.h ++++ b/libjbig/jbig.h +@@ -307,5 +309,6 @@ + const unsigned char *src, unsigned char **dest, + int use_graycode); + extern JBIGEXPORT int jbg_newlen(unsigned char *bie, size_t len); ++extern JBIGEXPORT unsigned char *jbg_next_pscdms(unsigned char *p, size_t len); + + #endif /* JBG_H */ diff --git a/recipes/jbig/all/patches/0002-fix-msvc-export.patch b/recipes/jbig/all/patches/0002-fix-msvc-export.patch new file mode 100644 index 0000000..1e68297 --- /dev/null +++ b/recipes/jbig/all/patches/0002-fix-msvc-export.patch @@ -0,0 +1,41 @@ +diff --git a/libjbig/jbig.h b/libjbig/jbig.h +index 214105a..a4f7781 100644 +--- a/libjbig/jbig.h ++++ b/libjbig/jbig.h +@@ -246,24 +246,26 @@ struct jbg_dec_state { + * Under VISUALC we have single threaded static libraries, or + * multi-threaded DLLs using the multithreaded runtime DLLs. + **/ +- +-#if defined(_MT) && defined(_DLL) && !defined(_JBIGDLL_) && !defined(_LIB) +-# define _JBIGDLL_ ++ ++#if defined(_MSC_VER) ++# if defined(jbig_EXPORTS) ++# define SHARED_EXPORT_PREFIX __declspec(dllexport) ++# else ++# define SHARED_EXPORT_PREFIX __declspec(dllimport) ++# endif ++#else ++# define SHARED_EXPORT_PREFIX + #endif + #if defined(_JBIGDLL_) +-# if defined(_VISUALC_) ++# if defined(_MSC_VER) + # pragma warning( disable : 4273 ) + # endif +-# if !defined(_JBIGLIB_) +-# define JBIGEXPORT __declspec(dllimport) +-# else +-# define JBIGEXPORT __declspec(dllexport) +-# endif ++# define JBIGEXPORT SHARED_EXPORT_PREFIX + #else + # define JBIGEXPORT + #endif + +-#if defined(_VISUALC_) ++#if defined(_MSC_VER) + # pragma warning( disable : 4018 ) + # pragma warning( disable : 4244 ) + # pragma warning( disable : 4142 ) diff --git a/recipes/jbig/all/test_package/CMakeLists.txt b/recipes/jbig/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..df5582d --- /dev/null +++ b/recipes/jbig/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(jbig REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE jbig::jbig) diff --git a/recipes/jbig/all/test_package/conanfile.py b/recipes/jbig/all/test_package/conanfile.py new file mode 100644 index 0000000..0a6bc68 --- /dev/null +++ b/recipes/jbig/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/jbig/all/test_package/test_package.c b/recipes/jbig/all/test_package/test_package.c new file mode 100644 index 0000000..7126bee --- /dev/null +++ b/recipes/jbig/all/test_package/test_package.c @@ -0,0 +1,13 @@ +#include + +#include "jbig.h" + +int main() { + struct jbg_dec_state state; + + jbg_dec_init(&state); + jbg_dec_getplanes(&state); + jbg_dec_free(&state); + + return EXIT_SUCCESS; +} diff --git a/recipes/jbig/config.yml b/recipes/jbig/config.yml new file mode 100644 index 0000000..431c8d4 --- /dev/null +++ b/recipes/jbig/config.yml @@ -0,0 +1,3 @@ +versions: + "20160605": + folder: all diff --git a/recipes/libdeflate/all/conandata.yml b/recipes/libdeflate/all/conandata.yml new file mode 100644 index 0000000..8b5a58d --- /dev/null +++ b/recipes/libdeflate/all/conandata.yml @@ -0,0 +1,22 @@ +sources: + "1.22": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/ebiggers/libdeflate/archive/refs/tags/v1.22.tar.gz" + sha256: "7f343c7bf2ba46e774d8a632bf073235e1fd27723ef0a12a90f8947b7fe851d6" + "1.21": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/ebiggers/libdeflate/archive/refs/tags/v1.21.tar.gz" + sha256: "50827d312c0413fbd41b0628590cd54d9ad7ebf88360cba7c0e70027942dbd01" + "1.20": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/ebiggers/libdeflate/archive/refs/tags/v1.20.tar.gz" + sha256: "ed1454166ced78913ff3809870a4005b7170a6fd30767dc478a09b96847b9c2a" + "1.19": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/ebiggers/libdeflate/archive/refs/tags/v1.19.tar.gz" + sha256: "27bf62d71cd64728ff43a9feb92f2ac2f2bf748986d856133cc1e51992428c25" + "1.18": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/ebiggers/libdeflate/archive/refs/tags/v1.18.tar.gz" + sha256: "225d982bcaf553221c76726358d2ea139bb34913180b20823c782cede060affd" + "1.17": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/ebiggers/libdeflate/archive/refs/tags/v1.17.tar.gz" + sha256: "fa4615af671513fa2a53dc2e7a89ff502792e2bdfc046869ef35160fcc373763" + "1.15": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/ebiggers/libdeflate/archive/refs/tags/v1.15.tar.gz" + sha256: "58b95040df7383dc0413defb700d9893c194732474283cc4c8f144b00a68154b" diff --git a/recipes/libdeflate/all/conanfile.py b/recipes/libdeflate/all/conanfile.py new file mode 100644 index 0000000..b72d35d --- /dev/null +++ b/recipes/libdeflate/all/conanfile.py @@ -0,0 +1,78 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import collect_libs, copy, get, rmdir +import os + +required_conan_version = ">=1.53.0" + + +class LibdeflateConan(ConanFile): + name = "libdeflate" + description = "Heavily optimized library for DEFLATE/zlib/gzip compression and decompression." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ebiggers/libdeflate" + topics = ("compression", "decompression", "deflate", "zlib", "gzip") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + 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") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBDEFLATE_BUILD_STATIC_LIB"] = not self.options.shared + tc.variables["LIBDEFLATE_BUILD_SHARED_LIB"] = self.options.shared + tc.variables["LIBDEFLATE_BUILD_GZIP"] = False + tc.variables["LIBDEFLATE_BUILD_TESTS"] = False + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "COPYING", self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "libdeflate") + target_suffix = "_shared" if self.options.shared else "_static" + self.cpp_info.set_property("cmake_target_name", f"libdeflate::libdeflate{target_suffix}") + self.cpp_info.set_property("cmake_target_aliases", ["libdeflate::libdeflate"]) # not official, avoid to break users + self.cpp_info.set_property("pkg_config_name", "libdeflate") + # TODO: back to global scope in conan v2 + self.cpp_info.components["_libdeflate"].libs = collect_libs(self) + if self.settings.os == "Windows" and self.options.shared: + self.cpp_info.components["_libdeflate"].defines.append("LIBDEFLATE_DLL") + + # TODO: to remove in conan v2 + self.cpp_info.components["_libdeflate"].names["cmake_find_package"] = f"libdeflate{target_suffix}" + self.cpp_info.components["_libdeflate"].names["cmake_find_package_multi"] = f"libdeflate{target_suffix}" + self.cpp_info.components["_libdeflate"].set_property("cmake_target_name", f"libdeflate::libdeflate{target_suffix}") + self.cpp_info.components["_libdeflate"].set_property("pkg_config_name", "libdeflate") diff --git a/recipes/libdeflate/all/test_package/CMakeLists.txt b/recipes/libdeflate/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..ba0dfeb --- /dev/null +++ b/recipes/libdeflate/all/test_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(libdeflate REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +if(TARGET libdeflate::libdeflate_static) + target_link_libraries(${PROJECT_NAME} PRIVATE libdeflate::libdeflate_static) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE libdeflate::libdeflate_shared) +endif() diff --git a/recipes/libdeflate/all/test_package/conanfile.py b/recipes/libdeflate/all/test_package/conanfile.py new file mode 100644 index 0000000..e845ae7 --- /dev/null +++ b/recipes/libdeflate/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libdeflate/all/test_package/test_package.c b/recipes/libdeflate/all/test_package/test_package.c new file mode 100644 index 0000000..9fe99b8 --- /dev/null +++ b/recipes/libdeflate/all/test_package/test_package.c @@ -0,0 +1,8 @@ +#include + +int main () { + struct libdeflate_compressor *c; + c = libdeflate_alloc_compressor(12); + libdeflate_free_compressor(c); + return 0; +} diff --git a/recipes/libdeflate/config.yml b/recipes/libdeflate/config.yml new file mode 100644 index 0000000..e0c8d8a --- /dev/null +++ b/recipes/libdeflate/config.yml @@ -0,0 +1,27 @@ +versions: + "1.22": + folder: "all" + "1.21": + folder: "all" + "1.20": + folder: "all" + "1.19": + folder: "all" + "1.18": + folder: "all" + "1.17": + folder: "all" + "1.15": + folder: "all" + "1.14": + folder: "pre_1.15" + "1.12": + folder: "pre_1.15" + "1.10": + folder: "pre_1.15" + "1.9": + folder: "pre_1.15" + "1.8": + folder: "pre_1.15" + "1.7": + folder: "pre_1.15" diff --git a/recipes/libdeflate/pre_1.15/conandata.yml b/recipes/libdeflate/pre_1.15/conandata.yml new file mode 100644 index 0000000..a438f62 --- /dev/null +++ b/recipes/libdeflate/pre_1.15/conandata.yml @@ -0,0 +1,44 @@ +sources: + "1.14": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.14.tar.gz" + sha256: "89e7df898c37c3427b0f39aadcf733731321a278771d20fc553f92da8d4808ac" + "1.12": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.12.tar.gz" + sha256: "ba89fb167a5ab6bbdfa6ee3b1a71636e8140fa8471cce8a311697584948e4d06" + "1.10": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.10.tar.gz" + sha256: "5c1f75c285cd87202226f4de49985dcb75732f527eefba2b3ddd70a8865f2533" + "1.9": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.9.tar.gz" + sha256: "a537ab6125c226b874c02b166488b326aece954930260dbf682d88fc339137e3" + "1.8": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.8.tar.gz" + sha256: "50711ad4e9d3862f8dfb11b97eb53631a86ee3ce49c0e68ec2b6d059a9662f61" + "1.7": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.7.tar.gz" + sha256: "a5e6a0a9ab69f40f0f59332106532ca76918977a974e7004977a9498e3f11350" +patches: + "1.14": + - patch_file: "patches/1.14-0001-fix-makefiles.patch" + patch_description: "disable optimization and apply compiler settings on conan recipe" + patch_type: "conan" + "1.12": + - patch_file: "patches/1.12-0001-fix-makefiles.patch" + patch_description: "disable optimization and apply compiler settings on conan recipe" + patch_type: "conan" + "1.10": + - patch_file: "patches/1.9-0001-fix-makefiles.patch" + patch_description: "disable optimization and apply compiler settings on conan recipe" + patch_type: "conan" + "1.9": + - patch_file: "patches/1.9-0001-fix-makefiles.patch" + patch_description: "disable optimization and apply compiler settings on conan recipe" + patch_type: "conan" + "1.8": + - patch_file: "patches/1.7-0001-fix-makefiles.patch" + patch_description: "disable optimization and apply compiler settings on conan recipe" + patch_type: "conan" + "1.7": + - patch_file: "patches/1.7-0001-fix-makefiles.patch" + patch_description: "disable optimization and apply compiler settings on conan recipe" + patch_type: "conan" diff --git a/recipes/libdeflate/pre_1.15/conanfile.py b/recipes/libdeflate/pre_1.15/conanfile.py new file mode 100644 index 0000000..02ec8db --- /dev/null +++ b/recipes/libdeflate/pre_1.15/conanfile.py @@ -0,0 +1,120 @@ +from conan import ConanFile +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path, NMakeToolchain +import os + +required_conan_version = ">=1.55.0" + + +class LibdeflateConan(ConanFile): + name = "libdeflate" + description = "Heavily optimized library for DEFLATE/zlib/gzip compression and decompression." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ebiggers/libdeflate" + topics = ("compression", "decompression", "deflate", "zlib", "gzip") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _is_clangcl(self): + return self.settings.compiler == "clang" and self.settings.os == "Windows" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") + + def build_requirements(self): + if self._settings_build.os == "Windows" and not (is_msvc(self) or self._is_clangcl): + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if is_msvc(self) or self._is_clangcl: + tc = NMakeToolchain(self) + tc.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.generate() + + def _build_nmake(self): + with chdir(self, self.source_folder): + target = "libdeflate.dll" if self.options.shared else "libdeflatestatic.lib" + self.run(f"nmake /f Makefile.msc {target}") + + def _build_make(self): + autotools = Autotools(self) + with chdir(self, self.source_folder): + autotools.make() + + def build(self): + apply_conandata_patches(self) + if is_msvc(self) or self._is_clangcl: + self._build_nmake() + else: + self._build_make() + + def _package_windows(self): + copy(self, "libdeflate.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder) + if self.options.shared: + copy(self, "*deflate.lib", dst=os.path.join(self.package_folder, "lib"), src=self.source_folder) + copy(self, "*deflate.dll", dst=os.path.join(self.package_folder, "bin"), src=self.source_folder) + else: + copy(self, "*deflatestatic.lib", dst=os.path.join(self.package_folder, "lib"), src=self.source_folder) + + def _package_make(self): + autotools = Autotools(self) + with chdir(self, self.source_folder): + # Note: not actually an autotools project, is a Makefile project. + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}", "PREFIX=/"]) + rmdir(self, os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.a" if self.options.shared else "*.[so|dylib]*", os.path.join(self.package_folder, "lib") ) + + def package(self): + copy(self, "COPYING", self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if self.settings.os == "Windows": + self._package_windows() + else: + self._package_make() + + def package_info(self): + self.cpp_info.set_property("pkg_config_name", "libdeflate") + prefix = "lib" if self.settings.os == "Windows" else "" + suffix = "static" if self.settings.os == "Windows" and not self.options.shared else "" + self.cpp_info.libs = [f"{prefix}deflate{suffix}"] + if self.settings.os == "Windows" and self.options.shared: + self.cpp_info.defines = ["LIBDEFLATE_DLL"] diff --git a/recipes/libdeflate/pre_1.15/patches/1.12-0001-fix-makefiles.patch b/recipes/libdeflate/pre_1.15/patches/1.12-0001-fix-makefiles.patch new file mode 100644 index 0000000..fec8388 --- /dev/null +++ b/recipes/libdeflate/pre_1.15/patches/1.12-0001-fix-makefiles.patch @@ -0,0 +1,40 @@ +diff --git a/Makefile b/Makefile +index 9e55d0c..917b6db 100644 +--- a/Makefile ++++ b/Makefile +@@ -54,7 +54,7 @@ cc-option = $(shell if $(CC) $(1) -c -x c /dev/null -o /dev/null \ + 1>&2 2>/dev/null; then echo $(1); fi) + + override CFLAGS := \ +- -O2 -fomit-frame-pointer -std=c99 -I. -Wall -Wundef \ ++ -fomit-frame-pointer -std=c99 -I. -Wall -Wundef \ + $(call cc-option,-Wpedantic) \ + $(call cc-option,-Wdeclaration-after-statement) \ + $(call cc-option,-Wmissing-prototypes) \ +@@ -124,7 +124,7 @@ else ifneq ($(findstring -darwin,$(TARGET_MACHINE)),) + SHARED_LIB := libdeflate.$(SOVERSION).dylib + SHARED_LIB_SYMLINK := libdeflate.dylib + SHARED_LIB_CFLAGS := -fPIC +- SHARED_LIB_LDFLAGS := -install_name $(LIBDIR)/$(SHARED_LIB) ++ SHARED_LIB_LDFLAGS := -install_name @rpath/$(SHARED_LIB) + + # Compiling for Android? + else ifneq ($(findstring -android,$(TARGET_MACHINE)),) +diff --git a/Makefile.msc b/Makefile.msc +index 1449618..a61c034 100644 +--- a/Makefile.msc ++++ b/Makefile.msc +@@ -7,11 +7,10 @@ + + .SUFFIXES: .c .obj .dllobj + +-CC = cl ++CC = $(CC) + LD = link + AR = lib +-CFLAGS = /MD /O2 -I. +-LDFLAGS = ++CFLAGS = /nologo $(CFLAGS) -I. + + STATIC_LIB = libdeflatestatic.lib + SHARED_LIB = libdeflate.dll diff --git a/recipes/libdeflate/pre_1.15/patches/1.14-0001-fix-makefiles.patch b/recipes/libdeflate/pre_1.15/patches/1.14-0001-fix-makefiles.patch new file mode 100644 index 0000000..6f26567 --- /dev/null +++ b/recipes/libdeflate/pre_1.15/patches/1.14-0001-fix-makefiles.patch @@ -0,0 +1,40 @@ +diff --git a/Makefile b/Makefile +index a08c945..36876b5 100644 +--- a/Makefile ++++ b/Makefile +@@ -54,7 +54,7 @@ cc-option = $(shell if $(CC) $(1) -c -x c /dev/null -o /dev/null \ + 1>&2 2>/dev/null; then echo $(1); fi) + + override CFLAGS := \ +- -O2 -fomit-frame-pointer -std=c99 -I. -Wall -Wundef \ ++ -fomit-frame-pointer -std=c99 -I. -Wall -Wundef \ + $(call cc-option,-Wdeclaration-after-statement) \ + $(call cc-option,-Wimplicit-fallthrough) \ + $(call cc-option,-Wmissing-prototypes) \ +@@ -120,7 +120,7 @@ else ifneq ($(findstring -darwin,$(TARGET_MACHINE)),) + SHARED_LIB := libdeflate.$(SOVERSION).dylib + SHARED_LIB_SYMLINK := libdeflate.dylib + SHARED_LIB_CFLAGS := -fPIC +- SHARED_LIB_LDFLAGS := -install_name $(LIBDIR)/$(SHARED_LIB) ++ SHARED_LIB_LDFLAGS := -install_name @rpath/$(SHARED_LIB) + + # Compiling for Android? + else ifneq ($(findstring -android,$(TARGET_MACHINE)),) +diff --git a/Makefile.msc b/Makefile.msc +index 1449618..a61c034 100644 +--- a/Makefile.msc ++++ b/Makefile.msc +@@ -7,11 +7,10 @@ + + .SUFFIXES: .c .obj .dllobj + +-CC = cl ++CC = $(CC) + LD = link + AR = lib +-CFLAGS = /MD /O2 -I. +-LDFLAGS = ++CFLAGS = /nologo $(CFLAGS) -I. + + STATIC_LIB = libdeflatestatic.lib + SHARED_LIB = libdeflate.dll diff --git a/recipes/libdeflate/pre_1.15/patches/1.7-0001-fix-makefiles.patch b/recipes/libdeflate/pre_1.15/patches/1.7-0001-fix-makefiles.patch new file mode 100644 index 0000000..b5b9679 --- /dev/null +++ b/recipes/libdeflate/pre_1.15/patches/1.7-0001-fix-makefiles.patch @@ -0,0 +1,40 @@ +diff --git a/Makefile b/Makefile +index 276d75d..641e726 100644 +--- a/Makefile ++++ b/Makefile +@@ -48,7 +48,7 @@ cc-option = $(shell if $(CC) $(1) -c -x c /dev/null -o /dev/null \ + 1>&2 2>/dev/null; then echo $(1); fi) + + override CFLAGS := \ +- -O2 -fomit-frame-pointer -std=c99 -I. -Wall -Wundef \ ++ -fomit-frame-pointer -std=c99 -I. -Wall -Wundef \ + $(call cc-option,-Wpedantic) \ + $(call cc-option,-Wdeclaration-after-statement) \ + $(call cc-option,-Wmissing-prototypes) \ +@@ -111,7 +111,7 @@ else ifeq ($(shell uname),Darwin) + SHARED_LIB := libdeflate.$(SOVERSION).dylib + SHARED_LIB_SYMLINK := libdeflate.dylib + SHARED_LIB_CFLAGS := -fPIC +- SHARED_LIB_LDFLAGS := -install_name $(SHARED_LIB) ++ SHARED_LIB_LDFLAGS := -install_name @rpath/$(SHARED_LIB) + + # Linux, FreeBSD, etc. + else +diff --git a/Makefile.msc b/Makefile.msc +index 1449618..a61c034 100644 +--- a/Makefile.msc ++++ b/Makefile.msc +@@ -7,11 +7,10 @@ + + .SUFFIXES: .c .obj .dllobj + +-CC = cl ++CC = $(CC) + LD = link + AR = lib +-CFLAGS = /MD /O2 -I. +-LDFLAGS = ++CFLAGS = /nologo $(CFLAGS) -I. + + STATIC_LIB = libdeflatestatic.lib + SHARED_LIB = libdeflate.dll diff --git a/recipes/libdeflate/pre_1.15/patches/1.9-0001-fix-makefiles.patch b/recipes/libdeflate/pre_1.15/patches/1.9-0001-fix-makefiles.patch new file mode 100644 index 0000000..295b117 --- /dev/null +++ b/recipes/libdeflate/pre_1.15/patches/1.9-0001-fix-makefiles.patch @@ -0,0 +1,40 @@ +diff --git a/Makefile b/Makefile +index 0e8b008..d184a4a 100644 +--- a/Makefile ++++ b/Makefile +@@ -54,7 +54,7 @@ cc-option = $(shell if $(CC) $(1) -c -x c /dev/null -o /dev/null \ + 1>&2 2>/dev/null; then echo $(1); fi) + + override CFLAGS := \ +- -O2 -fomit-frame-pointer -std=c99 -I. -Wall -Wundef \ ++ -fomit-frame-pointer -std=c99 -I. -Wall -Wundef \ + $(call cc-option,-Wpedantic) \ + $(call cc-option,-Wdeclaration-after-statement) \ + $(call cc-option,-Wmissing-prototypes) \ +@@ -119,7 +119,7 @@ else ifneq ($(findstring -darwin,$(TARGET_MACHINE)),) + SHARED_LIB := libdeflate.$(SOVERSION).dylib + SHARED_LIB_SYMLINK := libdeflate.dylib + SHARED_LIB_CFLAGS := -fPIC +- SHARED_LIB_LDFLAGS := -install_name $(SHARED_LIB) ++ SHARED_LIB_LDFLAGS := -install_name @rpath/$(SHARED_LIB) + + # Compiling for Android? + else ifneq ($(findstring -android,$(TARGET_MACHINE)),) +diff --git a/Makefile.msc b/Makefile.msc +index 1449618..a61c034 100644 +--- a/Makefile.msc ++++ b/Makefile.msc +@@ -7,11 +7,10 @@ + + .SUFFIXES: .c .obj .dllobj + +-CC = cl ++CC = $(CC) + LD = link + AR = lib +-CFLAGS = /MD /O2 -I. +-LDFLAGS = ++CFLAGS = /nologo $(CFLAGS) -I. + + STATIC_LIB = libdeflatestatic.lib + SHARED_LIB = libdeflate.dll diff --git a/recipes/libdeflate/pre_1.15/test_package/CMakeLists.txt b/recipes/libdeflate/pre_1.15/test_package/CMakeLists.txt new file mode 100644 index 0000000..4fdc2b4 --- /dev/null +++ b/recipes/libdeflate/pre_1.15/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +find_package(libdeflate REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libdeflate::libdeflate) diff --git a/recipes/libdeflate/pre_1.15/test_package/conanfile.py b/recipes/libdeflate/pre_1.15/test_package/conanfile.py new file mode 100644 index 0000000..e845ae7 --- /dev/null +++ b/recipes/libdeflate/pre_1.15/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libdeflate/pre_1.15/test_package/test_package.c b/recipes/libdeflate/pre_1.15/test_package/test_package.c new file mode 100644 index 0000000..9fe99b8 --- /dev/null +++ b/recipes/libdeflate/pre_1.15/test_package/test_package.c @@ -0,0 +1,8 @@ +#include + +int main () { + struct libdeflate_compressor *c; + c = libdeflate_alloc_compressor(12); + libdeflate_free_compressor(c); + return 0; +} diff --git a/recipes/libelf/all/test_package/CMakeUserPresets.json b/recipes/libelf/all/test_package/CMakeUserPresets.json deleted file mode 100644 index 6045161..0000000 --- a/recipes/libelf/all/test_package/CMakeUserPresets.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "version": 4, - "vendor": { - "conan": {} - }, - "include": [ - "build/gcc-12-x86_64-gnu17-release/generators/CMakePresets.json", - "build/gcc-11.5-x86_64-17-release/generators/CMakePresets.json" - ] -} \ No newline at end of file diff --git a/recipes/libffi/all/test_package/CMakeUserPresets.json b/recipes/libffi/all/test_package/CMakeUserPresets.json deleted file mode 100644 index 6045161..0000000 --- a/recipes/libffi/all/test_package/CMakeUserPresets.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "version": 4, - "vendor": { - "conan": {} - }, - "include": [ - "build/gcc-12-x86_64-gnu17-release/generators/CMakePresets.json", - "build/gcc-11.5-x86_64-17-release/generators/CMakePresets.json" - ] -} \ No newline at end of file diff --git a/recipes/libgettext/all/test_package/CMakeUserPresets.json b/recipes/libgettext/all/test_package/CMakeUserPresets.json deleted file mode 100644 index 61fc9e2..0000000 --- a/recipes/libgettext/all/test_package/CMakeUserPresets.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "version": 4, - "vendor": { - "conan": {} - }, - "include": [ - "build/gcc-11.5-x86_64-17-release/generators/CMakePresets.json" - ] -} \ No newline at end of file diff --git a/recipes/libmount/all/test_package/CMakeUserPresets.json b/recipes/libmount/all/test_package/CMakeUserPresets.json deleted file mode 100644 index 781f643..0000000 --- a/recipes/libmount/all/test_package/CMakeUserPresets.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "version": 4, - "vendor": { - "conan": {} - }, - "include": [ - "build/gcc-12-x86_64-gnu17-release/generators/CMakePresets.json" - ] -} \ No newline at end of file diff --git a/recipes/libselinux/all/test_package/CMakeUserPresets.json b/recipes/libselinux/all/test_package/CMakeUserPresets.json deleted file mode 100644 index 781f643..0000000 --- a/recipes/libselinux/all/test_package/CMakeUserPresets.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "version": 4, - "vendor": { - "conan": {} - }, - "include": [ - "build/gcc-12-x86_64-gnu17-release/generators/CMakePresets.json" - ] -} \ No newline at end of file diff --git a/recipes/libtiff/all/conandata.yml b/recipes/libtiff/all/conandata.yml new file mode 100644 index 0000000..6f4b154 --- /dev/null +++ b/recipes/libtiff/all/conandata.yml @@ -0,0 +1,44 @@ +sources: + "4.7.0": + url: "https://nexus.avroid.tech/repository/all-raw-proxy-download_osgeo_org/libtiff/tiff-4.7.0.tar.xz" + sha256: "273a0a73b1f0bed640afee4a5df0337357ced5b53d3d5d1c405b936501f71017" + "4.6.0": + url: "https://nexus.avroid.tech/repository/all-raw-proxy-download_osgeo_org/libtiff/tiff-4.6.0.tar.gz" + sha256: "88b3979e6d5c7e32b50d7ec72fb15af724f6ab2cbf7e10880c360a77e4b5d99a" + "4.5.1": + url: "https://nexus.avroid.tech/repository/all-raw-proxy-download_osgeo_org/libtiff/tiff-4.5.1.tar.gz" + sha256: "d7f38b6788e4a8f5da7940c5ac9424f494d8a79eba53d555f4a507167dca5e2b" + "4.5.0": + url: "https://nexus.avroid.tech/repository/all-raw-proxy-download_osgeo_org/libtiff/tiff-4.5.0.tar.gz" + sha256: "c7a1d9296649233979fa3eacffef3fa024d73d05d589cb622727b5b08c423464" + "4.4.0": + url: "https://nexus.avroid.tech/repository/all-raw-proxy-download_osgeo_org/libtiff/tiff-4.4.0.tar.gz" + sha256: "917223b37538959aca3b790d2d73aa6e626b688e02dcda272aec24c2f498abed" + "4.3.0": + url: "https://nexus.avroid.tech/repository/all-raw-proxy-download_osgeo_org/libtiff/tiff-4.3.0.tar.gz" + sha256: "0e46e5acb087ce7d1ac53cf4f56a09b221537fc86dfc5daaad1c2e89e1b37ac8" +patches: + "4.7.0": + - patch_file: "patches/4.5.1-0001-cmake-dependencies.patch" + patch_description: "CMake: robust handling of dependencies" + patch_type: "conan" + "4.6.0": + - patch_file: "patches/4.5.1-0001-cmake-dependencies.patch" + patch_description: "CMake: robust handling of dependencies" + patch_type: "conan" + "4.5.1": + - patch_file: "patches/4.5.1-0001-cmake-dependencies.patch" + patch_description: "CMake: robust handling of dependencies" + patch_type: "conan" + "4.5.0": + - patch_file: "patches/4.5.0-0001-cmake-dependencies.patch" + patch_description: "CMake: robust handling of dependencies" + patch_type: "conan" + "4.4.0": + - patch_file: "patches/4.4.0-0001-cmake-dependencies.patch" + patch_description: "CMake: robust handling of dependencies" + patch_type: "conan" + "4.3.0": + - patch_file: "patches/4.3.0-0001-cmake-dependencies.patch" + patch_description: "CMake: robust handling of dependencies" + patch_type: "conan" diff --git a/recipes/libtiff/all/conanfile.py b/recipes/libtiff/all/conanfile.py new file mode 100644 index 0000000..04e34ef --- /dev/null +++ b/recipes/libtiff/all/conanfile.py @@ -0,0 +1,192 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + + +class LibtiffConan(ConanFile): + name = "libtiff" + description = "Library for Tag Image File Format (TIFF)" + url = "https://github.com/conan-io/conan-center-index" + license = "libtiff" + homepage = "http://www.simplesystems.org/libtiff" + topics = ("tiff", "image", "bigtiff", "tagged-image-file-format") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "lzma": [True, False], + "jpeg": [False, "libjpeg", "libjpeg-turbo", "mozjpeg"], + "zlib": [True, False], + "libdeflate": [True, False], + "zstd": [True, False], + "jbig": [True, False], + "webp": [True, False], + "cxx": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "lzma": True, + "jpeg": "libjpeg", + "zlib": True, + "libdeflate": True, + "zstd": True, + "jbig": True, + "webp": True, + "cxx": True, + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + if not self.options.cxx: + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.options.zlib: + self.requires("zlib/[>=1.2.11 <2]") + if self.options.libdeflate: + self.requires("libdeflate/1.19") + if self.options.lzma: + self.requires("xz_utils/[>=5.4.5 <6]") + if self.options.jpeg == "libjpeg": + self.requires("libjpeg/9e") + elif self.options.jpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/[>=3.0.2]") + elif self.options.jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.5") + if self.options.jbig: + self.requires("jbig/20160605") + if self.options.zstd: + self.requires("zstd/[>=1.5.5]") + if self.options.webp: + self.requires("libwebp/1.3.2") + + def validate(self): + if self.options.libdeflate and not self.options.zlib: + raise ConanInvalidConfiguration("libtiff:libdeflate=True requires libtiff:zlib=True") + +# def build_requirements(self): +# if Version(self.version) >= "4.5.1": +# # https://github.com/conan-io/conan/issues/3482#issuecomment-662284561 +# self.tool_requires("cmake/[>=3.18 <4]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["lzma"] = self.options.lzma + tc.variables["jpeg"] = bool(self.options.jpeg) + tc.variables["jpeg12"] = False + tc.variables["jbig"] = self.options.jbig + tc.variables["zlib"] = self.options.zlib + tc.variables["libdeflate"] = self.options.libdeflate + tc.variables["zstd"] = self.options.zstd + tc.variables["webp"] = self.options.webp + tc.variables["lerc"] = False # TODO: add lerc support for libtiff versions >= 4.3.0 + if Version(self.version) >= "4.5.0": + # Disable tools, test, contrib, man & html generation + tc.variables["tiff-tools"] = False + tc.variables["tiff-tests"] = False + tc.variables["tiff-contrib"] = False + tc.variables["tiff-docs"] = False + tc.variables["cxx"] = self.options.cxx + # BUILD_SHARED_LIBS must be set in command line because defined upstream before project() + tc.cache_variables["BUILD_SHARED_LIBS"] = bool(self.options.shared) + tc.cache_variables["CMAKE_FIND_PACKAGE_PREFER_CONFIG"] = True + tc.generate() + deps = CMakeDeps(self) + if Version(self.version) >= "4.5.1": + deps.set_property("jbig", "cmake_target_name", "JBIG::JBIG") + 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.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + + # remove FindXXXX for conan dependencies + for module in ["Deflate", "JBIG", "JPEG", "LERC", "WebP", "ZSTD", "liblzma", "LibLZMA"]: + rm(self, f"Find{module}.cmake", os.path.join(self.source_folder, "cmake")) + + # Export symbols of tiffxx for msvc shared + replace_in_file(self, os.path.join(self.source_folder, "libtiff", "CMakeLists.txt"), + "set_target_properties(tiffxx PROPERTIES SOVERSION ${SO_COMPATVERSION})", + "set_target_properties(tiffxx PROPERTIES SOVERSION ${SO_COMPATVERSION} WINDOWS_EXPORT_ALL_SYMBOLS ON)") + + # Disable tools, test, contrib, man & html generation + if Version(self.version) < "4.5.0": + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "add_subdirectory(tools)\nadd_subdirectory(test)\nadd_subdirectory(contrib)\nadd_subdirectory(build)\n" + "add_subdirectory(man)\nadd_subdirectory(html)", "") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + license_file = "COPYRIGHT" if Version(self.version) < "4.5.0" else "LICENSE.md" + copy(self, license_file, src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"), ignore_case=True, keep_path=False) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + + def package_info(self): + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_file_name", "TIFF") + self.cpp_info.set_property("cmake_target_name", "TIFF::TIFF") + self.cpp_info.set_property("pkg_config_name", f"libtiff-{Version(self.version).major}") + suffix = "d" if is_msvc(self) and self.settings.build_type == "Debug" else "" + if self.options.cxx: + self.cpp_info.libs.append(f"tiffxx{suffix}") + self.cpp_info.libs.append(f"tiff{suffix}") + if self.settings.os in ["Linux", "Android", "FreeBSD", "SunOS", "AIX"]: + self.cpp_info.system_libs.append("m") + + self.cpp_info.requires = [] + if self.options.zlib: + self.cpp_info.requires.append("zlib::zlib") + if self.options.libdeflate: + self.cpp_info.requires.append("libdeflate::libdeflate") + if self.options.lzma: + self.cpp_info.requires.append("xz_utils::xz_utils") + if self.options.jpeg == "libjpeg": + self.cpp_info.requires.append("libjpeg::libjpeg") + elif self.options.jpeg == "libjpeg-turbo": + self.cpp_info.requires.append("libjpeg-turbo::jpeg") + elif self.options.jpeg == "mozjpeg": + self.cpp_info.requires.append("mozjpeg::libjpeg") + if self.options.jbig: + self.cpp_info.requires.append("jbig::jbig") + 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" diff --git a/recipes/libtiff/all/patches/4.3.0-0001-cmake-dependencies.patch b/recipes/libtiff/all/patches/4.3.0-0001-cmake-dependencies.patch new file mode 100644 index 0000000..497c617 --- /dev/null +++ b/recipes/libtiff/all/patches/4.3.0-0001-cmake-dependencies.patch @@ -0,0 +1,91 @@ +--- a/cmake/DeflateCodec.cmake ++++ b/cmake/DeflateCodec.cmake +@@ -35,7 +35,10 @@ set(ZIP_SUPPORT ${ZLIB_SUPPORT}) + + # libdeflate + set(LIBDEFLATE_SUPPORT FALSE) +-find_package(Deflate) ++find_package(libdeflate CONFIG) ++if(libdeflate_FOUND) ++ set(Deflate_FOUND TRUE) ++endif() + option(libdeflate "use libdeflate (optional for faster Deflate support, still requires zlib)" ${Deflate_FOUND}) + if (libdeflate AND Deflate_FOUND AND ZIP_SUPPORT) + set(LIBDEFLATE_SUPPORT TRUE) +--- a/cmake/JBIGCodec.cmake ++++ b/cmake/JBIGCodec.cmake +@@ -27,14 +27,17 @@ + # JBIG-KIT + set(JBIG_SUPPORT FALSE) + +-find_package(JBIG) ++find_package(jbig CONFIG) ++if(jbig_FOUND) ++ set(JBIG_FOUND TRUE) ++endif() + + if(JBIG_FOUND) + set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) + 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() +--- a/cmake/ZSTDCodec.cmake ++++ b/cmake/ZSTDCodec.cmake +@@ -28,14 +28,17 @@ + set(ZSTD_SUPPORT FALSE) + set(ZSTD_USABLE FALSE) + +-find_package(ZSTD) ++find_package(zstd CONFIG) ++if(zstd_FOUND) ++ set(ZSTD_FOUND TRUE) ++endif() + + if(ZSTD_FOUND) + set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${ZSTD_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES}) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${ZSTD_LIBRARIES}) +- check_symbol_exists(ZSTD_decompressStream "zstd.h" ZSTD_RECENT_ENOUGH) ++ set(ZSTD_RECENT_ENOUGH TRUE) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE}) + +--- a/libtiff/CMakeLists.txt ++++ b/libtiff/CMakeLists.txt +@@ -110,7 +110,7 @@ if(ZIP_SUPPORT) + target_link_libraries(tiff PRIVATE ZLIB::ZLIB) + endif() + if(ZIP_SUPPORT AND LIBDEFLATE_SUPPORT) +- target_link_libraries(tiff PRIVATE Deflate::Deflate) ++ target_link_libraries(tiff PRIVATE $,libdeflate::libdeflate,libdeflate::libdeflate_static>) + endif() + if(JPEG_SUPPORT) + target_link_libraries(tiff PRIVATE JPEG::JPEG) +@@ -120,7 +120,7 @@ if(JPEG_SUPPORT) + endif() + endif() + if(JBIG_SUPPORT) +- target_link_libraries(tiff PRIVATE JBIG::JBIG) ++ target_link_libraries(tiff PRIVATE jbig::jbig) + endif() + if(LERC_SUPPORT) + target_link_libraries(tiff PRIVATE LERC::LERC) +@@ -129,10 +129,10 @@ if(LZMA_SUPPORT) + target_link_libraries(tiff PRIVATE LibLZMA::LibLZMA) + endif() + if(ZSTD_SUPPORT) +- target_link_libraries(tiff PRIVATE ZSTD::ZSTD) ++ target_link_libraries(tiff PRIVATE $,zstd::libzstd_shared,zstd::libzstd_static>) + endif() + if(WEBP_SUPPORT) +- target_link_libraries(tiff PRIVATE WebP::WebP) ++ target_link_libraries(tiff PRIVATE WebP::webp) + endif() + target_link_libraries(tiff PRIVATE CMath::CMath) + diff --git a/recipes/libtiff/all/patches/4.4.0-0001-cmake-dependencies.patch b/recipes/libtiff/all/patches/4.4.0-0001-cmake-dependencies.patch new file mode 100644 index 0000000..e2a9148 --- /dev/null +++ b/recipes/libtiff/all/patches/4.4.0-0001-cmake-dependencies.patch @@ -0,0 +1,92 @@ +--- a/cmake/DeflateCodec.cmake ++++ b/cmake/DeflateCodec.cmake +@@ -35,7 +35,10 @@ set(ZIP_SUPPORT ${ZLIB_SUPPORT}) + + # libdeflate + set(LIBDEFLATE_SUPPORT FALSE) +-find_package(Deflate) ++find_package(libdeflate CONFIG) ++if(libdeflate_FOUND) ++ set(Deflate_FOUND TRUE) ++endif() + option(libdeflate "use libdeflate (optional for faster Deflate support, still requires zlib)" ${Deflate_FOUND}) + if (libdeflate AND Deflate_FOUND AND ZIP_SUPPORT) + set(LIBDEFLATE_SUPPORT TRUE) +--- a/cmake/JBIGCodec.cmake ++++ b/cmake/JBIGCodec.cmake +@@ -27,14 +27,17 @@ + # JBIG-KIT + set(JBIG_SUPPORT FALSE) + +-find_package(JBIG) ++find_package(jbig CONFIG) ++if(jbig_FOUND) ++ set(JBIG_FOUND TRUE) ++endif() + + if(JBIG_FOUND) + set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) + 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() +--- a/cmake/ZSTDCodec.cmake ++++ b/cmake/ZSTDCodec.cmake +@@ -28,14 +28,17 @@ + set(ZSTD_SUPPORT FALSE) + set(ZSTD_USABLE FALSE) + +-find_package(ZSTD) ++find_package(zstd CONFIG) ++if(zstd_FOUND) ++ set(ZSTD_FOUND TRUE) ++endif() + + if(ZSTD_FOUND) + set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${ZSTD_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES}) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${ZSTD_LIBRARIES}) +- check_symbol_exists(ZSTD_decompressStream "zstd.h" ZSTD_RECENT_ENOUGH) ++ set(ZSTD_RECENT_ENOUGH TRUE) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE}) + +--- a/libtiff/CMakeLists.txt ++++ b/libtiff/CMakeLists.txt +@@ -114,7 +114,7 @@ if(ZIP_SUPPORT) + string(APPEND tiff_requires_private " zlib") + endif() + if(ZIP_SUPPORT AND LIBDEFLATE_SUPPORT) +- target_link_libraries(tiff PRIVATE Deflate::Deflate) ++ target_link_libraries(tiff PRIVATE $,libdeflate::libdeflate,libdeflate::libdeflate_static>) + list(APPEND tiff_libs_private_list "${Deflate_LIBRARY}") + endif() + if(JPEG_SUPPORT) +@@ -126,7 +126,7 @@ if(JPEG_SUPPORT) + endif() + endif() + if(JBIG_SUPPORT) +- target_link_libraries(tiff PRIVATE JBIG::JBIG) ++ target_link_libraries(tiff PRIVATE jbig::jbig) + list(APPEND tiff_libs_private_list "${JBIG_LIBRARY}") + endif() + if(LERC_SUPPORT) +@@ -141,11 +141,11 @@ if(LZMA_SUPPORT) + string(APPEND tiff_requires_private " liblzma") + endif() + if(ZSTD_SUPPORT) +- target_link_libraries(tiff PRIVATE ZSTD::ZSTD) ++ target_link_libraries(tiff PRIVATE $,zstd::libzstd_shared,zstd::libzstd_static>) + string(APPEND tiff_requires_private " libzstd") + endif() + if(WEBP_SUPPORT) +- target_link_libraries(tiff PRIVATE WebP::WebP) ++ target_link_libraries(tiff PRIVATE WebP::webp) + string(APPEND tiff_requires_private " libwebp") + endif() + target_link_libraries(tiff PRIVATE CMath::CMath) diff --git a/recipes/libtiff/all/patches/4.5.0-0001-cmake-dependencies.patch b/recipes/libtiff/all/patches/4.5.0-0001-cmake-dependencies.patch new file mode 100644 index 0000000..7780017 --- /dev/null +++ b/recipes/libtiff/all/patches/4.5.0-0001-cmake-dependencies.patch @@ -0,0 +1,116 @@ +--- a/cmake/DeflateCodec.cmake ++++ b/cmake/DeflateCodec.cmake +@@ -35,7 +35,10 @@ set(LIBDEFLATE_SUPPORT FALSE) + + # libdeflate + set(LIBDEFLATE_SUPPORT FALSE) +-find_package(Deflate) ++find_package(libdeflate CONFIG) ++if(libdeflate_FOUND) ++ set(Deflate_FOUND TRUE) ++endif() + option(libdeflate "use libdeflate (optional for faster Deflate support, still requires zlib)" ${Deflate_FOUND}) + if (libdeflate AND Deflate_FOUND AND ZIP_SUPPORT) + set(LIBDEFLATE_SUPPORT TRUE) +--- a/cmake/JBIGCodec.cmake ++++ b/cmake/JBIGCodec.cmake +@@ -27,14 +27,17 @@ set(JBIG_SUPPORT FALSE) + # JBIG-KIT + set(JBIG_SUPPORT FALSE) + +-find_package(JBIG) ++find_package(jbig CONFIG) ++if(jbig_FOUND) ++ set(JBIG_FOUND TRUE) ++endif() + + if(JBIG_FOUND) + set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) + 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() +--- a/cmake/JPEGCodec.cmake ++++ b/cmake/JPEGCodec.cmake +@@ -47,19 +47,7 @@ + cmake_push_check_state(RESET) + set(CMAKE_REQUIRED_INCLUDES "${JPEG_INCLUDE_DIRS}") + set(CMAKE_REQUIRED_LIBRARIES "${JPEG_LIBRARIES}") +- check_c_source_compiles( +- " +- #include +- #include +- #include \"jpeglib.h\" +- int main() +- { +- jpeg_read_scanlines(0,0,0); +- jpeg12_read_scanlines(0,0,0); +- return 0; +- } +- " +- HAVE_JPEGTURBO_DUAL_MODE_8_12) ++ set(HAVE_JPEGTURBO_DUAL_MODE_8_12 FALSE) + cmake_pop_check_state() + endif() + +--- a/cmake/ZSTDCodec.cmake ++++ b/cmake/ZSTDCodec.cmake +@@ -28,7 +28,10 @@ set(ZSTD_USABLE FALSE) + set(ZSTD_SUPPORT FALSE) + set(ZSTD_USABLE FALSE) + +-find_package(ZSTD) ++find_package(zstd CONFIG) ++if(zstd_FOUND) ++ set(ZSTD_FOUND TRUE) ++endif() + + if(ZSTD_FOUND) + if(NOT DEFINED ZSTD_HAVE_DECOMPRESS_STREAM) +@@ -36,7 +39,7 @@ if(ZSTD_FOUND) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${ZSTD_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES}) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${ZSTD_LIBRARIES}) +- check_symbol_exists(ZSTD_decompressStream "zstd.h" ZSTD_HAVE_DECOMPRESS_STREAM) ++ set(ZSTD_HAVE_DECOMPRESS_STREAM TRUE) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE}) + endif() +--- a/libtiff/CMakeLists.txt ++++ b/libtiff/CMakeLists.txt +@@ -116,7 +116,7 @@ if(ZIP_SUPPORT AND LIBDEFLATE_SUPPORT) + string(APPEND tiff_requires_private " zlib") + endif() + if(ZIP_SUPPORT AND LIBDEFLATE_SUPPORT) +- target_link_libraries(tiff PRIVATE Deflate::Deflate) ++ target_link_libraries(tiff PRIVATE $,libdeflate::libdeflate,libdeflate::libdeflate_static>) + list(APPEND tiff_libs_private_list "${Deflate_LIBRARY}") + endif() + if(JPEG_SUPPORT) +@@ -130,7 +130,7 @@ if(JBIG_SUPPORT) + endif() + endif() + if(JBIG_SUPPORT) +- target_link_libraries(tiff PRIVATE JBIG::JBIG) ++ target_link_libraries(tiff PRIVATE jbig::jbig) + list(APPEND tiff_libs_private_list "${JBIG_LIBRARY}") + endif() + if(LERC_SUPPORT) +@@ -145,11 +145,11 @@ if(ZSTD_SUPPORT) + string(APPEND tiff_requires_private " liblzma") + endif() + if(ZSTD_SUPPORT) +- target_link_libraries(tiff PRIVATE ZSTD::ZSTD) ++ target_link_libraries(tiff PRIVATE $,zstd::libzstd_shared,zstd::libzstd_static>) + string(APPEND tiff_requires_private " libzstd") + endif() + if(WEBP_SUPPORT) +- target_link_libraries(tiff PRIVATE WebP::WebP) ++ target_link_libraries(tiff PRIVATE WebP::webp) + string(APPEND tiff_requires_private " libwebp") + endif() + if(CMath_LIBRARY) diff --git a/recipes/libtiff/all/patches/4.5.1-0001-cmake-dependencies.patch b/recipes/libtiff/all/patches/4.5.1-0001-cmake-dependencies.patch new file mode 100644 index 0000000..761950e --- /dev/null +++ b/recipes/libtiff/all/patches/4.5.1-0001-cmake-dependencies.patch @@ -0,0 +1,31 @@ +diff --git a/cmake/JPEGCodec.cmake b/cmake/JPEGCodec.cmake +index 8455a3ec..09fe975a 100644 +--- a/cmake/JPEGCodec.cmake ++++ b/cmake/JPEGCodec.cmake +@@ -42,25 +42,7 @@ endif() + if (JPEG_SUPPORT) + # Check for jpeg12_read_scanlines() which has been added in libjpeg-turbo 2.2 + # for dual 8/12 bit mode. +- include(CheckCSourceCompiles) +- include(CMakePushCheckState) +- cmake_push_check_state(RESET) +- set(CMAKE_REQUIRED_INCLUDES "${JPEG_INCLUDE_DIRS}") +- set(CMAKE_REQUIRED_LIBRARIES "${JPEG_LIBRARIES}") +- check_c_source_compiles( +- " +- #include +- #include +- #include \"jpeglib.h\" +- int main() +- { +- jpeg_read_scanlines(0,0,0); +- jpeg12_read_scanlines(0,0,0); +- return 0; +- } +- " +- HAVE_JPEGTURBO_DUAL_MODE_8_12) +- cmake_pop_check_state() ++ set(HAVE_JPEGTURBO_DUAL_MODE_8_12 FALSE) + endif() + + if (NOT HAVE_JPEGTURBO_DUAL_MODE_8_12) diff --git a/recipes/libtiff/all/test_package/CMakeLists.txt b/recipes/libtiff/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..cd389da --- /dev/null +++ b/recipes/libtiff/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(TIFF REQUIRED) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE TIFF::TIFF) diff --git a/recipes/libtiff/all/test_package/conanfile.py b/recipes/libtiff/all/test_package/conanfile.py new file mode 100644 index 0000000..0a6bc68 --- /dev/null +++ b/recipes/libtiff/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libtiff/all/test_package/test_package.c b/recipes/libtiff/all/test_package/test_package.c new file mode 100644 index 0000000..0b73b99 --- /dev/null +++ b/recipes/libtiff/all/test_package/test_package.c @@ -0,0 +1,8 @@ +#include + +int main() +{ + TIFF* tif = TIFFOpen("foo.tif", "w"); + TIFFClose(tif); + return 0; +} diff --git a/recipes/libtiff/all/test_v1_package/CMakeLists.txt b/recipes/libtiff/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000..0d20897 --- /dev/null +++ b/recipes/libtiff/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libtiff/all/test_v1_package/conanfile.py b/recipes/libtiff/all/test_v1_package/conanfile.py new file mode 100644 index 0000000..19e6a0c --- /dev/null +++ b/recipes/libtiff/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libtiff/config.yml b/recipes/libtiff/config.yml new file mode 100644 index 0000000..3209eca --- /dev/null +++ b/recipes/libtiff/config.yml @@ -0,0 +1,13 @@ +versions: + "4.7.0": + folder: all + "4.6.0": + folder: all + "4.5.1": + folder: all + "4.5.0": + folder: all + "4.4.0": + folder: all + "4.3.0": + folder: all diff --git a/recipes/pcre2/all/test_package/CMakeUserPresets.json b/recipes/pcre2/all/test_package/CMakeUserPresets.json deleted file mode 100644 index 6045161..0000000 --- a/recipes/pcre2/all/test_package/CMakeUserPresets.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "version": 4, - "vendor": { - "conan": {} - }, - "include": [ - "build/gcc-12-x86_64-gnu17-release/generators/CMakePresets.json", - "build/gcc-11.5-x86_64-17-release/generators/CMakePresets.json" - ] -} \ No newline at end of file diff --git a/recipes/zstd/all/conandata.yml b/recipes/zstd/all/conandata.yml new file mode 100644 index 0000000..ad90665 --- /dev/null +++ b/recipes/zstd/all/conandata.yml @@ -0,0 +1,40 @@ +sources: + "1.5.6": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/facebook/zstd/releases/download/v1.5.6/zstd-1.5.6.tar.gz" + sha256: "8c29e06cf42aacc1eafc4077ae2ec6c6fcb96a626157e0593d5e82a34fd403c1" + "1.5.5": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/facebook/zstd/releases/download/v1.5.5/zstd-1.5.5.tar.gz" + sha256: "9c4396cc829cfae319a6e2615202e82aad41372073482fce286fac78646d3ee4" + "1.5.2": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/facebook/zstd/releases/download/v1.5.2/zstd-1.5.2.tar.gz" + sha256: "7c42d56fac126929a6a85dbc73ff1db2411d04f104fae9bdea51305663a83fd0" + "1.5.0": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/facebook/zstd/releases/download/v1.5.0/zstd-1.5.0.tar.gz" + sha256: "5194fbfa781fcf45b98c5e849651aa7b3b0a008c6b72d4a0db760f3002291e94" +patches: + "1.5.6": + - patch_file: "patches/1.5.6-public-scope-windows-shared.patch" + patch_description: "Include zstd.h folder when building shared library on Windows" + patch_type: "bugfix" + patch_source: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/facebook/zstd/pull/4009" + "1.5.5": + - patch_file: "patches/1.5.2-cmake-remove-asm-except-x86_64.patch" + patch_description: "use assembler codes only on x86_64" + patch_type: "portability" + - patch_file: "patches/1.5.5-qnx_support.patch" + patch_description: "Add qnx to platform" + patch_type: "portability" + patch_source: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/facebook/zstd/pull/3745" + "1.5.2": + - patch_file: "patches/1.5.2-cmake-remove-asm-except-x86_64.patch" + patch_description: "use assembler codes only on x86_64" + patch_type: "portability" + - patch_file: "patches/1.5.0-remove-explicit-standard-setting.patch" + patch_description: "fix strange performance and scalability issues" + patch_type: "bugfix" + patch_source: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/facebook/zstd/pull/3167" + "1.5.0": + - patch_file: "patches/1.5.0-remove-explicit-standard-setting.patch" + patch_description: "fix strange performance and scalability issues" + patch_type: "bugfix" + patch_source: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/facebook/zstd/pull/3167" diff --git a/recipes/zstd/all/conanfile.py b/recipes/zstd/all/conanfile.py new file mode 100644 index 0000000..397fedf --- /dev/null +++ b/recipes/zstd/all/conanfile.py @@ -0,0 +1,103 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, replace_in_file, rmdir, rm +import glob +import os + +required_conan_version = ">=1.53.0" + +class ZstdConan(ConanFile): + name = "zstd" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/facebook/zstd" + description = "Zstandard - Fast real-time compression algorithm" + topics = ("zstandard", "compression", "algorithm", "decoder") + license = "BSD-3-Clause" + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "threading": [True, False], + "build_programs": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "threading": True, + "build_programs": True, + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + 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") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ZSTD_BUILD_PROGRAMS"] = self.options.build_programs + tc.variables["ZSTD_BUILD_STATIC"] = not self.options.shared or self.options.build_programs + tc.variables["ZSTD_BUILD_SHARED"] = self.options.shared + tc.variables["ZSTD_MULTITHREAD_SUPPORT"] = self.options.threading + tc.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + # Don't force PIC + replace_in_file(self, os.path.join(self.source_folder, "build", "cmake", "lib", "CMakeLists.txt"), + "POSITION_INDEPENDENT_CODE On", "") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "build", "cmake")) + cmake.build() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + + if self.options.shared and self.options.build_programs: + # If we build programs we have to build static libs (see logic in generate()), + # but if shared is True, we only want shared lib in package folder. + rm(self, "*_static.*", os.path.join(self.package_folder, "lib")) + for lib in glob.glob(os.path.join(self.package_folder, "lib", "*.a")): + if not lib.endswith(".dll.a"): + os.remove(lib) + + def package_info(self): + zstd_cmake = "libzstd_shared" if self.options.shared else "libzstd_static" + self.cpp_info.set_property("cmake_file_name", "zstd") + self.cpp_info.set_property("cmake_target_name", f"zstd::{zstd_cmake}") + self.cpp_info.set_property("pkg_config_name", "libzstd") + self.cpp_info.components["zstdlib"].libs = collect_libs(self) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["zstdlib"].system_libs.append("pthread") + + # TODO: Remove after dropping Conan 1.x from ConanCenterIndex + self.cpp_info.components["zstdlib"].names["cmake_find_package"] = zstd_cmake + self.cpp_info.components["zstdlib"].names["cmake_find_package_multi"] = zstd_cmake + self.cpp_info.components["zstdlib"].set_property("cmake_target_name", f"zstd::{zstd_cmake}") + self.cpp_info.components["zstdlib"].set_property("pkg_config_name", "libzstd") + if self.options.build_programs: + bindir = os.path.join(self.package_folder, "bin") + self.env_info.PATH.append(bindir) diff --git a/recipes/zstd/all/patches/1.5.0-remove-explicit-standard-setting.patch b/recipes/zstd/all/patches/1.5.0-remove-explicit-standard-setting.patch new file mode 100644 index 0000000..cb025cd --- /dev/null +++ b/recipes/zstd/all/patches/1.5.0-remove-explicit-standard-setting.patch @@ -0,0 +1,21 @@ +diff --git a/a/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake b/b/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake +index e23b9d6..8d04458 100644 +--- a/a/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake ++++ b/b/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake +@@ -22,10 +22,12 @@ endfunction() + + macro(ADD_ZSTD_COMPILATION_FLAGS) + if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" OR MINGW) #Not only UNIX but also WIN32 for MinGW +- #Set c++11 by default +- EnableCompilerFlag("-std=c++11" false true) +- #Set c99 by default +- EnableCompilerFlag("-std=c99" true false) ++ # It's possible to select the exact standard used for compilation. ++ # It's not necessary, but can be employed for specific purposes. ++ # Note that zstd source code is compatible with both C++98 and above ++ # and C-gnu90 (c90 + long long + variadic macros ) and above ++ # EnableCompilerFlag("-std=c++11" false true) # Set C++ compilation to c++11 standard ++ # EnableCompilerFlag("-std=c99" true false) # Set C compiation to c99 standard + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND MSVC) + # clang-cl normally maps -Wall to -Weverything. + EnableCompilerFlag("/clang:-Wall" true true) diff --git a/recipes/zstd/all/patches/1.5.2-cmake-remove-asm-except-x86_64.patch b/recipes/zstd/all/patches/1.5.2-cmake-remove-asm-except-x86_64.patch new file mode 100644 index 0000000..ed1ab3f --- /dev/null +++ b/recipes/zstd/all/patches/1.5.2-cmake-remove-asm-except-x86_64.patch @@ -0,0 +1,17 @@ +diff --git a/build/cmake/lib/CMakeLists.txt b/build/cmake/lib/CMakeLists.txt +index 4905bd9..5974725 100644 +--- a/build/cmake/lib/CMakeLists.txt ++++ b/build/cmake/lib/CMakeLists.txt +@@ -26,7 +26,11 @@ if (MSVC) + file(GLOB DecompressSources ${LIBRARY_DIR}/decompress/*.c) + add_compile_options(-DZSTD_DISABLE_ASM) + else () +- file(GLOB DecompressSources ${LIBRARY_DIR}/decompress/*.c ${LIBRARY_DIR}/decompress/*.S) ++ if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") ++ file(GLOB DecompressSources ${LIBRARY_DIR}/decompress/*.c ${LIBRARY_DIR}/decompress/*.S) ++ else() ++ file(GLOB DecompressSources ${LIBRARY_DIR}/decompress/*.c) ++ endif() + endif () + file(GLOB DictBuilderSources ${LIBRARY_DIR}/dictBuilder/*.c) + diff --git a/recipes/zstd/all/patches/1.5.5-qnx_support.patch b/recipes/zstd/all/patches/1.5.5-qnx_support.patch new file mode 100644 index 0000000..ba58a24 --- /dev/null +++ b/recipes/zstd/all/patches/1.5.5-qnx_support.patch @@ -0,0 +1,11 @@ +--- programs/platform.h 2023-04-04 22:13:52.000000000 +0200 ++++ programs/platform.h 2023-09-03 10:01:58.930595800 +0200 +@@ -89,7 +89,7 @@ + */ + # elif !defined(_WIN32) \ + && ( defined(__unix__) || defined(__unix) \ +- || defined(__midipix__) || defined(__VMS) || defined(__HAIKU__) ) ++ || defined(_QNX_SOURCE) || defined(__midipix__) || defined(__VMS) || defined(__HAIKU__) ) + + # if defined(__linux__) || defined(__linux) || defined(__CYGWIN__) + # ifndef _POSIX_C_SOURCE diff --git a/recipes/zstd/all/patches/1.5.6-public-scope-windows-shared.patch b/recipes/zstd/all/patches/1.5.6-public-scope-windows-shared.patch new file mode 100644 index 0000000..9862de8 --- /dev/null +++ b/recipes/zstd/all/patches/1.5.6-public-scope-windows-shared.patch @@ -0,0 +1,13 @@ +diff --git a/build/cmake/lib/CMakeLists.txt b/build/cmake/lib/CMakeLists.txt +index 5d514cc..1791897 100644 +--- a/build/cmake/lib/CMakeLists.txt ++++ b/build/cmake/lib/CMakeLists.txt +@@ -123,7 +123,7 @@ set(PUBLIC_INCLUDE_DIRS ${LIBRARY_DIR}) + set(library_targets) + if (ZSTD_BUILD_SHARED) + add_library(libzstd_shared SHARED ${Sources} ${Headers} ${PlatformDependResources}) +- target_include_directories(libzstd_shared INTERFACE $) ++ target_include_directories(libzstd_shared PUBLIC $) + list(APPEND library_targets libzstd_shared) + if (ZSTD_MULTITHREAD_SUPPORT) + set_property(TARGET libzstd_shared APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_MULTITHREAD") diff --git a/recipes/zstd/all/test_package/CMakeLists.txt b/recipes/zstd/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..57a72ca --- /dev/null +++ b/recipes/zstd/all/test_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(zstd REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +if (TARGET zstd::libzstd_shared) + target_link_libraries(${PROJECT_NAME} PRIVATE zstd::libzstd_shared) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE zstd::libzstd_static) +endif() diff --git a/recipes/zstd/all/test_package/conanfile.py b/recipes/zstd/all/test_package/conanfile.py new file mode 100644 index 0000000..541303d --- /dev/null +++ b/recipes/zstd/all/test_package/conanfile.py @@ -0,0 +1,28 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str, run=True) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not can_run(self): + return + + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/zstd/all/test_package/test_package.c b/recipes/zstd/all/test_package/test_package.c new file mode 100644 index 0000000..29bca24 --- /dev/null +++ b/recipes/zstd/all/test_package/test_package.c @@ -0,0 +1,12 @@ +#include +#include +#include +#include + +int main() { + const char* originalData = "Sample text"; + size_t compressedSize = ZSTD_compressBound(strlen(originalData) + 1); + printf("%zu\n", compressedSize); + + return 0; +} diff --git a/recipes/zstd/config.yml b/recipes/zstd/config.yml new file mode 100644 index 0000000..3b1802f --- /dev/null +++ b/recipes/zstd/config.yml @@ -0,0 +1,9 @@ +versions: + "1.5.6": + folder: all + "1.5.5": + folder: all + "1.5.2": + folder: all + "1.5.0": + folder: all