From 46b3060a9e1737aae807dc4924f91d9535d3e197 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 20 Jul 2023 23:15:45 +0300 Subject: [PATCH 01/23] getdns: migrate to Conan v2 --- recipes/getdns/all/CMakeLists.txt | 13 +- recipes/getdns/all/conandata.yml | 6 +- recipes/getdns/all/conanfile.py | 125 ++++++++++-------- .../getdns/all/test_package/CMakeLists.txt | 7 +- recipes/getdns/all/test_package/conanfile.py | 21 ++- .../getdns/all/test_v1_package/CMakeLists.txt | 8 ++ .../getdns/all/test_v1_package/conanfile.py | 17 +++ 7 files changed, 118 insertions(+), 79 deletions(-) create mode 100644 recipes/getdns/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/getdns/all/test_v1_package/conanfile.py diff --git a/recipes/getdns/all/CMakeLists.txt b/recipes/getdns/all/CMakeLists.txt index f96c6dd4ed727..796024060fef4 100644 --- a/recipes/getdns/all/CMakeLists.txt +++ b/recipes/getdns/all/CMakeLists.txt @@ -1,11 +1,10 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.12) project(cmake_wrapper) -include(conanbuildinfo.cmake) -conan_basic_setup() +find_package(libidn2 REQUIRED) -if(WIN32) - set(CMAKE_REQUIRED_LIBRARIES ws2_32) -endif() +link_libraries( + libidn2::libidn2 +) -add_subdirectory(source_subfolder) +add_subdirectory(src) diff --git a/recipes/getdns/all/conandata.yml b/recipes/getdns/all/conandata.yml index 63656d1d51254..d52fd9f228abb 100644 --- a/recipes/getdns/all/conandata.yml +++ b/recipes/getdns/all/conandata.yml @@ -5,10 +5,6 @@ sources: patches: "1.6.0": - patch_file: "patches/1.6.0-0001-install-runtimes.patch" - base_path: "source_subfolder" - patch_file: "patches/1.6.0-0002-fix-exports-extension-libraries.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.6.0-0003-let-find-modules-use-pkgconfig.patch" - base_path: "source_subfolder" +# - patch_file: "patches/1.6.0-0003-let-find-modules-use-pkgconfig.patch" - patch_file: "patches/1.6.0-0004-dont-install-symlinked-license.patch" - base_path: "source_subfolder" diff --git a/recipes/getdns/all/conanfile.py b/recipes/getdns/all/conanfile.py index a1d7aed1728a6..0f52daa5bcf73 100644 --- a/recipes/getdns/all/conanfile.py +++ b/recipes/getdns/all/conanfile.py @@ -1,18 +1,26 @@ -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration import glob import os +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, rmdir, replace_in_file +from conan.tools.gnu import PkgConfigDeps +from conan.tools.microsoft import is_msvc + +required_conan_version = ">=1.53.0" + class GetDnsConan(ConanFile): name = "getdns" description = "A modern asynchronous DNS API" - topics = "conan", "getdns", "asynchronous", "event" license = "BSD-3-Clause" - homepage = "https://getdnsapi.net/" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://getdnsapi.net/" + topics = ("asynchronous", "event") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" - exports_sources = "CMakeLists.txt", "patches/**" options = { "shared": [True, False], "fPIC": [True, False], @@ -33,9 +41,6 @@ class GetDnsConan(ConanFile): "with_libuv": True, "with_libidn2": True, } - generators = "cmake", "pkg_config", "cmake_find_package" - - _cmake = None @property def _with_libev(self): @@ -53,32 +58,37 @@ def _stub_only(self): else: return self.options.stub_only - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + self.options.stub_only = self._stub_only + self.options.with_libev = self._with_libev def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("openssl/1.1.1j") + self.requires("openssl/[>=1.1 <4]") if self._with_libev: self.requires("libev/4.33") if self.options.with_libevent: self.requires("libevent/2.1.12") if self.options.with_libuv: - self.requires("libuv/1.41.0") + self.requires("libuv/1.45.0") if self.options.with_libidn2: self.requires("libidn2/2.3.0") if self.options.tls == "gnutls": - self.requires("nettle/3.6") + self.requires("nettle/3.8.1") # FIXME: missing gnutls recipe raise ConanInvalidConfiguration("gnutls is not (yet) available on cci") if not self._stub_only: @@ -86,62 +96,63 @@ def requirements(self): raise ConanInvalidConfiguration("libunbound is not (yet) available on cci") def build_requirements(self): - self.build_requires("pkgconf/1.7.3") + self.tool_requires("pkgconf/1.9.3") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("getdns-{}".format(self.version), self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["OPENSSL_USE_STATIC_LIBS"] = not self.options["openssl"].shared - self._cmake.definitions["ENABLE_SHARED"] = self.options.shared - self._cmake.definitions["ENABLE_STATIC"] = not self.options.shared - self._cmake.definitions["ENABLE_STUB_ONLY"] = self._stub_only - self._cmake.definitions["BUILD_LIBEV"] = self._with_libev - self._cmake.definitions["BUILD_LIBEVENT2"] = self.options.with_libevent - self._cmake.definitions["BUILD_LIBUV"] = self.options.with_libuv - self._cmake.definitions["USE_LIBIDN2"] = self.options.with_libidn2 - self._cmake.definitions["USE_GNUTLS"] = self.options.tls == "gnutls" - self._cmake.definitions["BUILD_TESTING"] = False - - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + if self.settings.os == "Windows": + tc.variables["CMAKE_REQUIRED_LIBRARIES"] = "ws2_32" + tc.variables["OPENSSL_USE_STATIC_LIBS"] = not self.dependencies["openssl"].options.shared + tc.variables["ENABLE_SHARED"] = self.options.shared + tc.variables["ENABLE_STATIC"] = not self.options.shared + tc.variables["ENABLE_STUB_ONLY"] = self._stub_only + tc.variables["BUILD_LIBEV"] = self._with_libev + tc.variables["BUILD_LIBEVENT2"] = self.options.with_libevent + tc.variables["BUILD_LIBUV"] = self.options.with_libuv + tc.variables["USE_LIBIDN2"] = self.options.with_libidn2 + tc.variables["USE_GNUTLS"] = self.options.tls == "gnutls" + tc.variables["BUILD_TESTING"] = False + tc.generate() + tc = CMakeDeps(self) + tc.set_property("libidn2::libidn2", "cmake_target_name", "Libidn2::Libidn2") + tc.generate() + tc = PkgConfigDeps(self) + tc.generate() + + def _patch_sources(self): + apply_conandata_patches(self) def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + self._patch_sources() # Use FindOpenSSL.cmake to let check_function_exists succeed # Remove other cmake modules as they use FindPkgConfig for fn in glob.glob("Find*cmake"): if "OpenSSL" not in fn: os.unlink(fn) - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=self.export_sources_folder) cmake.build() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - - def package_id(self): - self.info.options.stub_only = self._stub_only - self.info.options.with_libev = self._with_libev + 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")) def package_info(self): libsuffix = "" - if self.settings.compiler == "Visual Studio" and not self.options.shared: + if is_msvc(self) and not self.options.shared: libsuffix = "_static" self.cpp_info.components["libgetdns"].libs = ["getdns" + libsuffix] self.cpp_info.components["libgetdns"].includedirs.append(os.path.join("include", "getdns")) - self.cpp_info.components["libgetdns"].names["pkg_config"]= "getdns" + self.cpp_info.components["libgetdns"].set_property("pkg_config_name", "getdns") self.cpp_info.components["libgetdns"].requires = ["openssl::openssl"] if self.options.with_libidn2: self.cpp_info.components["libgetdns"].requires.append("libidn2::libidn2") @@ -152,19 +163,19 @@ def package_info(self): if self.options.with_libevent: self.cpp_info.components["dns_ex_event"].libs = ["getdns_ex_event" + libsuffix] - self.cpp_info.components["dns_ex_event"].requires= ["libgetdns", "libevent::libevent"] - self.cpp_info.components["dns_ex_event"].names["pkg_config"]= "getdns_ext_event" + self.cpp_info.components["dns_ex_event"].requires = ["libgetdns", "libevent::libevent"] + self.cpp_info.components["dns_ex_event"].set_property("pkg_config_name", "getdns_ext_event") if self._with_libev: self.cpp_info.components["dns_ex_ev"].libs = ["getdns_ex_ev" + libsuffix] self.cpp_info.components["dns_ex_ev"].requires = ["libgetdns", "libev::libev"] - self.cpp_info.components["dns_ex_ev"].names["pkg_config"]= "getdns_ext_ev" + self.cpp_info.components["dns_ex_ev"].set_property("pkg_config_name", "getdns_ext_ev") if self.options.with_libuv: self.cpp_info.components["dns_ex_uv"].libs = ["getdns_ex_uv" + libsuffix] self.cpp_info.components["dns_ex_uv"].requires = ["libgetdns", "libuv::libuv"] - self.cpp_info.components["dns_ex_uv"].names["pkg_config"]= "getdns_ext_uv" + self.cpp_info.components["dns_ex_uv"].set_property("pkg_config_name", "getdns_ext_uv") bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) diff --git a/recipes/getdns/all/test_package/CMakeLists.txt b/recipes/getdns/all/test_package/CMakeLists.txt index 3a403dc404b41..e78d760c7b17a 100644 --- a/recipes/getdns/all/test_package/CMakeLists.txt +++ b/recipes/getdns/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package C) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup() +find_package(getdns REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE getdns::getdns) diff --git a/recipes/getdns/all/test_package/conanfile.py b/recipes/getdns/all/test_package/conanfile.py index bd7165a553cf4..ef5d7042163ec 100644 --- a/recipes/getdns/all/test_package/conanfile.py +++ b/recipes/getdns/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +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", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/getdns/all/test_v1_package/CMakeLists.txt b/recipes/getdns/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/getdns/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +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/getdns/all/test_v1_package/conanfile.py b/recipes/getdns/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7e2dfe859bb27 --- /dev/null +++ b/recipes/getdns/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 3dafbfdd3252730589b52d7546ba6e2a19fb9e28 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 7 Aug 2023 14:25:58 +0300 Subject: [PATCH 02/23] getdns: bump deps --- recipes/getdns/all/conanfile.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/recipes/getdns/all/conanfile.py b/recipes/getdns/all/conanfile.py index 0f52daa5bcf73..dcb919626aa4e 100644 --- a/recipes/getdns/all/conanfile.py +++ b/recipes/getdns/all/conanfile.py @@ -84,7 +84,7 @@ def requirements(self): if self.options.with_libevent: self.requires("libevent/2.1.12") if self.options.with_libuv: - self.requires("libuv/1.45.0") + self.requires("libuv/1.47.0") if self.options.with_libidn2: self.requires("libidn2/2.3.0") if self.options.tls == "gnutls": @@ -96,7 +96,8 @@ def requirements(self): raise ConanInvalidConfiguration("libunbound is not (yet) available on cci") def build_requirements(self): - self.tool_requires("pkgconf/1.9.3") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.0.3") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) From 609a7da9709b557735b33db1e8834d55bc3b6dd1 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sun, 26 Nov 2023 20:38:48 +0200 Subject: [PATCH 03/23] getdns: bump to 1.7.3, finish migration --- recipes/getdns/all/CMakeLists.txt | 40 +- recipes/getdns/all/conandata.yml | 11 +- recipes/getdns/all/conanfile.py | 120 ++-- .../patches/1.6.0-0001-install-runtimes.patch | 33 - ...-0003-let-find-modules-use-pkgconfig.patch | 641 ------------------ ...-0004-dont-install-symlinked-license.patch | 16 - recipes/getdns/config.yml | 2 +- 7 files changed, 98 insertions(+), 765 deletions(-) delete mode 100644 recipes/getdns/all/patches/1.6.0-0001-install-runtimes.patch delete mode 100644 recipes/getdns/all/patches/1.6.0-0003-let-find-modules-use-pkgconfig.patch delete mode 100644 recipes/getdns/all/patches/1.6.0-0004-dont-install-symlinked-license.patch diff --git a/recipes/getdns/all/CMakeLists.txt b/recipes/getdns/all/CMakeLists.txt index 796024060fef4..1b78796ea3464 100644 --- a/recipes/getdns/all/CMakeLists.txt +++ b/recipes/getdns/all/CMakeLists.txt @@ -1,10 +1,40 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.15) project(cmake_wrapper) -find_package(libidn2 REQUIRED) +macro(custom_find_package name) + find_package(${name} REQUIRED CONFIG + # Allow only Conan packages + NO_DEFAULT_PATH + PATHS ${CMAKE_PREFIX_PATH} + ) + string(TOUPPER ${name} name_upper) + set(${name_upper}_FOUND TRUE) + set(${name_upper}_INCLUDE_DIR ${${name}_INCLUDE_DIR}) +endmacro() -link_libraries( - libidn2::libidn2 -) +custom_find_package(OpenSSL) +if(BUILD_LIBEV) + custom_find_package(Libev) +endif() +if(BUILD_LIBEVENT2) + custom_find_package(Libevent2) +endif() +if(BUILD_LIBUV) + custom_find_package(Libuv) +endif() +if(USE_LIBIDN2) + custom_find_package(Libidn2) +endif() +if(USE_GNUTLS) + # FIXME: GnuTLS and Nettle should package individual components correctly + custom_find_package(GnuTLS) + add_library(GnuTLS::Dane ALIAS GnuTLS::GnuTLS) + custom_find_package(Nettle) + add_library(Nettle::Hogweed ALIAS Nettle::Nettle) +endif() + +if(WIN32) + link_libraries(ws2_32) +endif() add_subdirectory(src) diff --git a/recipes/getdns/all/conandata.yml b/recipes/getdns/all/conandata.yml index d52fd9f228abb..0bfac9e78cd80 100644 --- a/recipes/getdns/all/conandata.yml +++ b/recipes/getdns/all/conandata.yml @@ -1,10 +1,7 @@ sources: - "1.6.0": - url: "https://getdnsapi.net/dist/getdns-1.6.0.tar.gz" - sha256: "40e5737471a3902ba8304b0fd63aa7c95802f66ebbc6eae53c487c8e8a380f4a" + "1.7.3": + url: "https://getdnsapi.net/dist/getdns-1.7.3.tar.gz" + sha256: "f1404ca250f02e37a118aa00cf0ec2cbe11896e060c6d369c6761baea7d55a2c" patches: - "1.6.0": - - patch_file: "patches/1.6.0-0001-install-runtimes.patch" + "1.7.3": - patch_file: "patches/1.6.0-0002-fix-exports-extension-libraries.patch" -# - patch_file: "patches/1.6.0-0003-let-find-modules-use-pkgconfig.patch" - - patch_file: "patches/1.6.0-0004-dont-install-symlinked-license.patch" diff --git a/recipes/getdns/all/conanfile.py b/recipes/getdns/all/conanfile.py index dcb919626aa4e..26a48612268d6 100644 --- a/recipes/getdns/all/conanfile.py +++ b/recipes/getdns/all/conanfile.py @@ -1,10 +1,10 @@ -import glob import os 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, rmdir, replace_in_file +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, rm, replace_in_file from conan.tools.gnu import PkgConfigDeps from conan.tools.microsoft import is_msvc @@ -24,7 +24,7 @@ class GetDnsConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], - "tls": [False, "gnutls"], + "tls": ["openssl", "gnutls"], "stub_only": ["auto", True, False], "with_libev": ["auto", True, False], "with_libevent": [True, False], @@ -35,29 +35,13 @@ class GetDnsConan(ConanFile): "shared": False, "fPIC": True, "stub_only": "auto", - "tls": False, + "tls": "openssl", "with_libev": "auto", "with_libevent": True, "with_libuv": True, "with_libidn2": True, } - @property - def _with_libev(self): - if self.options.with_libev == "auto": - return self.settings.os != "Windows" - else: - return self.options.with_libev - - @property - def _stub_only(self): - if self.options.stub_only == "auto": - # FIXME: uncomment the next line when libunbound is available - # return self.settings.os == "Windows" - return True - else: - return self.options.stub_only - def export_sources(self): export_conandata_patches(self) copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) @@ -65,8 +49,9 @@ def export_sources(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - self.options.stub_only = self._stub_only - self.options.with_libev = self._with_libev + self.options.stub_only = self.settings.os != "Windows" + # FIXME: uncomment the next line when libunbound is available + self.options.with_libev = True # self.settings.os == "Windows" def configure(self): if self.options.shared: @@ -79,7 +64,7 @@ def layout(self): def requirements(self): self.requires("openssl/[>=1.1 <4]") - if self._with_libev: + if self.options.with_libev: self.requires("libev/4.33") if self.options.with_libevent: self.requires("libevent/2.1.12") @@ -88,10 +73,10 @@ def requirements(self): if self.options.with_libidn2: self.requires("libidn2/2.3.0") if self.options.tls == "gnutls": + self.requires("gnutls/3.7.8") self.requires("nettle/3.8.1") - # FIXME: missing gnutls recipe - raise ConanInvalidConfiguration("gnutls is not (yet) available on cci") - if not self._stub_only: + raise ConanInvalidConfiguration("gnutls on CCI does not build required libdane component") + if not self.options.stub_only: # FIXME: missing libunbound recipe raise ConanInvalidConfiguration("libunbound is not (yet) available on cci") @@ -103,42 +88,56 @@ def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): + VirtualBuildEnv(self).generate() + tc = CMakeToolchain(self) - if self.settings.os == "Windows": - tc.variables["CMAKE_REQUIRED_LIBRARIES"] = "ws2_32" tc.variables["OPENSSL_USE_STATIC_LIBS"] = not self.dependencies["openssl"].options.shared - tc.variables["ENABLE_SHARED"] = self.options.shared - tc.variables["ENABLE_STATIC"] = not self.options.shared - tc.variables["ENABLE_STUB_ONLY"] = self._stub_only - tc.variables["BUILD_LIBEV"] = self._with_libev - tc.variables["BUILD_LIBEVENT2"] = self.options.with_libevent - tc.variables["BUILD_LIBUV"] = self.options.with_libuv - tc.variables["USE_LIBIDN2"] = self.options.with_libidn2 - tc.variables["USE_GNUTLS"] = self.options.tls == "gnutls" - tc.variables["BUILD_TESTING"] = False - tc.generate() - tc = CMakeDeps(self) - tc.set_property("libidn2::libidn2", "cmake_target_name", "Libidn2::Libidn2") - tc.generate() - tc = PkgConfigDeps(self) + tc.cache_variables["ENABLE_SHARED"] = self.options.shared + tc.cache_variables["ENABLE_STATIC"] = not self.options.shared + tc.cache_variables["ENABLE_STUB_ONLY"] = self.options.stub_only + tc.cache_variables["BUILD_LIBEV"] = self.options.with_libev + tc.cache_variables["BUILD_LIBEVENT2"] = self.options.with_libevent + tc.cache_variables["BUILD_LIBUV"] = self.options.with_libuv + tc.cache_variables["USE_LIBIDN2"] = self.options.with_libidn2 + tc.cache_variables["USE_GNUTLS"] = self.options.tls == "gnutls" + # Force use of internal strptime when cross-compiling + tc.cache_variables["FORCE_COMPAT_STRPTIME"] = True + tc.cache_variables["BUILD_TESTING"] = False tc.generate() + deps = CMakeDeps(self) + deps.set_property("gnutls", "cmake_file_name", "GnuTLS") + deps.set_property("gnutls", "cmake_target_name", "GnuTLS::GnuTLS") + deps.set_property("libev", "cmake_file_name", "Libev") + deps.set_property("libev", "cmake_target_name", "Libev::Libev") + deps.set_property("libevent", "cmake_file_name", "Libevent2") + deps.set_property("libevent::core", "cmake_target_name", "Libevent2::Libevent_core") + deps.set_property("libidn2", "cmake_file_name", "Libidn2") + deps.set_property("libidn2", "cmake_target_name", "Libidn2::Libidn2") + deps.set_property("libuv", "cmake_file_name", "Libuv") + deps.set_property("libuv", "cmake_target_name", "Libuv::Libuv") + deps.set_property("nettle", "cmake_file_name", "Nettle") + deps.set_property("nettle", "cmake_target_name", "Nettle::Nettle") + deps.generate() + + deps = PkgConfigDeps(self) + deps.generate() + def _patch_sources(self): apply_conandata_patches(self) + rm(self, "Find*.cmake", os.path.join(self.source_folder, "cmake", "modules")) + # Workaround for check_function_exists() compilation tests + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "${OPENSSL_LIBRARIES}", "${OPENSSL_LIBRARIES} ssl crypto") def build(self): self._patch_sources() - # Use FindOpenSSL.cmake to let check_function_exists succeed - # Remove other cmake modules as they use FindPkgConfig - for fn in glob.glob("Find*cmake"): - if "OpenSSL" not in fn: - os.unlink(fn) cmake = CMake(self) - cmake.configure(build_script_folder=self.export_sources_folder) + cmake.configure(build_script_folder=self.source_path.parent) cmake.build() def package(self): - copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) cmake = CMake(self) cmake.install() @@ -155,28 +154,25 @@ def package_info(self): self.cpp_info.components["libgetdns"].includedirs.append(os.path.join("include", "getdns")) self.cpp_info.components["libgetdns"].set_property("pkg_config_name", "getdns") self.cpp_info.components["libgetdns"].requires = ["openssl::openssl"] - if self.options.with_libidn2: - self.cpp_info.components["libgetdns"].requires.append("libidn2::libidn2") if self.options.with_libidn2: self.cpp_info.components["libgetdns"].requires.append("libidn2::libidn2") if self.options.tls == "gnutls": self.cpp_info.components["libgetdns"].requires.extend(["nettle::nettle", "gnutls::gnutls"]) if self.options.with_libevent: - self.cpp_info.components["dns_ex_event"].libs = ["getdns_ex_event" + libsuffix] - self.cpp_info.components["dns_ex_event"].requires = ["libgetdns", "libevent::libevent"] - self.cpp_info.components["dns_ex_event"].set_property("pkg_config_name", "getdns_ext_event") + self.cpp_info.components["dns_ext_event"].libs = ["getdns_ext_event" + libsuffix] + self.cpp_info.components["dns_ext_event"].requires = ["libgetdns", "libevent::libevent"] + self.cpp_info.components["dns_ext_event"].set_property("pkg_config_name", "getdns_ext_event") - if self._with_libev: - self.cpp_info.components["dns_ex_ev"].libs = ["getdns_ex_ev" + libsuffix] - self.cpp_info.components["dns_ex_ev"].requires = ["libgetdns", "libev::libev"] - self.cpp_info.components["dns_ex_ev"].set_property("pkg_config_name", "getdns_ext_ev") + if self.options.with_libev: + self.cpp_info.components["dns_ext_ev"].libs = ["getdns_ext_ev" + libsuffix] + self.cpp_info.components["dns_ext_ev"].requires = ["libgetdns", "libev::libev"] + self.cpp_info.components["dns_ext_ev"].set_property("pkg_config_name", "getdns_ext_ev") if self.options.with_libuv: - self.cpp_info.components["dns_ex_uv"].libs = ["getdns_ex_uv" + libsuffix] - self.cpp_info.components["dns_ex_uv"].requires = ["libgetdns", "libuv::libuv"] - self.cpp_info.components["dns_ex_uv"].set_property("pkg_config_name", "getdns_ext_uv") + self.cpp_info.components["dns_ext_uv"].libs = ["getdns_ext_uv" + libsuffix] + self.cpp_info.components["dns_ext_uv"].requires = ["libgetdns", "libuv::libuv"] + self.cpp_info.components["dns_ext_uv"].set_property("pkg_config_name", "getdns_ext_uv") bin_path = os.path.join(self.package_folder, "bin") - self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) diff --git a/recipes/getdns/all/patches/1.6.0-0001-install-runtimes.patch b/recipes/getdns/all/patches/1.6.0-0001-install-runtimes.patch deleted file mode 100644 index de23061cc40af..0000000000000 --- a/recipes/getdns/all/patches/1.6.0-0001-install-runtimes.patch +++ /dev/null @@ -1,33 +0,0 @@ -Based on https://github.com/getdnsapi/getdns/pull/477 - ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -1055,22 +1055,22 @@ - endif () - endif () - if (ENABLE_SHARED) -- install(TARGETS getdns_shared LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) -+ install(TARGETS getdns_shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - if (USE_LIBEV) -- install(TARGETS getdns_ex_ev_shared LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) -+ install(TARGETS getdns_ex_ev_shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif () - if (USE_LIBEVENT2) -- install(TARGETS getdns_ex_event_shared LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) -+ install(TARGETS getdns_ex_event_shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif () - if (USE_LIBUV) -- install(TARGETS getdns_ex_uv_shared LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) -+ install(TARGETS getdns_ex_uv_shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif () - endif () - if (BUILD_GETDNS_QUERY) -- install(TARGETS getdns_query RUNTIME DESTINATION bin) -+ install(TARGETS getdns_query RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif () - if (BUILD_GETDNS_SERVER_MON) -- install(TARGETS getdns_server_mon RUNTIME DESTINATION bin) -+ install(TARGETS getdns_server_mon RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif () - - install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/getdns DESTINATION include) diff --git a/recipes/getdns/all/patches/1.6.0-0003-let-find-modules-use-pkgconfig.patch b/recipes/getdns/all/patches/1.6.0-0003-let-find-modules-use-pkgconfig.patch deleted file mode 100644 index 9e446cae01b2a..0000000000000 --- a/recipes/getdns/all/patches/1.6.0-0003-let-find-modules-use-pkgconfig.patch +++ /dev/null @@ -1,641 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -659,9 +659,9 @@ - target_include_directories(getdns_objects PRIVATE src/ssl_dane) - set(USE_DANESSL 1) - endif () --if (Libidn_FOUND) -- target_include_directories(getdns_objects PRIVATE ${LIBIDN_INCLUDE_DIR}) --endif () -+#if (Libidn_FOUND) -+# target_include_directories(getdns_objects PRIVATE ${LIBIDN_INCLUDE_DIR}) -+#endif () - if (Libidn2_FOUND) - target_include_directories(getdns_objects PRIVATE ${LIBIDN2_INCLUDE_DIR}) - endif () -@@ -695,9 +695,9 @@ - if (Libunbound_FOUND) - target_link_libraries(getdns PUBLIC Libunbound::Libunbound) - endif () -- if (Libidn_FOUND) -- target_link_libraries(getdns PUBLIC Libidn::Libidn) -- endif () -+# if (Libidn_FOUND) -+# target_link_libraries(getdns PUBLIC Libidn::Libidn) -+# endif () - if (Libidn2_FOUND) - target_link_libraries(getdns PUBLIC Libidn2::Libidn2) - endif () ---- cmake/modules/FindGnuTLS.cmake -+++ cmake/modules/FindGnuTLS.cmake -@@ -30,51 +30,65 @@ - - #]=======================================================================] - --find_path(GNUTLS_INCLUDE_DIR gnutls/gnutls.h -- HINTS -- "${GNUTLS_DIR}" -- "${GNUTLS_DIR}/include" --) -- --find_library(GNUTLS_LIBRARY NAMES gnutls libgnutls -- HINTS -- "${GNUTLS_DIR}" -- "${GNUTLS_DIR}/lib" --) -- --find_library(GNUTLS_DANE_LIBRARY NAMES gnutls-dane libgnutls-dane -- HINTS -- "${GNUTLS_DIR}" -- "${GNUTLS_DIR}/lib" --) -- --set(GNUTLS_LIBRARIES "") -- --if (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARY AND GNUTLS_DANE_LIBRARY) -- if (NOT TARGET GnuTLS::GnuTLS) -- add_library(GnuTLS::GnuTLS UNKNOWN IMPORTED) -- set_target_properties(GnuTLS::GnuTLS PROPERTIES -- INTERFACE_INCLUDE_DIRECTORIES "${GNUTLS_INCLUDE_DIR}" -- IMPORTED_LINK_INTERFACE_LANGUAGES "C" -- IMPORTED_LOCATION "${GNUTLS_LIBRARY}" -- ) -- endif () -- if (NOT TARGET GnuTLS::Dane) -- add_library(GnuTLS::Dane UNKNOWN IMPORTED) -- set_target_properties(GnuTLS::Dane PROPERTIES -- INTERFACE_INCLUDE_DIRECTORIES "${GNUTLS_INCLUDE_DIR}" -- IMPORTED_LINK_INTERFACE_LANGUAGES "C" -- IMPORTED_LOCATION "${GNUTLS_DANE_LIBRARY}" -- ) -- endif () -- -- if (NOT GNUTLS_VERSION AND GNUTLS_INCLUDE_DIR) -- file(STRINGS "${GNUTLS_INCLUDE_DIR}/gnutls/gnutls.h" GNUTLS_VER_H REGEX "^#define GNUTLS_VERSION_(MAJOR|MINOR|PATCH) ") -- string(REGEX REPLACE "^.*_MAJOR ([0-9]+).*_MINOR ([0-9]+).*_PATCH ([0-9]+).*$" "\\1.\\2.\\3c" GNUTLS_VERSION "${GNUTLS_VER_H}") -- endif () -+include(FindPkgConfig) -+if(PKG_CONFIG_FOUND) -+ pkg_check_modules(PkgGnuTLS IMPORTED_TARGET GLOBAL QUIET gnutls) -+ pkg_check_modules(PkgGnuTLSDane IMPORTED_TARGET GLOBAL QUIET gnutls-dane) - endif() - --list(APPEND GNUTLS_LIBRARIES "${GNUTLS_LIBRARY}" "${GNUTLS_DANE_LIBRARY}") -+if(PkgGnuTLS_FOUND AND PkgGnuTLSDane_FOUND) -+ set(GNUTLS_INCLUDE_DIR ${PkgGnuTLS_INCLUDE_DIRS} $PkgGnuTLSDane_INCLUDE_DIRS}) -+ set(NETTLE_LIBRARIES ${PkgGnuTLS_LIBRARIES} ${PkgGnuTLSDane_LIBRARIES}) -+ set(NETTLE_VERSION ${PkgGnuTLS_VERSION}) -+ add_library(GnuTLS::GnuTLS ALIAS PkgConfig::PkgGnuTLS) -+ add_library(GnuTLS::Dane ALIAS PkgConfig::PkgGnuTLSDane) -+else() -+ find_path(GNUTLS_INCLUDE_DIR gnutls/gnutls.h -+ HINTS -+ "${GNUTLS_DIR}" -+ "${GNUTLS_DIR}/include" -+ ) -+ -+ find_library(GNUTLS_LIBRARY NAMES gnutls libgnutls -+ HINTS -+ "${GNUTLS_DIR}" -+ "${GNUTLS_DIR}/lib" -+ ) -+ -+ find_library(GNUTLS_DANE_LIBRARY NAMES gnutls-dane libgnutls-dane -+ HINTS -+ "${GNUTLS_DIR}" -+ "${GNUTLS_DIR}/lib" -+ ) -+ -+ set(GNUTLS_LIBRARIES "") -+ -+ if (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARY AND GNUTLS_DANE_LIBRARY) -+ if (NOT TARGET GnuTLS::GnuTLS) -+ add_library(GnuTLS::GnuTLS UNKNOWN IMPORTED) -+ set_target_properties(GnuTLS::GnuTLS PROPERTIES -+ INTERFACE_INCLUDE_DIRECTORIES "${GNUTLS_INCLUDE_DIR}" -+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" -+ IMPORTED_LOCATION "${GNUTLS_LIBRARY}" -+ ) -+ endif () -+ if (NOT TARGET GnuTLS::Dane) -+ add_library(GnuTLS::Dane UNKNOWN IMPORTED) -+ set_target_properties(GnuTLS::Dane PROPERTIES -+ INTERFACE_INCLUDE_DIRECTORIES "${GNUTLS_INCLUDE_DIR}" -+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" -+ IMPORTED_LOCATION "${GNUTLS_DANE_LIBRARY}" -+ ) -+ endif () -+ -+ if (NOT GNUTLS_VERSION AND GNUTLS_INCLUDE_DIR) -+ file(STRINGS "${GNUTLS_INCLUDE_DIR}/gnutls/gnutls.h" GNUTLS_VER_H REGEX "^#define GNUTLS_VERSION_(MAJOR|MINOR|PATCH) ") -+ string(REGEX REPLACE "^.*_MAJOR ([0-9]+).*_MINOR ([0-9]+).*_PATCH ([0-9]+).*$" "\\1.\\2.\\3c" GNUTLS_VERSION "${GNUTLS_VER_H}") -+ endif () -+ endif() -+ -+ list(APPEND GNUTLS_LIBRARIES "${GNUTLS_LIBRARY}" "${GNUTLS_DANE_LIBRARY}") -+endif() - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(GnuTLS ---- cmake/modules/FindLibevent2.cmake -+++ cmake/modules/FindLibevent2.cmake -@@ -28,37 +28,49 @@ - - #]=======================================================================] - --find_path(LIBEVENT2_INCLUDE_DIR event2/event.h -- HINTS -- "${LIBEVENT2_DIR}" -- "${LIBEVENT2_DIR}/include" --) -- --find_library(LIBEVENT2_LIBRARY NAMES event_core libevent_core -- HINTS -- "${LIBEVENT2_DIR}" -- "${LIBEVENT2_DIR}/lib" --) -- --set(LIBEVENT2_LIBRARIES "") -- --if (LIBEVENT2_INCLUDE_DIR AND LIBEVENT2_LIBRARY) -- if (NOT TARGET Libevent2::Libevent_core) -- add_library(Libevent2::Libevent_core UNKNOWN IMPORTED) -- set_target_properties(Libevent2::Libevent_core PROPERTIES -- INTERFACE_INCLUDE_DIRECTORIES "${LIBEVENT2_INCLUDE_DIR}" -- IMPORTED_LINK_INTERFACE_LANGUAGES "C" -- IMPORTED_LOCATION "${LIBEVENT2_LIBRARY}" -- ) -- endif () -- -- if (NOT LIBEVENT2_VERSION AND LIBEVENT2_INCLUDE_DIR AND EXISTS "${LIBEVENT2_INCLUDE_DIR}/event2/event.h") -- file(STRINGS "${LIBEVENT2_INCLUDE_DIR}/event2/event-config.h" LIBEVENT2_H REGEX "^#define _?EVENT_+VERSION ") -- string(REGEX REPLACE "^.*EVENT_+VERSION \"([^\"]+)\".*$" "\\1" LIBEVENT2_VERSION "${LIBEVENT2_H}") -- endif () -+include(FindPkgConfig) -+if(PKG_CONFIG_FOUND) -+ pkg_check_modules(PkgLibevent IMPORTED_TARGET GLOBAL QUIET libevent>=2) - endif() - --list(APPEND LIBEVENT2_LIBRARIES "${LIBEVENT2_LIBRARY}") -+if(PkgLibevent_FOUND) -+ set(LIBEVENT2_INCLUDE_DIR ${PkgLibevent_INCLUDE_DIRS}) -+ set(LIBEVENT2_LIBRARIES ${PkgLibevent_LIBRARIES}) -+ set(LIBEVENT2_VERSION ${PkgLibevent_VERSION}) -+ add_library(Libevent2::Libevent_core ALIAS PkgConfig::PkgLibevent) -+else() -+ find_path(LIBEVENT2_INCLUDE_DIR event2/event.h -+ HINTS -+ "${LIBEVENT2_DIR}" -+ "${LIBEVENT2_DIR}/include" -+ ) -+ -+ find_library(LIBEVENT2_LIBRARY NAMES event_core libevent_core -+ HINTS -+ "${LIBEVENT2_DIR}" -+ "${LIBEVENT2_DIR}/lib" -+ ) -+ -+ set(LIBEVENT2_LIBRARIES "") -+ -+ if (LIBEVENT2_INCLUDE_DIR AND LIBEVENT2_LIBRARY) -+ if (NOT TARGET Libevent2::Libevent_core) -+ add_library(Libevent2::Libevent_core UNKNOWN IMPORTED) -+ set_target_properties(Libevent2::Libevent_core PROPERTIES -+ INTERFACE_INCLUDE_DIRECTORIES "${LIBEVENT2_INCLUDE_DIR}" -+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" -+ IMPORTED_LOCATION "${LIBEVENT2_LIBRARY}" -+ ) -+ endif () -+ -+ if (NOT LIBEVENT2_VERSION AND LIBEVENT2_INCLUDE_DIR AND EXISTS "${LIBEVENT2_INCLUDE_DIR}/event2/event.h") -+ file(STRINGS "${LIBEVENT2_INCLUDE_DIR}/event2/event-config.h" LIBEVENT2_H REGEX "^#define _?EVENT_+VERSION ") -+ string(REGEX REPLACE "^.*EVENT_+VERSION \"([^\"]+)\".*$" "\\1" LIBEVENT2_VERSION "${LIBEVENT2_H}") -+ endif () -+ endif() -+ -+ list(APPEND LIBEVENT2_LIBRARIES "${LIBEVENT2_LIBRARY}") -+endif() - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Libevent2 ---- cmake/modules/FindLibidn2.cmake -+++ cmake/modules/FindLibidn2.cmake -@@ -28,37 +28,49 @@ - - #]=======================================================================] - --find_path(LIBIDN2_INCLUDE_DIR idn2.h -- HINTS -- "${LIBIDN2_DIR}" -- "${LIBIDN2_DIR}/include" --) -- --find_library(LIBIDN2_LIBRARY NAMES idn2 libidn2 -- HINTS -- "${LIBIDN2_DIR}" -- "${LIBIDN2_DIR}/lib" --) -- --set(LIBIDN2_LIBRARIES "") -- --if (LIBIDN2_INCLUDE_DIR AND LIBIDN2_LIBRARY) -- if (NOT TARGET Libidn2::Libidn2) -- add_library(Libidn2::Libidn2 UNKNOWN IMPORTED) -- set_target_properties(Libidn2::Libidn2 PROPERTIES -- INTERFACE_INCLUDE_DIRECTORIES "${LIBIDN2_INCLUDE_DIR}" -- IMPORTED_LINK_INTERFACE_LANGUAGES "C" -- IMPORTED_LOCATION "${LIBIDN2_LIBRARY}" -+include(FindPkgConfig) -+if(PKG_CONFIG_FOUND) -+ pkg_check_modules(PkgLibIdn2 IMPORTED_TARGET GLOBAL libidn2) -+endif() -+ -+if(PkgLibIdn2_FOUND) -+ set(LIBIDN2_INCLUDE_DIR ${PkgLibIdn2_INCLUDE_DIRS}) -+ set(LIBIDN2_LIBRARIES ${PkgLibIdn2_LIBRARIES}) -+ set(LIBIDN2_VERSION ${PkgLibIdn2_VERSION}) -+ add_library(Libidn2::Libidn2 ALIAS PkgConfig::PkgLibIdn2) -+else() -+ find_path(LIBIDN2_INCLUDE_DIR idn2.h -+ HINTS -+ "${LIBIDN2_DIR}" -+ "${LIBIDN2_DIR}/include" -+ ) -+ -+ find_library(LIBIDN2_LIBRARY NAMES idn2 libidn2 -+ HINTS -+ "${LIBIDN2_DIR}" -+ "${LIBIDN2_DIR}/lib" -+ ) -+ -+ set(LIBIDN2_LIBRARIES "") -+ -+ if (LIBIDN2_INCLUDE_DIR AND LIBIDN2_LIBRARY) -+ if (NOT TARGET Libidn2::Libidn2) -+ add_library(Libidn2::Libidn2 UNKNOWN IMPORTED) -+ set_target_properties(Libidn2::Libidn2 PROPERTIES -+ INTERFACE_INCLUDE_DIRECTORIES "${LIBIDN2_INCLUDE_DIR}" -+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" -+ IMPORTED_LOCATION "${LIBIDN2_LIBRARY}" - ) -- endif () -+ endif () - -- if (NOT LIBIDN2_VERSION AND LIBIDN2_INCLUDE_DIR AND EXISTS "${LIBIDN2_INCLUDE_DIR}/unbound.h") -- file(STRINGS "${LIBIDN2_INCLUDE_DIR}/idn2.h" LIBIDN2_H REGEX "^#define IDN2_VERSION ") -- string(REGEX REPLACE "^.*IDN2_VERSION \"([0-9.]+)\".*$" "\\1" LIBIDN2_VERSION "${LIBIDN2_H}") -- endif () --endif() -+ if (NOT LIBIDN2_VERSION AND LIBIDN2_INCLUDE_DIR AND EXISTS "${LIBIDN2_INCLUDE_DIR}/unbound.h") -+ file(STRINGS "${LIBIDN2_INCLUDE_DIR}/idn2.h" LIBIDN2_H REGEX "^#define IDN2_VERSION ") -+ string(REGEX REPLACE "^.*IDN2_VERSION \"([0-9.]+)\".*$" "\\1" LIBIDN2_VERSION "${LIBIDN2_H}") -+ endif () - --list(APPEND LIBIDN2_LIBRARIES "${LIBIDN2_LIBRARY}") -+ list(APPEND LIBIDN2_LIBRARIES "${LIBIDN2_LIBRARY}") -+ endif() -+endif() - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Libidn2 ---- cmake/modules/FindLibunbound.cmake -+++ cmake/modules/FindLibunbound.cmake -@@ -28,58 +28,70 @@ - - #]=======================================================================] - --find_path(LIBUNBOUND_INCLUDE_DIR unbound.h -- HINTS -- "${LIBUNBOUND_DIR}" -- "${LIBUNBOUND_DIR}/include" --) -- --find_library(LIBUNBOUND_LIBRARY NAMES unbound -- HINTS -- "${LIBUNBOUND_DIR}" -- "${LIBUNBOUND_DIR}/lib" --) -- --set(LIBUNBOUND_LIBRARIES "") -- --if (UNIX) -- find_package(Threads REQUIRED) -- find_package(OpenSSL REQUIRED) -- -- list(APPEND LIBUNBOUND_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}") -- list(APPEND LIBUNBOUND_LIBRARIES "${OPENSSL_LIBRARIES}") -+include(FindPkgConfig) -+if(PKG_CONFIG_FOUND) -+ pkg_check_modules(PkgLibunbound IMPORTED_TARGET GLOBAL QUIET libunbound) - endif() - --if (LIBUNBOUND_INCLUDE_DIR AND LIBUNBOUND_LIBRARY) -- if (NOT TARGET Libunbound::Libunbound) -- add_library(Libunbound::Libunbound UNKNOWN IMPORTED) -- set_target_properties(Libunbound::Libunbound PROPERTIES -- INTERFACE_INCLUDE_DIRECTORIES "${LIBUNBOUND_INCLUDE_DIR}" -- IMPORTED_LINK_INTERFACE_LANGUAGES "C" -- IMPORTED_LOCATION "${LIBUNBOUND_LIBRARY}" -- ) -- -- if(UNIX AND TARGET Threads::Threads) -- set_property(TARGET Libunbound::Libunbound APPEND PROPERTY -- INTERFACE_LINK_LIBRARIES Threads::Threads) -- endif () -- if(UNIX AND TARGET OpenSSL::SSL) -- set_property(TARGET Libunbound::Libunbound APPEND PROPERTY -- INTERFACE_LINK_LIBRARIES OpenSSL::SSL) -+if(PkgLibunbound_FOUND) -+ set(LIBUNBOUND_INCLUDE_DIR ${PkgLibunbound_INCLUDE_DIRS}) -+ set(LIBUNBOUND_LIBRARIES ${PkgLibunbound_LIBRARIES}) -+ set(LIBUNBOUND_VERSION ${PkgLibunbound_VERSION}) -+ add_library(Libunbound::Libunbound ALIAS PkgConfig::PkgLibunbound) -+else() -+ find_path(LIBUNBOUND_INCLUDE_DIR unbound.h -+ HINTS -+ "${LIBUNBOUND_DIR}" -+ "${LIBUNBOUND_DIR}/include" -+ ) -+ -+ find_library(LIBUNBOUND_LIBRARY NAMES unbound -+ HINTS -+ "${LIBUNBOUND_DIR}" -+ "${LIBUNBOUND_DIR}/lib" -+ ) -+ -+ set(LIBUNBOUND_LIBRARIES "") -+ -+ if (UNIX) -+ find_package(Threads REQUIRED) -+ find_package(OpenSSL REQUIRED) -+ -+ list(APPEND LIBUNBOUND_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}") -+ list(APPEND LIBUNBOUND_LIBRARIES "${OPENSSL_LIBRARIES}") -+ endif() -+ -+ if (LIBUNBOUND_INCLUDE_DIR AND LIBUNBOUND_LIBRARY) -+ if (NOT TARGET Libunbound::Libunbound) -+ add_library(Libunbound::Libunbound UNKNOWN IMPORTED) -+ set_target_properties(Libunbound::Libunbound PROPERTIES -+ INTERFACE_INCLUDE_DIRECTORIES "${LIBUNBOUND_INCLUDE_DIR}" -+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" -+ IMPORTED_LOCATION "${LIBUNBOUND_LIBRARY}" -+ ) -+ -+ if(UNIX AND TARGET Threads::Threads) -+ set_property(TARGET Libunbound::Libunbound APPEND PROPERTY -+ INTERFACE_LINK_LIBRARIES Threads::Threads) -+ endif () -+ if(UNIX AND TARGET OpenSSL::SSL) -+ set_property(TARGET Libunbound::Libunbound APPEND PROPERTY -+ INTERFACE_LINK_LIBRARIES OpenSSL::SSL) -+ endif () -+ if(UNIX AND TARGET OpenSSL::Crypto) -+ set_property(TARGET Libunbound::Libunbound APPEND PROPERTY -+ INTERFACE_LINK_LIBRARIES OpenSSL::Crypto) -+ endif () - endif () -- if(UNIX AND TARGET OpenSSL::Crypto) -- set_property(TARGET Libunbound::Libunbound APPEND PROPERTY -- INTERFACE_LINK_LIBRARIES OpenSSL::Crypto) -+ -+ if (NOT LIBUNBOUND_VERSION AND LIBUNBOUND_INCLUDE_DIR AND EXISTS "${LIBUNBOUND_INCLUDE_DIR}/unbound.h") -+ file(STRINGS "${LIBUNBOUND_INCLUDE_DIR}/unbound.h" LIBUNBOUND_H REGEX "^#define UNBOUND_VERSION_M[A-Z]+") -+ string(REGEX REPLACE "^.*MAJOR ([0-9]+).*MINOR ([0-9]+).*MICRO ([0-9]+).*$" "\\1.\\2.\\3" LIBUNBOUND_VERSION "${LIBUNBOUND_H}") - endif () -- endif () -- -- if (NOT LIBUNBOUND_VERSION AND LIBUNBOUND_INCLUDE_DIR AND EXISTS "${LIBUNBOUND_INCLUDE_DIR}/unbound.h") -- file(STRINGS "${LIBUNBOUND_INCLUDE_DIR}/unbound.h" LIBUNBOUND_H REGEX "^#define UNBOUND_VERSION_M[A-Z]+") -- string(REGEX REPLACE "^.*MAJOR ([0-9]+).*MINOR ([0-9]+).*MICRO ([0-9]+).*$" "\\1.\\2.\\3" LIBUNBOUND_VERSION "${LIBUNBOUND_H}") -- endif () --endif() -- --list(APPEND LIBUNBOUND_LIBRARIES "${LIBUNBOUND_LIBRARY}") -+ endif() -+ -+ list(APPEND LIBUNBOUND_LIBRARIES "${LIBUNBOUND_LIBRARY}") -+endif - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Libunbound ---- cmake/modules/FindLibuv.cmake -+++ cmake/modules/FindLibuv.cmake -@@ -28,42 +28,54 @@ - - #]=======================================================================] - --find_path(LIBUV_INCLUDE_DIR uv.h -- HINTS -- "${LIBUV_DIR}" -- "${LIBUV_DIR}/include" --) -- --find_library(LIBUV_LIBRARY NAMES uv libuv -- HINTS -- "${LIBUV_DIR}" -- "${LIBUV_DIR}/lib" --) -- --set(LIBUV_LIBRARIES "") -- --if (LIBUV_INCLUDE_DIR AND LIBUV_LIBRARY) -- if (NOT TARGET Libuv::Libuv) -- add_library(Libuv::Libuv UNKNOWN IMPORTED) -- set_target_properties(Libuv::Libuv PROPERTIES -- INTERFACE_INCLUDE_DIRECTORIES "${LIBUV_INCLUDE_DIR}" -- IMPORTED_LINK_INTERFACE_LANGUAGES "C" -- IMPORTED_LOCATION "${LIBUV_LIBRARY}" -- ) -- endif () -+include(FindPkgConfig) -+if(PKG_CONFIG_FOUND) -+ pkg_check_modules(PkgLibuv IMPORTED_TARGET GLOBAL QUIET libuv) -+endif() - -- if (NOT LIBUV_VERSION AND LIBUV_INCLUDE_DIR) -- if (EXISTS "${LIBUV_INCLUDE_DIR}/uv-version.h") -- file(STRINGS "${LIBUV_INCLUDE_DIR}/uv-version.h" LIBUV_VER_H REGEX "^#define UV_VERSION_(MAJOR|MINOR|PATCH) ") -- elseif (EXISTS "${LIBUV_INCLUDE_DIR}/uv/version.h") -- file(STRINGS "${LIBUV_INCLUDE_DIR}/uv/version.h" LIBUV_VER_H REGEX "^#define UV_VERSION_(MAJOR|MINOR|PATCH) ") -+if(PkgLibuv_FOUND) -+ set(LIBUV_INCLUDE_DIR ${PkgLibuv_INCLUDE_DIRS}) -+ set(LIBUV_LIBRARIES ${PkgLibuv_LIBRARIES}) -+ set(LIBUV_VERSION ${PkgLibuv_VERSION}) -+ add_library(Libuv::Libuv ALIAS PkgConfig::PkgLibuv) -+else() -+ find_path(LIBUV_INCLUDE_DIR uv.h -+ HINTS -+ "${LIBUV_DIR}" -+ "${LIBUV_DIR}/include" -+ ) -+ -+ find_library(LIBUV_LIBRARY NAMES uv libuv -+ HINTS -+ "${LIBUV_DIR}" -+ "${LIBUV_DIR}/lib" -+ ) -+ -+ set(LIBUV_LIBRARIES "") -+ -+ if (LIBUV_INCLUDE_DIR AND LIBUV_LIBRARY) -+ if (NOT TARGET Libuv::Libuv) -+ add_library(Libuv::Libuv UNKNOWN IMPORTED) -+ set_target_properties(Libuv::Libuv PROPERTIES -+ INTERFACE_INCLUDE_DIRECTORIES "${LIBUV_INCLUDE_DIR}" -+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" -+ IMPORTED_LOCATION "${LIBUV_LIBRARY}" -+ ) - endif () -- string(REGEX REPLACE "^.*_MAJOR ([0-9]+).*_MINOR ([0-9]+).*_PATCH ([0-9]+).*$" "\\1.\\2.\\3" LIBUV_VERSION "${LIBUV_VER_H}") -- endif () -+ -+ if (NOT LIBUV_VERSION AND LIBUV_INCLUDE_DIR) -+ if (EXISTS "${LIBUV_INCLUDE_DIR}/uv-version.h") -+ file(STRINGS "${LIBUV_INCLUDE_DIR}/uv-version.h" LIBUV_VER_H REGEX "^#define UV_VERSION_(MAJOR|MINOR|PATCH) ") -+ elseif (EXISTS "${LIBUV_INCLUDE_DIR}/uv/version.h") -+ file(STRINGS "${LIBUV_INCLUDE_DIR}/uv/version.h" LIBUV_VER_H REGEX "^#define UV_VERSION_(MAJOR|MINOR|PATCH) ") -+ endif () -+ string(REGEX REPLACE "^.*_MAJOR ([0-9]+).*_MINOR ([0-9]+).*_PATCH ([0-9]+).*$" "\\1.\\2.\\3" LIBUV_VERSION "${LIBUV_VER_H}") -+ endif () -+ endif() -+ -+ list(APPEND LIBUV_LIBRARIES "${LIBUV_LIBRARY}") - endif() - --list(APPEND LIBUV_LIBRARIES "${LIBUV_LIBRARY}") -- - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Libuv - REQUIRED_VARS LIBUV_LIBRARIES LIBUV_INCLUDE_DIR ---- cmake/modules/FindNettle.cmake -+++ cmake/modules/FindNettle.cmake -@@ -30,62 +30,76 @@ - - #]=======================================================================] - --find_path(NETTLE_INCLUDE_DIR nettle/version.h -- HINTS -- "${NETTLE_DIR}" -- "${NETTLE_DIR}/include" --) -- --find_library(NETTLE_LIBRARY NAMES nettle libnettle -- HINTS -- "${NETTLE_DIR}" -- "${NETTLE_DIR}/lib" --) -- --find_library(HOGWEED_LIBRARY NAMES hogweed libhogweed -- HINTS -- "${NETTLE_DIR}" -- "${NETTLE_DIR}/lib" --) -- --set(NETTLE_LIBRARIES "") -- --# May need gmp library on Unix. --if (UNIX) -- find_library(NETTLE_GMP_LIBRARY gmp) -- -- if (NETTLE_GMP_LIBRARY) -- list(APPEND NETTLE_LIBRARIES "${NETTLE_GMP_LIBRARY}") -- endif () --endif () -- --if (NETTLE_INCLUDE_DIR AND NETTLE_LIBRARY AND HOGWEED_LIBRARY) -- if (NOT TARGET Nettle::Nettle) -- add_library(Nettle::Nettle UNKNOWN IMPORTED) -- set_target_properties(Nettle::Nettle PROPERTIES -- INTERFACE_INCLUDE_DIRECTORIES "${NETTLE_INCLUDE_DIR}" -- INTERFACE_LINK_LIBRARIES "${NETTLE_LIBRARIES}" -- IMPORTED_LINK_INTERFACE_LANGUAGES "C" -- IMPORTED_LOCATION "${NETTLE_LIBRARY}" -- ) -- endif () -- if (NOT TARGET Nettle::Hogweed) -- add_library(Nettle::Hogweed UNKNOWN IMPORTED) -- set_target_properties(Nettle::Hogweed PROPERTIES -- INTERFACE_INCLUDE_DIRECTORIES "${NETTLE_INCLUDE_DIR}" -- IMPORTED_LINK_INTERFACE_LANGUAGES "C" -- IMPORTED_LOCATION "${HOGWEED_LIBRARY}" -- ) -- endif () -+include(FindPkgConfig) -+if(PKG_CONFIG_FOUND) -+ pkg_check_modules(PkgNettle IMPORTED_TARGET GLOBAL nettle) -+ pkg_check_modules(PkgHogweed IMPORTED_TARGET GLOBAL QUIET hogweed) -+endif() - -- if (NOT NETTLE_VERSION AND NETTLE_INCLUDE_DIR) -- file(STRINGS "${NETTLE_INCLUDE_DIR}/nettle/version.h" NETTLE_VER_H REGEX "^#define NETTLE_VERSION_(MAJOR|MINOR) ") -- string(REGEX REPLACE "^.*_MAJOR ([0-9]+).*_MINOR ([0-9]+).*$" "\\1.\\2" NETTLE_VERSION "${NETTLE_VER_H}") -+if(PkgNettle_FOUND AND PkHogweed_FOUND) -+ set(NETTLE_INCLUDE_DIR ${PkgNettle_INCLUDE_DIRS} ${PkgHogweed_INCLUDE_DIRS}) -+ set(NETTLE_LIBRARIES ${PkgNettle_LIBRARIES} ${PkgHogweed_LIBRARIES}) -+ set(NETTLE_VERSION ${PkgNettle_VERSION}) -+ add_library(Nettle::Nettle ALIAS PkgConfig::PkgNettle) -+ add_library(Nettle::Hogweed ALIAS PkgConfig::PkgHogweed) -+else() -+ find_path(NETTLE_INCLUDE_DIR nettle/version.h -+ HINTS -+ "${NETTLE_DIR}" -+ "${NETTLE_DIR}/include" -+ ) -+ -+ find_library(NETTLE_LIBRARY NAMES nettle libnettle -+ HINTS -+ "${NETTLE_DIR}" -+ "${NETTLE_DIR}/lib" -+ ) -+ -+ find_library(HOGWEED_LIBRARY NAMES hogweed libhogweed -+ HINTS -+ "${NETTLE_DIR}" -+ "${NETTLE_DIR}/lib" -+ ) -+ -+ set(NETTLE_LIBRARIES "") -+ -+ # May need gmp library on Unix. -+ if (UNIX) -+ find_library(NETTLE_GMP_LIBRARY gmp) -+ -+ if (NETTLE_GMP_LIBRARY) -+ list(APPEND NETTLE_LIBRARIES "${NETTLE_GMP_LIBRARY}") -+ endif () - endif () -+ -+ if (NETTLE_INCLUDE_DIR AND NETTLE_LIBRARY AND HOGWEED_LIBRARY) -+ if (NOT TARGET Nettle::Nettle) -+ add_library(Nettle::Nettle UNKNOWN IMPORTED) -+ set_target_properties(Nettle::Nettle PROPERTIES -+ INTERFACE_INCLUDE_DIRECTORIES "${NETTLE_INCLUDE_DIR}" -+ INTERFACE_LINK_LIBRARIES "${NETTLE_LIBRARIES}" -+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" -+ IMPORTED_LOCATION "${NETTLE_LIBRARY}" -+ ) -+ endif () -+ if (NOT TARGET Nettle::Hogweed) -+ add_library(Nettle::Hogweed UNKNOWN IMPORTED) -+ set_target_properties(Nettle::Hogweed PROPERTIES -+ INTERFACE_INCLUDE_DIRECTORIES "${NETTLE_INCLUDE_DIR}" -+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" -+ IMPORTED_LOCATION "${HOGWEED_LIBRARY}" -+ ) -+ endif () -+ -+ if (NOT NETTLE_VERSION AND NETTLE_INCLUDE_DIR) -+ file(STRINGS "${NETTLE_INCLUDE_DIR}/nettle/version.h" NETTLE_VER_H REGEX "^#define NETTLE_VERSION_(MAJOR|MINOR) ") -+ string(REGEX REPLACE "^.*_MAJOR ([0-9]+).*_MINOR ([0-9]+).*$" "\\1.\\2" NETTLE_VERSION "${NETTLE_VER_H}") -+ endif () -+ endif() -+ -+ list(APPEND NETTLE_LIBRARIES "${NETTLE_LIBRARY}" "${HOGWEED_LIBRARY}") - endif() - --list(APPEND NETTLE_LIBRARIES "${NETTLE_LIBRARY}" "${HOGWEED_LIBRARY}") -- - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Nettle - REQUIRED_VARS NETTLE_LIBRARIES NETTLE_INCLUDE_DIR diff --git a/recipes/getdns/all/patches/1.6.0-0004-dont-install-symlinked-license.patch b/recipes/getdns/all/patches/1.6.0-0004-dont-install-symlinked-license.patch deleted file mode 100644 index fadb8d2d20e5f..0000000000000 --- a/recipes/getdns/all/patches/1.6.0-0004-dont-install-symlinked-license.patch +++ /dev/null @@ -1,16 +0,0 @@ -Avoids weird issue on c3i Windows builders: - - CMake Error at source_subfolder/cmake_install.cmake:104 (file): - file INSTALL cannot read symlink - "C:/J/w/cci_PR-2903@2/.conan/data/getdns/1.6.0/_/_/build/dd6d0e14f162a68e24ee52fee674d130eac57dea/source_subfolder/COPYING" - to duplicate at - "C:/J/w/cci_PR-2903@2/.conan/data/getdns/1.6.0/_/_/package/dd6d0e14f162a68e24ee52fee674d130eac57dea/share/doc/getdns/COPYING": - File exists. - Call Stack (most recent call first): - - ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -1080,1 +1080,1 @@ --install(FILES AUTHORS ChangeLog COPYING LICENSE NEWS README.md DESTINATION ${docdir}) -+install(FILES AUTHORS ChangeLog NEWS README.md DESTINATION ${docdir}) diff --git a/recipes/getdns/config.yml b/recipes/getdns/config.yml index 10acb3ad5b1e8..e14fae48c780f 100644 --- a/recipes/getdns/config.yml +++ b/recipes/getdns/config.yml @@ -1,3 +1,3 @@ versions: - "1.6.0": + "1.7.3": folder: "all" From 32b2b6532b6e8ba00e7cdf7a122b42d36a635485 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sun, 26 Nov 2023 20:45:16 +0200 Subject: [PATCH 04/23] getdns: temporarily disable libidn2 --- recipes/getdns/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/getdns/all/conanfile.py b/recipes/getdns/all/conanfile.py index 26a48612268d6..e0afdd7ad08aa 100644 --- a/recipes/getdns/all/conanfile.py +++ b/recipes/getdns/all/conanfile.py @@ -39,7 +39,7 @@ class GetDnsConan(ConanFile): "with_libev": "auto", "with_libevent": True, "with_libuv": True, - "with_libidn2": True, + "with_libidn2": False, # FIXME: re-enable once libidn2 has been migrated } def export_sources(self): From e9130abcf227920c95d89fd70288d6485880743f Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sun, 26 Nov 2023 22:07:57 +0200 Subject: [PATCH 05/23] getdns: bump cmake, remove pkg-config --- recipes/getdns/all/conanfile.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/recipes/getdns/all/conanfile.py b/recipes/getdns/all/conanfile.py index e0afdd7ad08aa..c61ba0421788d 100644 --- a/recipes/getdns/all/conanfile.py +++ b/recipes/getdns/all/conanfile.py @@ -5,7 +5,6 @@ from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.env import VirtualBuildEnv from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, rm, replace_in_file -from conan.tools.gnu import PkgConfigDeps from conan.tools.microsoft import is_msvc required_conan_version = ">=1.53.0" @@ -81,8 +80,7 @@ def requirements(self): raise ConanInvalidConfiguration("libunbound is not (yet) available on cci") def build_requirements(self): - if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): - self.tool_requires("pkgconf/2.0.3") + self.tool_requires("cmake/[>=3.20 <4]") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) @@ -120,9 +118,6 @@ def generate(self): deps.set_property("nettle", "cmake_target_name", "Nettle::Nettle") deps.generate() - deps = PkgConfigDeps(self) - deps.generate() - def _patch_sources(self): apply_conandata_patches(self) rm(self, "Find*.cmake", os.path.join(self.source_folder, "cmake", "modules")) From 16a16981d329db17444de7e2fae5f7c489cc03ed Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 27 Nov 2023 17:30:24 +0200 Subject: [PATCH 06/23] getdns: check that OpenSSL configuration has not failed --- recipes/getdns/all/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/recipes/getdns/all/CMakeLists.txt b/recipes/getdns/all/CMakeLists.txt index 1b78796ea3464..9e49b54c3c20e 100644 --- a/recipes/getdns/all/CMakeLists.txt +++ b/recipes/getdns/all/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 3.15) project(cmake_wrapper) +# Wrapper for find_package() that sets variables in the format expected by the project macro(custom_find_package name) find_package(${name} REQUIRED CONFIG # Allow only Conan packages @@ -38,3 +39,8 @@ if(WIN32) endif() add_subdirectory(src) + +if(NOT HAVE_DSA_SIG_SET0) + # This should have been found for OpenSSL from CCI + message(FATAL_ERROR "OpenSSL feature detection failed, probably due to a bug in getdns recipe.") +endif() From d2c9cf9354566fdeee5a38954de6804fb4a41b8b Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 20 Jan 2024 12:26:21 +0200 Subject: [PATCH 07/23] getdns: don't need to use cache_variables CMake is 3.20+. --- recipes/getdns/all/conanfile.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/recipes/getdns/all/conanfile.py b/recipes/getdns/all/conanfile.py index c61ba0421788d..da15934feb48d 100644 --- a/recipes/getdns/all/conanfile.py +++ b/recipes/getdns/all/conanfile.py @@ -90,17 +90,17 @@ def generate(self): tc = CMakeToolchain(self) tc.variables["OPENSSL_USE_STATIC_LIBS"] = not self.dependencies["openssl"].options.shared - tc.cache_variables["ENABLE_SHARED"] = self.options.shared - tc.cache_variables["ENABLE_STATIC"] = not self.options.shared - tc.cache_variables["ENABLE_STUB_ONLY"] = self.options.stub_only - tc.cache_variables["BUILD_LIBEV"] = self.options.with_libev - tc.cache_variables["BUILD_LIBEVENT2"] = self.options.with_libevent - tc.cache_variables["BUILD_LIBUV"] = self.options.with_libuv - tc.cache_variables["USE_LIBIDN2"] = self.options.with_libidn2 - tc.cache_variables["USE_GNUTLS"] = self.options.tls == "gnutls" + tc.variables["ENABLE_SHARED"] = self.options.shared + tc.variables["ENABLE_STATIC"] = not self.options.shared + tc.variables["ENABLE_STUB_ONLY"] = self.options.stub_only + tc.variables["BUILD_LIBEV"] = self.options.with_libev + tc.variables["BUILD_LIBEVENT2"] = self.options.with_libevent + tc.variables["BUILD_LIBUV"] = self.options.with_libuv + tc.variables["USE_LIBIDN2"] = self.options.with_libidn2 + tc.variables["USE_GNUTLS"] = self.options.tls == "gnutls" # Force use of internal strptime when cross-compiling - tc.cache_variables["FORCE_COMPAT_STRPTIME"] = True - tc.cache_variables["BUILD_TESTING"] = False + tc.variables["FORCE_COMPAT_STRPTIME"] = True + tc.variables["BUILD_TESTING"] = False tc.generate() deps = CMakeDeps(self) From fdd69db2603c6dfd3dafbe4dad34ee7e75009008 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 20 Jan 2024 12:30:01 +0200 Subject: [PATCH 08/23] getdns: temporarily print detailed CMake logs --- recipes/getdns/all/conanfile.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/recipes/getdns/all/conanfile.py b/recipes/getdns/all/conanfile.py index da15934feb48d..b5f765674894b 100644 --- a/recipes/getdns/all/conanfile.py +++ b/recipes/getdns/all/conanfile.py @@ -1,10 +1,10 @@ import os from conan import ConanFile -from conan.errors import ConanInvalidConfiguration +from conan.errors import ConanInvalidConfiguration, ConanException from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.env import VirtualBuildEnv -from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, rm, replace_in_file +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, rm, replace_in_file, load from conan.tools.microsoft import is_msvc required_conan_version = ">=1.53.0" @@ -128,7 +128,12 @@ def _patch_sources(self): def build(self): self._patch_sources() cmake = CMake(self) - cmake.configure(build_script_folder=self.source_path.parent) + try: + cmake.configure(build_script_folder=self.source_path.parent) + except ConanException: + log = load(self, os.path.join(self.build_folder, "CMakeFiles/CMakeConfigureLog.yaml")) + self.output.error(log) + raise cmake.build() def package(self): From 6efa45c04a10975b1ef928d26474274a1da30f3a Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 20 Jan 2024 13:10:52 +0200 Subject: [PATCH 09/23] getdns: add Windows system libs --- recipes/getdns/all/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/getdns/all/conanfile.py b/recipes/getdns/all/conanfile.py index b5f765674894b..024436e86cfcb 100644 --- a/recipes/getdns/all/conanfile.py +++ b/recipes/getdns/all/conanfile.py @@ -158,6 +158,8 @@ def package_info(self): self.cpp_info.components["libgetdns"].requires.append("libidn2::libidn2") if self.options.tls == "gnutls": self.cpp_info.components["libgetdns"].requires.extend(["nettle::nettle", "gnutls::gnutls"]) + if self.settings.os == "Windows": + self.cpp_info.components["libgetdns"].system_libs.extend(["ws2_32", "crypt32", "gdi32", "iphlpapi", "psapi", "userenv"]) if self.options.with_libevent: self.cpp_info.components["dns_ext_event"].libs = ["getdns_ext_event" + libsuffix] From 0b79b1ae5cf94d0d75c837fc6bc54ae7a9cb1cf8 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 20 Jan 2024 13:50:52 +0200 Subject: [PATCH 10/23] getdns: set CMAKE_TRY_COMPILE_CONFIGURATION --- recipes/getdns/all/CMakeLists.txt | 1 + recipes/getdns/all/conanfile.py | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/getdns/all/CMakeLists.txt b/recipes/getdns/all/CMakeLists.txt index 9e49b54c3c20e..bbdb403da0a9a 100644 --- a/recipes/getdns/all/CMakeLists.txt +++ b/recipes/getdns/all/CMakeLists.txt @@ -11,6 +11,7 @@ macro(custom_find_package name) string(TOUPPER ${name} name_upper) set(${name_upper}_FOUND TRUE) set(${name_upper}_INCLUDE_DIR ${${name}_INCLUDE_DIR}) + set(${name_upper}_LIBRARIES ${${name}_LIBRARIES}) endmacro() custom_find_package(OpenSSL) diff --git a/recipes/getdns/all/conanfile.py b/recipes/getdns/all/conanfile.py index 024436e86cfcb..7176522b54999 100644 --- a/recipes/getdns/all/conanfile.py +++ b/recipes/getdns/all/conanfile.py @@ -101,6 +101,8 @@ def generate(self): # Force use of internal strptime when cross-compiling tc.variables["FORCE_COMPAT_STRPTIME"] = True tc.variables["BUILD_TESTING"] = False + # https://github.com/conan-io/conan/issues/12180 + tc.variables["CMAKE_TRY_COMPILE_CONFIGURATION"] = self.settings.build_type tc.generate() deps = CMakeDeps(self) @@ -121,9 +123,6 @@ def generate(self): def _patch_sources(self): apply_conandata_patches(self) rm(self, "Find*.cmake", os.path.join(self.source_folder, "cmake", "modules")) - # Workaround for check_function_exists() compilation tests - replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), - "${OPENSSL_LIBRARIES}", "${OPENSSL_LIBRARIES} ssl crypto") def build(self): self._patch_sources() From 35505244f4780536177d38052a7aaf8b8522a58a Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 20 Jan 2024 14:12:57 +0200 Subject: [PATCH 11/23] getdns: fix Windows build --- recipes/getdns/all/conanfile.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/recipes/getdns/all/conanfile.py b/recipes/getdns/all/conanfile.py index 7176522b54999..257d6e78a1fd5 100644 --- a/recipes/getdns/all/conanfile.py +++ b/recipes/getdns/all/conanfile.py @@ -1,10 +1,10 @@ import os -from conan import ConanFile +from conan import ConanFile, conan_version from conan.errors import ConanInvalidConfiguration, ConanException from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.env import VirtualBuildEnv -from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, rm, replace_in_file, load +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, rm, load from conan.tools.microsoft import is_msvc required_conan_version = ">=1.53.0" @@ -16,7 +16,7 @@ class GetDnsConan(ConanFile): license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://getdnsapi.net/" - topics = ("asynchronous", "event") + topics = ("dns", "asynchronous", "event") package_type = "library" settings = "os", "arch", "compiler", "build_type" @@ -38,7 +38,7 @@ class GetDnsConan(ConanFile): "with_libev": "auto", "with_libevent": True, "with_libuv": True, - "with_libidn2": False, # FIXME: re-enable once libidn2 has been migrated + "with_libidn2": True, } def export_sources(self): @@ -48,8 +48,11 @@ def export_sources(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - self.options.stub_only = self.settings.os != "Windows" - # FIXME: uncomment the next line when libunbound is available + # FIXME: remove once libidn2 has been migrated + # https://github.com/conan-io/conan-center-index/pull/18642 + self.options.with_libidn2 = conan_version.major == 1 + # FIXME: uncomment once libunbound is available + # self.options.stub_only = self.settings.os != "Windows" self.options.with_libev = True # self.settings.os == "Windows" def configure(self): @@ -101,6 +104,7 @@ def generate(self): # Force use of internal strptime when cross-compiling tc.variables["FORCE_COMPAT_STRPTIME"] = True tc.variables["BUILD_TESTING"] = False + # To fix OpenSSL try_compile() checks # https://github.com/conan-io/conan/issues/12180 tc.variables["CMAKE_TRY_COMPILE_CONFIGURATION"] = self.settings.build_type tc.generate() From 3bc08845e3a7283d392c7e935533a2041545f1fb Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Tue, 23 Jan 2024 21:58:54 +0200 Subject: [PATCH 12/23] getdns: disable libidn2 for now --- recipes/getdns/all/conanfile.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/recipes/getdns/all/conanfile.py b/recipes/getdns/all/conanfile.py index 257d6e78a1fd5..62d5397901f9b 100644 --- a/recipes/getdns/all/conanfile.py +++ b/recipes/getdns/all/conanfile.py @@ -1,6 +1,6 @@ import os -from conan import ConanFile, conan_version +from conan import ConanFile from conan.errors import ConanInvalidConfiguration, ConanException from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.env import VirtualBuildEnv @@ -38,7 +38,7 @@ class GetDnsConan(ConanFile): "with_libev": "auto", "with_libevent": True, "with_libuv": True, - "with_libidn2": True, + "with_libidn2": False, # FIXME: enable once libidn2 has been migrated https://github.com/conan-io/conan-center-index/pull/18642 } def export_sources(self): @@ -48,12 +48,10 @@ def export_sources(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - # FIXME: remove once libidn2 has been migrated - # https://github.com/conan-io/conan-center-index/pull/18642 - self.options.with_libidn2 = conan_version.major == 1 + self.options.with_libev = True # FIXME: uncomment once libunbound is available # self.options.stub_only = self.settings.os != "Windows" - self.options.with_libev = True # self.settings.os == "Windows" + # self.options.with_libev = self.settings.os == "Windows" def configure(self): if self.options.shared: @@ -77,7 +75,7 @@ def requirements(self): if self.options.tls == "gnutls": self.requires("gnutls/3.7.8") self.requires("nettle/3.8.1") - raise ConanInvalidConfiguration("gnutls on CCI does not build required libdane component") + raise ConanInvalidConfiguration("gnutls on CCI does not build the required libdane component") if not self.options.stub_only: # FIXME: missing libunbound recipe raise ConanInvalidConfiguration("libunbound is not (yet) available on cci") From 4da074a97a6e030d34d5cf1d61ef8cba28c405ab Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 23 Mar 2024 01:42:45 +0200 Subject: [PATCH 13/23] getdns: fix Windows build --- recipes/getdns/all/conandata.yml | 4 + .../all/patches/1.7.3-fix-windows-build.patch | 121 ++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 recipes/getdns/all/patches/1.7.3-fix-windows-build.patch diff --git a/recipes/getdns/all/conandata.yml b/recipes/getdns/all/conandata.yml index 0bfac9e78cd80..a97e641f541f4 100644 --- a/recipes/getdns/all/conandata.yml +++ b/recipes/getdns/all/conandata.yml @@ -5,3 +5,7 @@ sources: patches: "1.7.3": - patch_file: "patches/1.6.0-0002-fix-exports-extension-libraries.patch" + - patch_file: "patches/1.7.3-fix-windows-build.patch" + patch_description: "Fix Windows build" + patch_source: "https://github.com/getdnsapi/getdns/pull/538" + patch_type: "portability" diff --git a/recipes/getdns/all/patches/1.7.3-fix-windows-build.patch b/recipes/getdns/all/patches/1.7.3-fix-windows-build.patch new file mode 100644 index 0000000000000..dc0f91e105f96 --- /dev/null +++ b/recipes/getdns/all/patches/1.7.3-fix-windows-build.patch @@ -0,0 +1,121 @@ +From bfd53d3cc3afbf199fa27f74bf4b35c1ad955c2e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rados=C5=82aw=20Szkodzi=C5=84ski?= +Date: Tue, 3 Jan 2023 14:14:07 +0100 +Subject: [PATCH] Fix Windows build + +Fixes all found instances of missing APIs and headers on Windows. +--- + src/anchor.c | 12 ++++++++++++ + src/compat/mkstemp.c | 6 +++--- + src/gldns/parse.c | 2 +- + src/gldns/parseutil.c | 2 ++ + src/stub.c | 5 +++++ + 5 files changed, 23 insertions(+), 4 deletions(-) + +diff --git a/src/anchor.c b/src/anchor.c +index f50c4a3d1..fc357b649 100644 +--- a/src/anchor.c ++++ b/src/anchor.c +@@ -551,7 +551,11 @@ static void tas_rinse(getdns_context *context, tas_connection *a) + GETDNS_CLEAR_EVENT(a->loop, &a->event); + a->event.ev = NULL; + if (a->fd >= 0) ++#ifdef USE_WINSOCK ++ closesocket(a->fd); ++#else + close(a->fd); ++#endif + a->fd = -1; + if (a->xml.data) + GETDNS_FREE(context->mf, a->xml.data); +@@ -662,7 +666,11 @@ static void tas_reconnect_cb(void *userarg) + , "Waiting for second document timeout. Reconnecting...\n"); + + GETDNS_CLEAR_EVENT(a->loop, &a->event); ++#ifdef USE_WINSOCK ++ closesocket(a->fd); ++#else + close(a->fd); ++#endif + a->fd = -1; + if (a->state == TAS_READ_PS7_HDR) { + a->state = TAS_RETRY; +@@ -778,7 +786,11 @@ static void tas_read_cb(void *userarg) + if (n == 0) { + DEBUG_ANCHOR("Connection closed\n"); + GETDNS_CLEAR_EVENT(a->loop, &a->event); ++#ifdef USE_WINSOCK ++ closesocket(a->fd); ++#else + close(a->fd); ++#endif + a->fd = -1; + if (a->state == TAS_READ_PS7_HDR) { + a->state = TAS_RETRY; +diff --git a/src/compat/mkstemp.c b/src/compat/mkstemp.c +index 49d3e919a..86d1dfd67 100644 +--- a/src/compat/mkstemp.c ++++ b/src/compat/mkstemp.c +@@ -30,14 +30,14 @@ + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +-#include +-#include + #include ++#include + #include ++#include + + int mkstemp(char *template) + { + if (_mktemp_s(template, strlen(template) + 1) != 0) + return -1; +- return open(template, _O_CREAT | _O_EXCL | _O_RDWR, _S_IWRITE | _S_IREAD); ++ return _open(template, _O_CREAT | _O_EXCL | _O_RDWR, _S_IWRITE | _S_IREAD); + } +diff --git a/src/gldns/parse.c b/src/gldns/parse.c +index 367fa80f3..c107c0df9 100644 +--- a/src/gldns/parse.c ++++ b/src/gldns/parse.c +@@ -13,7 +13,7 @@ + #include "gldns/gbuffer.h" + + #include +-#include ++#include + + gldns_lookup_table gldns_directive_types[] = { + { GLDNS_DIR_TTL, "$TTL" }, +diff --git a/src/gldns/parseutil.c b/src/gldns/parseutil.c +index 293496a90..1e4367898 100644 +--- a/src/gldns/parseutil.c ++++ b/src/gldns/parseutil.c +@@ -14,7 +14,9 @@ + + #include "config.h" + #include "gldns/parseutil.h" ++#ifdef HAVE_SYS_TIME_H + #include ++#endif + #include + #include + +diff --git a/src/stub.c b/src/stub.c +index ee3193126..ab393885d 100644 +--- a/src/stub.c ++++ b/src/stub.c +@@ -903,8 +903,13 @@ stub_tcp_write(int fd, getdns_tcp_state *tcp, getdns_network_req *netreq) + just fall back to a 'normal' write. */ + if (written == -1 + && _getdns_socketerror() == _getdns_EISCONN) ++#ifdef USE_WINSOCK ++ written = send(fd, (const char *)(netreq->query - 2) ++ , pkt_len + 2, 0); ++#else + written = write(fd, netreq->query - 2 + , pkt_len + 2); ++#endif + } else + written = send(fd, (const char *)(netreq->query - 2) + , pkt_len + 2, 0); From 43b3fc80f8d190e62e0590a480b848d3b65967d8 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Thu, 5 Sep 2024 09:40:24 +0200 Subject: [PATCH 14/23] Use CMAKE_PROJECT_INCLUDE Signed-off-by: Uilian Ries --- .../getdns/all/{CMakeLists.txt => conan_deps.cmake} | 11 ----------- recipes/getdns/all/conanfile.py | 10 +++------- 2 files changed, 3 insertions(+), 18 deletions(-) rename recipes/getdns/all/{CMakeLists.txt => conan_deps.cmake} (80%) diff --git a/recipes/getdns/all/CMakeLists.txt b/recipes/getdns/all/conan_deps.cmake similarity index 80% rename from recipes/getdns/all/CMakeLists.txt rename to recipes/getdns/all/conan_deps.cmake index bbdb403da0a9a..92f81138ba21b 100644 --- a/recipes/getdns/all/CMakeLists.txt +++ b/recipes/getdns/all/conan_deps.cmake @@ -34,14 +34,3 @@ if(USE_GNUTLS) custom_find_package(Nettle) add_library(Nettle::Hogweed ALIAS Nettle::Nettle) endif() - -if(WIN32) - link_libraries(ws2_32) -endif() - -add_subdirectory(src) - -if(NOT HAVE_DSA_SIG_SET0) - # This should have been found for OpenSSL from CCI - message(FATAL_ERROR "OpenSSL feature detection failed, probably due to a bug in getdns recipe.") -endif() diff --git a/recipes/getdns/all/conanfile.py b/recipes/getdns/all/conanfile.py index 62d5397901f9b..0a44b31ca165b 100644 --- a/recipes/getdns/all/conanfile.py +++ b/recipes/getdns/all/conanfile.py @@ -43,7 +43,7 @@ class GetDnsConan(ConanFile): def export_sources(self): export_conandata_patches(self) - copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + copy(self, "conan_deps.cmake", src=self.recipe_folder, dst=os.path.join(self.export_sources_folder, "src")) def config_options(self): if self.settings.os == "Windows": @@ -90,6 +90,7 @@ def generate(self): VirtualBuildEnv(self).generate() tc = CMakeToolchain(self) + tc.variables["CMAKE_PROJECT_getdns_INCLUDE"] = "conan_deps.cmake" tc.variables["OPENSSL_USE_STATIC_LIBS"] = not self.dependencies["openssl"].options.shared tc.variables["ENABLE_SHARED"] = self.options.shared tc.variables["ENABLE_STATIC"] = not self.options.shared @@ -129,12 +130,7 @@ def _patch_sources(self): def build(self): self._patch_sources() cmake = CMake(self) - try: - cmake.configure(build_script_folder=self.source_path.parent) - except ConanException: - log = load(self, os.path.join(self.build_folder, "CMakeFiles/CMakeConfigureLog.yaml")) - self.output.error(log) - raise + cmake.configure() cmake.build() def package(self): From 6ed7302132022e48da9c527a4fd541d8c69aa4ba Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Thu, 5 Sep 2024 09:59:22 +0200 Subject: [PATCH 15/23] Avoid capturing network on test package Signed-off-by: Uilian Ries --- .../getdns/all/test_package/test_package.c | 24 ++++--------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/recipes/getdns/all/test_package/test_package.c b/recipes/getdns/all/test_package/test_package.c index c55c14f559026..b60140d92b44b 100644 --- a/recipes/getdns/all/test_package/test_package.c +++ b/recipes/getdns/all/test_package/test_package.c @@ -1,26 +1,10 @@ #include "getdns.h" -#include #include -#define CHECK(V) if ((V) != GETDNS_RETURN_GOOD) { \ - fprintf(stderr, "Fail: " #V "!\n"); \ - return 1; \ -} - -int main() -{ - getdns_context *context; - CHECK(getdns_context_create(&context, 1)); - getdns_dict *info = getdns_context_get_api_information(context); - if (info == NULL) { - fprintf(stderr, "Could not get api information\n"); - return 1; - } - char *txt = getdns_pretty_print_dict(info); - printf("%s\n", txt); - free(txt); - getdns_dict_destroy(info); +int main() { + getdns_context *context = NULL; + getdns_context_create(&context, 0); getdns_context_destroy(context); - return 0; + return EXIT_SUCCESS; } From 163e9337d6a13ca3c308e62529922632710629e2 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Thu, 5 Sep 2024 10:27:00 +0200 Subject: [PATCH 16/23] Remove option for gnutls Signed-off-by: Uilian Ries --- recipes/getdns/all/conan_deps.cmake | 7 ------- recipes/getdns/all/conanfile.py | 14 ++------------ 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/recipes/getdns/all/conan_deps.cmake b/recipes/getdns/all/conan_deps.cmake index 92f81138ba21b..0925ccf84a265 100644 --- a/recipes/getdns/all/conan_deps.cmake +++ b/recipes/getdns/all/conan_deps.cmake @@ -27,10 +27,3 @@ endif() if(USE_LIBIDN2) custom_find_package(Libidn2) endif() -if(USE_GNUTLS) - # FIXME: GnuTLS and Nettle should package individual components correctly - custom_find_package(GnuTLS) - add_library(GnuTLS::Dane ALIAS GnuTLS::GnuTLS) - custom_find_package(Nettle) - add_library(Nettle::Hogweed ALIAS Nettle::Nettle) -endif() diff --git a/recipes/getdns/all/conanfile.py b/recipes/getdns/all/conanfile.py index 0a44b31ca165b..4613f4fad1620 100644 --- a/recipes/getdns/all/conanfile.py +++ b/recipes/getdns/all/conanfile.py @@ -23,7 +23,6 @@ class GetDnsConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], - "tls": ["openssl", "gnutls"], "stub_only": ["auto", True, False], "with_libev": ["auto", True, False], "with_libevent": [True, False], @@ -34,7 +33,6 @@ class GetDnsConan(ConanFile): "shared": False, "fPIC": True, "stub_only": "auto", - "tls": "openssl", "with_libev": "auto", "with_libevent": True, "with_libuv": True, @@ -69,13 +67,9 @@ def requirements(self): if self.options.with_libevent: self.requires("libevent/2.1.12") if self.options.with_libuv: - self.requires("libuv/1.47.0") + self.requires("libuv/1.48.0") if self.options.with_libidn2: self.requires("libidn2/2.3.0") - if self.options.tls == "gnutls": - self.requires("gnutls/3.7.8") - self.requires("nettle/3.8.1") - raise ConanInvalidConfiguration("gnutls on CCI does not build the required libdane component") if not self.options.stub_only: # FIXME: missing libunbound recipe raise ConanInvalidConfiguration("libunbound is not (yet) available on cci") @@ -99,7 +93,7 @@ def generate(self): tc.variables["BUILD_LIBEVENT2"] = self.options.with_libevent tc.variables["BUILD_LIBUV"] = self.options.with_libuv tc.variables["USE_LIBIDN2"] = self.options.with_libidn2 - tc.variables["USE_GNUTLS"] = self.options.tls == "gnutls" + tc.variables["USE_GNUTLS"] = False # Force use of internal strptime when cross-compiling tc.variables["FORCE_COMPAT_STRPTIME"] = True tc.variables["BUILD_TESTING"] = False @@ -109,8 +103,6 @@ def generate(self): tc.generate() deps = CMakeDeps(self) - deps.set_property("gnutls", "cmake_file_name", "GnuTLS") - deps.set_property("gnutls", "cmake_target_name", "GnuTLS::GnuTLS") deps.set_property("libev", "cmake_file_name", "Libev") deps.set_property("libev", "cmake_target_name", "Libev::Libev") deps.set_property("libevent", "cmake_file_name", "Libevent2") @@ -153,8 +145,6 @@ def package_info(self): self.cpp_info.components["libgetdns"].requires = ["openssl::openssl"] if self.options.with_libidn2: self.cpp_info.components["libgetdns"].requires.append("libidn2::libidn2") - if self.options.tls == "gnutls": - self.cpp_info.components["libgetdns"].requires.extend(["nettle::nettle", "gnutls::gnutls"]) if self.settings.os == "Windows": self.cpp_info.components["libgetdns"].system_libs.extend(["ws2_32", "crypt32", "gdi32", "iphlpapi", "psapi", "userenv"]) From c4d999bf61bfe07a9539b6a9148d3dc18755665a Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Thu, 5 Sep 2024 10:42:08 +0200 Subject: [PATCH 17/23] Remove stub option Signed-off-by: Uilian Ries --- recipes/getdns/all/conanfile.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/recipes/getdns/all/conanfile.py b/recipes/getdns/all/conanfile.py index 4613f4fad1620..1885bdabe2031 100644 --- a/recipes/getdns/all/conanfile.py +++ b/recipes/getdns/all/conanfile.py @@ -23,8 +23,7 @@ class GetDnsConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], - "stub_only": ["auto", True, False], - "with_libev": ["auto", True, False], + "with_libev": [True, False], "with_libevent": [True, False], "with_libuv": [True, False], "with_libidn2": [True, False], @@ -32,8 +31,7 @@ class GetDnsConan(ConanFile): default_options = { "shared": False, "fPIC": True, - "stub_only": "auto", - "with_libev": "auto", + "with_libev": True, "with_libevent": True, "with_libuv": True, "with_libidn2": False, # FIXME: enable once libidn2 has been migrated https://github.com/conan-io/conan-center-index/pull/18642 @@ -47,9 +45,6 @@ def config_options(self): if self.settings.os == "Windows": del self.options.fPIC self.options.with_libev = True - # FIXME: uncomment once libunbound is available - # self.options.stub_only = self.settings.os != "Windows" - # self.options.with_libev = self.settings.os == "Windows" def configure(self): if self.options.shared: @@ -70,9 +65,6 @@ def requirements(self): self.requires("libuv/1.48.0") if self.options.with_libidn2: self.requires("libidn2/2.3.0") - if not self.options.stub_only: - # FIXME: missing libunbound recipe - raise ConanInvalidConfiguration("libunbound is not (yet) available on cci") def build_requirements(self): self.tool_requires("cmake/[>=3.20 <4]") @@ -88,7 +80,7 @@ def generate(self): tc.variables["OPENSSL_USE_STATIC_LIBS"] = not self.dependencies["openssl"].options.shared tc.variables["ENABLE_SHARED"] = self.options.shared tc.variables["ENABLE_STATIC"] = not self.options.shared - tc.variables["ENABLE_STUB_ONLY"] = self.options.stub_only + tc.variables["ENABLE_STUB_ONLY"] = True tc.variables["BUILD_LIBEV"] = self.options.with_libev tc.variables["BUILD_LIBEVENT2"] = self.options.with_libevent tc.variables["BUILD_LIBUV"] = self.options.with_libuv From 53c2c75f0f9d8873a19fccd75ac97e7ec163e5e6 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Thu, 5 Sep 2024 11:20:51 +0200 Subject: [PATCH 18/23] Enable libidn2 by default Signed-off-by: Uilian Ries --- recipes/getdns/all/conanfile.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/recipes/getdns/all/conanfile.py b/recipes/getdns/all/conanfile.py index 1885bdabe2031..5e3dae8977ee0 100644 --- a/recipes/getdns/all/conanfile.py +++ b/recipes/getdns/all/conanfile.py @@ -1,10 +1,9 @@ import os from conan import ConanFile -from conan.errors import ConanInvalidConfiguration, ConanException from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.env import VirtualBuildEnv -from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, rm, load +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, rm from conan.tools.microsoft import is_msvc required_conan_version = ">=1.53.0" @@ -34,7 +33,7 @@ class GetDnsConan(ConanFile): "with_libev": True, "with_libevent": True, "with_libuv": True, - "with_libidn2": False, # FIXME: enable once libidn2 has been migrated https://github.com/conan-io/conan-center-index/pull/18642 + "with_libidn2": True } def export_sources(self): @@ -44,7 +43,6 @@ def export_sources(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - self.options.with_libev = True def configure(self): if self.options.shared: @@ -80,11 +78,13 @@ def generate(self): tc.variables["OPENSSL_USE_STATIC_LIBS"] = not self.dependencies["openssl"].options.shared tc.variables["ENABLE_SHARED"] = self.options.shared tc.variables["ENABLE_STATIC"] = not self.options.shared + # INFO: Disabling stub-only requires libunbound tc.variables["ENABLE_STUB_ONLY"] = True tc.variables["BUILD_LIBEV"] = self.options.with_libev tc.variables["BUILD_LIBEVENT2"] = self.options.with_libevent tc.variables["BUILD_LIBUV"] = self.options.with_libuv tc.variables["USE_LIBIDN2"] = self.options.with_libidn2 + # INFO: GnuTLS requires libdane support and is not supported by MSVC tc.variables["USE_GNUTLS"] = False # Force use of internal strptime when cross-compiling tc.variables["FORCE_COMPAT_STRPTIME"] = True @@ -103,8 +103,6 @@ def generate(self): deps.set_property("libidn2", "cmake_target_name", "Libidn2::Libidn2") deps.set_property("libuv", "cmake_file_name", "Libuv") deps.set_property("libuv", "cmake_target_name", "Libuv::Libuv") - deps.set_property("nettle", "cmake_file_name", "Nettle") - deps.set_property("nettle", "cmake_target_name", "Nettle::Nettle") deps.generate() def _patch_sources(self): @@ -155,5 +153,6 @@ def package_info(self): self.cpp_info.components["dns_ext_uv"].requires = ["libgetdns", "libuv::libuv"] self.cpp_info.components["dns_ext_uv"].set_property("pkg_config_name", "getdns_ext_uv") + # TODO: Remove after dropping support for Conan 1.x in ConanCenterIndex bin_path = os.path.join(self.package_folder, "bin") self.env_info.PATH.append(bin_path) From 577421bde906955503ae61f822df01b4de5dca46 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Thu, 5 Sep 2024 13:38:18 +0200 Subject: [PATCH 19/23] ignore incompatible pointer type Signed-off-by: Uilian Ries --- recipes/getdns/all/conanfile.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes/getdns/all/conanfile.py b/recipes/getdns/all/conanfile.py index 5e3dae8977ee0..1219112306314 100644 --- a/recipes/getdns/all/conanfile.py +++ b/recipes/getdns/all/conanfile.py @@ -91,7 +91,9 @@ def generate(self): tc.variables["BUILD_TESTING"] = False # To fix OpenSSL try_compile() checks # https://github.com/conan-io/conan/issues/12180 - tc.variables["CMAKE_TRY_COMPILE_CONFIGURATION"] = self.settings.build_type + tc.variables["CMAKE_TRY_COMPILE_CONFIGURATION"] = str(self.settings.build_type) + # INFO: https://github.com/getdnsapi/getdns/issues/544 + tc.extra_cflags.append("-Wno-error=incompatible-function-pointer-types") tc.generate() deps = CMakeDeps(self) From 15f13a4705957757a8d99d5e2fb4b83388b1d8c2 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Thu, 5 Sep 2024 15:12:14 +0200 Subject: [PATCH 20/23] Import libidn2 defines Signed-off-by: Uilian Ries --- recipes/getdns/all/conanfile.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/recipes/getdns/all/conanfile.py b/recipes/getdns/all/conanfile.py index 1219112306314..155858bba0c11 100644 --- a/recipes/getdns/all/conanfile.py +++ b/recipes/getdns/all/conanfile.py @@ -92,8 +92,12 @@ def generate(self): # To fix OpenSSL try_compile() checks # https://github.com/conan-io/conan/issues/12180 tc.variables["CMAKE_TRY_COMPILE_CONFIGURATION"] = str(self.settings.build_type) - # INFO: https://github.com/getdnsapi/getdns/issues/544 - tc.extra_cflags.append("-Wno-error=incompatible-function-pointer-types") + if self.settings.compiler in ["clang", "apple-clang"]: + # INFO: https://github.com/getdnsapi/getdns/issues/544 + tc.extra_cflags.append("-Wno-error=incompatible-function-pointer-types") + if self.options.with_libidn2 and is_msvc(self): + # INFO: getdns_static.lib(convert.c.obj): error LNK2019: unresolved external symbol __imp_idn2_lookup_u8 + tc.extra_cflags.extend([f"/D{it}" for it in self.dependencies["libidn2"].cpp_info.defines]) tc.generate() deps = CMakeDeps(self) @@ -130,7 +134,6 @@ def package_info(self): libsuffix = "" if is_msvc(self) and not self.options.shared: libsuffix = "_static" - self.cpp_info.components["libgetdns"].libs = ["getdns" + libsuffix] self.cpp_info.components["libgetdns"].includedirs.append(os.path.join("include", "getdns")) self.cpp_info.components["libgetdns"].set_property("pkg_config_name", "getdns") From 6b548ee899808aaca18f93cca7c72ce480906faf Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Fri, 6 Sep 2024 08:19:23 +0200 Subject: [PATCH 21/23] Make CMaktoolchain compatible to Conan 1.x Signed-off-by: Uilian Ries --- recipes/getdns/all/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/getdns/all/conanfile.py b/recipes/getdns/all/conanfile.py index 155858bba0c11..9c9efe2c53106 100644 --- a/recipes/getdns/all/conanfile.py +++ b/recipes/getdns/all/conanfile.py @@ -94,10 +94,10 @@ def generate(self): tc.variables["CMAKE_TRY_COMPILE_CONFIGURATION"] = str(self.settings.build_type) if self.settings.compiler in ["clang", "apple-clang"]: # INFO: https://github.com/getdnsapi/getdns/issues/544 - tc.extra_cflags.append("-Wno-error=incompatible-function-pointer-types") + tc.blocks["cmake_flags_init"].template += '\nstring(APPEND CMAKE_C_FLAGS_INIT " -Wno-incompatible-function-pointer-types")' if self.options.with_libidn2 and is_msvc(self): # INFO: getdns_static.lib(convert.c.obj): error LNK2019: unresolved external symbol __imp_idn2_lookup_u8 - tc.extra_cflags.extend([f"/D{it}" for it in self.dependencies["libidn2"].cpp_info.defines]) + tc.preprocessor_definitions.extend(self.dependencies["libidn2"].cpp_info.defines) tc.generate() deps = CMakeDeps(self) From 2d4af44ad1926651e99cb7086e1e6faa47245fa9 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Fri, 6 Sep 2024 09:20:32 +0200 Subject: [PATCH 22/23] Inject libidn2 defines to executables Signed-off-by: Uilian Ries --- recipes/getdns/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/getdns/all/conanfile.py b/recipes/getdns/all/conanfile.py index 9c9efe2c53106..a7033ac340569 100644 --- a/recipes/getdns/all/conanfile.py +++ b/recipes/getdns/all/conanfile.py @@ -97,7 +97,7 @@ def generate(self): tc.blocks["cmake_flags_init"].template += '\nstring(APPEND CMAKE_C_FLAGS_INIT " -Wno-incompatible-function-pointer-types")' if self.options.with_libidn2 and is_msvc(self): # INFO: getdns_static.lib(convert.c.obj): error LNK2019: unresolved external symbol __imp_idn2_lookup_u8 - tc.preprocessor_definitions.extend(self.dependencies["libidn2"].cpp_info.defines) + tc.preprocessor_definitions.update({it: 1 for it in self.dependencies["libidn2"].cpp_info.defines}) tc.generate() deps = CMakeDeps(self) From 6092f1d143ca2e1f14dcbd1e6cb012cd9434e0d7 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Fri, 6 Sep 2024 11:01:05 +0200 Subject: [PATCH 23/23] Add todo comment for future refactor Signed-off-by: Uilian Ries --- recipes/getdns/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/getdns/all/conanfile.py b/recipes/getdns/all/conanfile.py index a7033ac340569..33e5e1ab9e6c1 100644 --- a/recipes/getdns/all/conanfile.py +++ b/recipes/getdns/all/conanfile.py @@ -94,6 +94,7 @@ def generate(self): tc.variables["CMAKE_TRY_COMPILE_CONFIGURATION"] = str(self.settings.build_type) if self.settings.compiler in ["clang", "apple-clang"]: # INFO: https://github.com/getdnsapi/getdns/issues/544 + # TODO: Change to extra_clfags when CCI only uses Conan 2.x tc.blocks["cmake_flags_init"].template += '\nstring(APPEND CMAKE_C_FLAGS_INIT " -Wno-incompatible-function-pointer-types")' if self.options.with_libidn2 and is_msvc(self): # INFO: getdns_static.lib(convert.c.obj): error LNK2019: unresolved external symbol __imp_idn2_lookup_u8