diff --git a/recipes/c-ares/all/conandata.yml b/recipes/c-ares/all/conandata.yml index 2d836b89cc47b..6374181280d1b 100644 --- a/recipes/c-ares/all/conandata.yml +++ b/recipes/c-ares/all/conandata.yml @@ -11,3 +11,18 @@ sources: "1.14.0": sha256: 62dd12f0557918f89ad6f5b759f0bf4727174ae9979499f5452c02be38d9d3e8 url: https://github.com/c-ares/c-ares/archive/cares-1_14_0.tar.gz +patches: + "1.17.1": + - patch_file: "patches/upstream-pr-395-bundle-destination-v16-17.patch" + base_path: "source_subfolder" + "1.16.1": + - patch_file: "patches/upstream-pr-395-bundle-destination-v16-17.patch" + base_path: "source_subfolder" + "1.15.0": + - patch_file: "patches/upstream-pr-395-bundle-destination-v15.patch" + base_path: "source_subfolder" + "1.14.0": + - patch_file: "patches/option-tools.patch" + base_path: "source_subfolder" + - patch_file: "patches/upstream-pr-395-bundle-destination-v14.patch" + base_path: "source_subfolder" diff --git a/recipes/c-ares/all/conanfile.py b/recipes/c-ares/all/conanfile.py index b68fab5f2d3ab..193224cb99d86 100644 --- a/recipes/c-ares/all/conanfile.py +++ b/recipes/c-ares/all/conanfile.py @@ -12,9 +12,17 @@ class CAresConan(ConanFile): topics = ("conan", "c-ares", "dns") homepage = "https://c-ares.haxx.se/" settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - exports_sources = "CMakeLists.txt" + options = { + "shared": [True, False], + "fPIC": [True, False], + "tools": [True, False] + } + default_options = { + "shared": False, + "fPIC": True, + "tools": True + } + exports_sources = ["CMakeLists.txt", "patches/*"] generators = "cmake" _cmake = None @@ -47,12 +55,15 @@ def _cmake_configure(self): self._cmake = CMake(self) self._cmake.definitions["CARES_STATIC"] = not self.options.shared self._cmake.definitions["CARES_SHARED"] = self.options.shared - self._cmake.definitions["CARES_BUILD_TESTS"] = "OFF" - self._cmake.definitions["CARES_MSVC_STATIC_RUNTIME"] = "OFF" + self._cmake.definitions["CARES_BUILD_TESTS"] = False + self._cmake.definitions["CARES_MSVC_STATIC_RUNTIME"] = False + self._cmake.definitions["CARES_BUILD_TOOLS"] = self.options.tools self._cmake.configure(build_folder=self._build_subfolder) return self._cmake def build(self): + for patch in self.conan_data.get("patches", {}).get(self.version, []): + tools.patch(**patch) cmake = self._cmake_configure() cmake.build() @@ -77,9 +88,10 @@ def package_info(self): self.cpp_info.components["cares"].system_libs.append("rt") elif self.settings.os == "Windows": self.cpp_info.components["cares"].system_libs.extend(["ws2_32", "Advapi32"]) - elif self.settings.os == "Macos": + elif tools.is_apple_os(self.settings.os): self.cpp_info.components["cares"].system_libs.append("resolv") - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + if self.options.tools: + bin_path = os.path.join(self.package_folder, "bin") + self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.env_info.PATH.append(bin_path) diff --git a/recipes/c-ares/all/patches/option-tools.patch b/recipes/c-ares/all/patches/option-tools.patch new file mode 100644 index 0000000000000..650eca0948612 --- /dev/null +++ b/recipes/c-ares/all/patches/option-tools.patch @@ -0,0 +1,16 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -670,6 +670,8 @@ SET (CARES_FOUND 1 CACHE INTERNAL "CARES LIBRARY FOUND") + SET (CARES_LIBRARIES ${PROJECT_NAME}::cares CACHE INTERNAL "CARES LIBRARIES") + + ++OPTION (CARES_BUILD_TOOLS "Build tools" ON) ++IF(CARES_BUILD_TOOLS) + # Build ahost + ADD_EXECUTABLE (ahost ahost.c ${SAMPLESOURCES}) + TARGET_COMPILE_DEFINITIONS (ahost PRIVATE HAVE_CONFIG_H=1) +@@ -695,3 +697,4 @@ TARGET_LINK_LIBRARIES (acountry PRIVATE ${PROJECT_NAME}) + IF (CARES_INSTALL) + INSTALL (TARGETS acountry ${TARGETS_INST_DEST}) + ENDIF () ++ENDIF() diff --git a/recipes/c-ares/all/patches/upstream-pr-395-bundle-destination-v14.patch b/recipes/c-ares/all/patches/upstream-pr-395-bundle-destination-v14.patch new file mode 100644 index 0000000000000..14536414d1c00 --- /dev/null +++ b/recipes/c-ares/all/patches/upstream-pr-395-bundle-destination-v14.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -65,6 +65,7 @@ SET (PACKAGE_DIRECTORY ${PROJECT_BINARY_DIR}/package) + # Destinations for installing different kinds of targets (pass to install command). + SET (TARGETS_INST_DEST + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} diff --git a/recipes/c-ares/all/patches/upstream-pr-395-bundle-destination-v15.patch b/recipes/c-ares/all/patches/upstream-pr-395-bundle-destination-v15.patch new file mode 100644 index 0000000000000..5049967cdd9a6 --- /dev/null +++ b/recipes/c-ares/all/patches/upstream-pr-395-bundle-destination-v15.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -66,6 +66,7 @@ SET (PACKAGE_DIRECTORY ${PROJECT_BINARY_DIR}/package) + # Destinations for installing different kinds of targets (pass to install command). + SET (TARGETS_INST_DEST + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} diff --git a/recipes/c-ares/all/patches/upstream-pr-395-bundle-destination-v16-17.patch b/recipes/c-ares/all/patches/upstream-pr-395-bundle-destination-v16-17.patch new file mode 100644 index 0000000000000..ca07d535842b0 --- /dev/null +++ b/recipes/c-ares/all/patches/upstream-pr-395-bundle-destination-v16-17.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -74,6 +74,7 @@ SET (PACKAGE_DIRECTORY ${PROJECT_BINARY_DIR}/package) + # Destinations for installing different kinds of targets (pass to install command). + SET (TARGETS_INST_DEST + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + )