From 7202c27fddc21b38da81725911f12aea48cedf70 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Fri, 24 May 2024 09:21:11 +0200 Subject: [PATCH] patch 2.0.0; seems to build --- recipes/odrcore/all/conandata.yml | 4 ++ recipes/odrcore/all/conanfile.py | 41 +++++++++++++++++-- .../all/patches/2.0.0-0001-fix-cmake.patch | 13 ++++++ 3 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 recipes/odrcore/all/patches/2.0.0-0001-fix-cmake.patch diff --git a/recipes/odrcore/all/conandata.yml b/recipes/odrcore/all/conandata.yml index 380478b..f65daef 100644 --- a/recipes/odrcore/all/conandata.yml +++ b/recipes/odrcore/all/conandata.yml @@ -32,3 +32,7 @@ sources: url: "https://github.com/opendocument-app/OpenDocument.core/archive/refs/tags/v4.0.0.tar.gz" sha256: "b2d671f34bf641d465dfaae9adefdcb4a6210d58a519594a182ba2839531435e" patches: + "2.0.0": + - patch_file: "patches/2.0.0-0001-fix-cmake.patch" + patch_description: "Fix broken dependencies in CMakeLists.txt" + patch_type: "conan" diff --git a/recipes/odrcore/all/conanfile.py b/recipes/odrcore/all/conanfile.py index 9b858f3..6fb26b8 100644 --- a/recipes/odrcore/all/conanfile.py +++ b/recipes/odrcore/all/conanfile.py @@ -2,14 +2,17 @@ from conan import ConanFile from conan.tools.build import check_min_cppstd from conan.tools.files import copy -from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake +from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout +from conan.tools.files import ( + apply_conandata_patches, export_conandata_patches, get, copy +) +from conan.tools.scm import Version class OpenDocumentCoreConan(ConanFile): name = "odrcore" - version = "" - url = "" - homepage = "https://github.com/opendocument-app/OpenDocument.core" + url = "https://github.com/opendocument-app/OpenDocument.core" + homepage = "https://opendocument.app/" description = "C++ library that translates office documents to HTML" topics = "open document", "openoffice xml", "open document reader" license = "GPL 3.0" @@ -26,7 +29,24 @@ class OpenDocumentCoreConan(ConanFile): exports_sources = ["cli/*", "cmake/*", "src/*", "CMakeLists.txt"] + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): + if Version(self.version) <= "2.0.0": + return + self.requires("pugixml/1.14") self.requires("cryptopp/8.8.0") self.requires("miniz/3.0.2") @@ -36,23 +56,36 @@ def requirements(self): self.requires("utfcpp/4.0.4") def build_requirements(self): + if Version(self.version) <= "2.0.0": + return + self.test_requires("gtest/1.14.0") def validate_build(self): if self.settings.get_safe("compiler.cppstd"): check_min_cppstd(self, 17) + def source(self): + get(self, **self.conan_data["sources"][self.version]["source"], strip_root=True) + def generate(self): tc = CMakeToolchain(self) tc.variables["CMAKE_PROJECT_VERSION"] = self.version tc.variables["BUILD_SHARED_LIBS"] = self.options.shared tc.variables["ODR_TEST"] = False + if Version(self.version) < "4.0.0": + tc.variables["CONAN_EXPORTED"] = True tc.generate() deps = CMakeDeps(self) deps.generate() + def _patch_sources(self): + apply_conandata_patches(self) + def build(self): + self._patch_sources() + cmake = CMake(self) cmake.configure() cmake.build() diff --git a/recipes/odrcore/all/patches/2.0.0-0001-fix-cmake.patch b/recipes/odrcore/all/patches/2.0.0-0001-fix-cmake.patch new file mode 100644 index 0000000..06940c8 --- /dev/null +++ b/recipes/odrcore/all/patches/2.0.0-0001-fix-cmake.patch @@ -0,0 +1,13 @@ +diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt +index fd817e1..792f18b 100644 +--- a/3rdparty/CMakeLists.txt ++++ b/3rdparty/CMakeLists.txt +@@ -33,7 +33,7 @@ FetchContent_Declare( + ) + FetchContent_Declare( + uchardet +- GIT_REPOSITORY https://github.com/freedesktop/uchardet.git ++ GIT_REPOSITORY https://gitlab.freedesktop.org/uchardet/uchardet.git + GIT_TAG d7dad54 + ) + FetchContent_Declare( \ No newline at end of file