Skip to content

Commit

Permalink
patch 2.0.0; seems to build
Browse files Browse the repository at this point in the history
  • Loading branch information
andiwand committed May 24, 2024
1 parent 84d39f2 commit 7202c27
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 4 deletions.
4 changes: 4 additions & 0 deletions recipes/odrcore/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
41 changes: 37 additions & 4 deletions recipes/odrcore/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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")
Expand All @@ -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()
Expand Down
13 changes: 13 additions & 0 deletions recipes/odrcore/all/patches/2.0.0-0001-fix-cmake.patch
Original file line number Diff line number Diff line change
@@ -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(

0 comments on commit 7202c27

Please sign in to comment.