From 74fe7eb8b0acea9d9b9bb10bb24f3cc43d359dc5 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Tue, 11 Feb 2020 11:17:49 -0300 Subject: [PATCH] Use external patch for geos Signed-off-by: Uilian Ries --- recipes/geos/all/conandata.yml | 4 ++ recipes/geos/all/conanfile.py | 17 ++----- recipes/geos/all/patches/0001-cmake.patch | 57 +++++++++++++++++++++++ 3 files changed, 65 insertions(+), 13 deletions(-) create mode 100644 recipes/geos/all/patches/0001-cmake.patch diff --git a/recipes/geos/all/conandata.yml b/recipes/geos/all/conandata.yml index 954218904995c..0ca6b34e0ef86 100644 --- a/recipes/geos/all/conandata.yml +++ b/recipes/geos/all/conandata.yml @@ -2,3 +2,7 @@ sources: "3.8.0": url: "https://git.osgeo.org/gitea/geos/geos/archive/3.8.0.tar.gz" sha256: "90e2ea9db689f5ca8c0bd61e671ac47c749e85998a867b777c3ded8a6399a695" +patches: + "3.8.0": + base_path: "source_subfolder" + patch_file: "patches/0001-cmake.patch" diff --git a/recipes/geos/all/conanfile.py b/recipes/geos/all/conanfile.py index 5f2820543c46b..7de4d2b275af5 100644 --- a/recipes/geos/all/conanfile.py +++ b/recipes/geos/all/conanfile.py @@ -9,7 +9,7 @@ class GeosConan(ConanFile): topics = ("conan", "geos", "osgeo", "geometry", "topology", "geospatial") homepage = "https://trac.osgeo.org/geos" url = "https://github.com/conan-io/conan-center-index" - exports_sources = "CMakeLists.txt" + exports_sources = ["CMakeLists.txt", "patches/*"] generators = "cmake" settings = "os", "arch", "compiler", "build_type" options = { @@ -22,7 +22,6 @@ class GeosConan(ConanFile): "fPIC": True, "inline": True } - _cmake = None @property @@ -42,20 +41,10 @@ def source(self): os.rename(self.name, self._source_subfolder) def build(self): - self._patch_sources() + tools.patch(**self.conan_data["patches"][self.version]) cmake = self._configure_cmake() cmake.build() - def _patch_sources(self): - cmakelists_path = os.path.join(self._source_subfolder, "CMakeLists.txt") - tools.replace_in_file(cmakelists_path, "cmake_minimum_required(VERSION 3.13 FATAL_ERROR)", "") - tools.replace_in_file(cmakelists_path, "add_subdirectory(benchmarks)", "") - tools.replace_in_file(cmakelists_path, "add_subdirectory(doc)", "") - tools.replace_in_file(cmakelists_path, "LIBRARY DESTINATION lib NAMELINK_SKIP", "LIBRARY DESTINATION lib") - tools.replace_in_file(cmakelists_path, "add_subdirectory(tools)", "") - tools.replace_in_file(cmakelists_path, "find_package(MakeDistCheck)", "") - tools.replace_in_file(cmakelists_path, "AddMakeDistCheck()", "") - def _configure_cmake(self): if self._cmake: return self._cmake @@ -76,6 +65,8 @@ def package(self): def package_info(self): self.cpp_info.libs = ["geos_c", "geos"] + if self.settings.os == "Linux": + self.cpp_info.system_libs = ["m"] if self.options.inline: self.cpp_info.defines.append("GEOS_INLINE") self.cpp_info.names["cmake_find_package"] = "GEOS" diff --git a/recipes/geos/all/patches/0001-cmake.patch b/recipes/geos/all/patches/0001-cmake.patch new file mode 100644 index 0000000000000..c19a21c93725c --- /dev/null +++ b/recipes/geos/all/patches/0001-cmake.patch @@ -0,0 +1,57 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c893fea..f248cc1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -19,7 +19,7 @@ set(DEFAULT_BUILD_TYPE Release) + # Require CMake 3.13+ with VS generator for complete support of VS versions + # and support by AppVeyor. + if(${CMAKE_GENERATOR} MATCHES "Visual Studio") +- cmake_minimum_required(VERSION 3.13 FATAL_ERROR) ++ + endif() + + list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") +@@ -259,12 +259,12 @@ endif() + #----------------------------------------------------------------------------- + # Benchmarks + #----------------------------------------------------------------------------- +-add_subdirectory(benchmarks) ++ + + #----------------------------------------------------------------------------- + # Documentation/Examples + #----------------------------------------------------------------------------- +-add_subdirectory(doc) ++ + + #----------------------------------------------------------------------------- + # Install and export targets - support 'make install' or equivalent +@@ -281,7 +281,7 @@ configure_file(cmake/geos-config.cmake + + install(TARGETS geos geos_cxx_flags + EXPORT geos-targets +- LIBRARY DESTINATION lib NAMELINK_SKIP ++ LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + INCLUDES DESTINATION include +@@ -312,7 +312,7 @@ install(DIRECTORY + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/capi/geos_c.h" + DESTINATION include) + +-add_subdirectory(tools) ++ + + #----------------------------------------------------------------------------- + # Uninstall +@@ -372,8 +372,8 @@ add_custom_target(check COMMAND ${CMAKE_BUILD_TOOL} test) + # "make distcheck" workalike + #----------------------------------------------------------------------------- + if(NOT _is_multi_config_generator) +- find_package(MakeDistCheck) +- AddMakeDistCheck() ++ ++ + message(STATUS "GEOS: Configured 'distcheck' target") + endif() +