Skip to content

Commit

Permalink
(#21340) libvault: add 0.59.0
Browse files Browse the repository at this point in the history
* libvault: add 0.59.0

* Fix scm version import

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* Fix libvault patches

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* match the upstream master

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* apply patch on the fly

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* Add hotfix link

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* Drop version 0.48

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* Drop old versions due Windows linkage error

Signed-off-by: Uilian Ries <uilianries@gmail.com>

---------

Signed-off-by: Uilian Ries <uilianries@gmail.com>
Co-authored-by: Uilian Ries <uilianries@gmail.com>
  • Loading branch information
abedra and uilianries authored Apr 23, 2024
1 parent 9284357 commit 8b04335
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 55 deletions.
25 changes: 3 additions & 22 deletions recipes/libvault/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
sources:
"0.52.0":
url: "https://github.com/abedra/libvault/archive/refs/tags/0.52.0.zip"
sha256: 49058ac9a1d3d1d08ac165f5f7b50e3a2a2ab0d3f9b8bb8194fa7a8de36edcf8
"0.51.0":
url: "https://github.com/abedra/libvault/archive/refs/tags/0.51.0.zip"
sha256: 570ccc6451cf8e93b1c585bbf6ab5212ff9290b3a9b477752cf0651414b3d026
"0.48.0":
url: "https://github.com/abedra/libvault/archive/0.48.0.zip"
sha256: 0a42be282ff0aff77b68cb7238014aa762df5c6b62e4d3561878874ca3760489
patches:
"0.52.0":
- patch_file: "patches/0.52.0-0001-fix-cmake.patch"
patch_type: "conan"
patch_description: "use libcurl from conan center"
"0.51.0":
- patch_file: "patches/0.51.0-0001-fix-cmake.patch"
patch_type: "conan"
patch_description: "use libcurl from conan center"
"0.48.0":
- patch_file: "patches/0.48.0-0001-fix-cmake.patch"
patch_type: "conan"
patch_description: "use libcurl from conan center"
"0.59.0":
url: "https://github.com/abedra/libvault/archive/refs/tags/0.59.0.zip"
sha256: 668e71e1689f6142735387989042945e42fd6e0483f223ce3a08121887a335ce
67 changes: 39 additions & 28 deletions recipes/libvault/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
from conan.tools.apple import is_apple_os
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir
from conan.tools.files import copy, get, rmdir, replace_in_file
from conan.tools.microsoft import is_msvc, is_msvc_static_runtime
from conan.tools.scm import Version

required_conan_version = ">=1.54.0"
Expand Down Expand Up @@ -33,8 +34,19 @@ class LibvaultConan(ConanFile):
def _mac_os_minimum_required_version(self):
return "10.15"

def export_sources(self):
export_conandata_patches(self)
@property
def _min_cppstd(self):
return 17

@property
def _compilers_minimum_version(self):
return {
"Visual Studio": "16",
"msvc": "192",
"gcc": "8",
"clang": "7.0",
"apple-clang": "12",
}

def config_options(self):
if self.settings.os == "Windows":
Expand All @@ -49,29 +61,18 @@ def layout(self):

def requirements(self):
# public header VaultClient.h includes curl/curl.h and use several functions
self.requires("libcurl/[>=7.78.0 <9]", transitive_headers=True, transitive_libs=True)
self.requires("libcurl/[>=7.78.0 <9]", transitive_headers=True)

def validate(self):
compiler = str(self.settings.compiler)
compiler_version = Version(self.settings.compiler.version.value)

minimum_compiler_version = {
"Visual Studio": "16",
"msvc": "192",
"gcc": "8",
"clang": "7.0",
"apple-clang": "12",
}

minimum_cpp_standard = 17

if compiler in minimum_compiler_version and \
compiler_version < minimum_compiler_version[compiler]:
if self.settings.compiler.cppstd:
check_min_cppstd(self, self._min_cppstd)
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version and Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
f"{self.name} requires a compiler that supports at least C++{minimum_cpp_standard}. "
f"{compiler} {compiler_version} is not supported.")
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
)

if compiler == "clang" and self.settings.compiler.libcxx in ["libstdc++", "libstdc++11"] and self.settings.compiler.version == "11":
if self.settings.compiler == "clang" and self.settings.compiler.libcxx in ["libstdc++", "libstdc++11"] and self.settings.compiler.version == "11":
raise ConanInvalidConfiguration("clang 11 with libstdc++ is not supported due to old libstdc++ missing C++17 support")

if is_apple_os(self):
Expand All @@ -80,9 +81,6 @@ def validate(self):
raise ConanInvalidConfiguration(
"Macos Mojave (10.14) and earlier cannot to be built because C++ standard library too old.")

if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, minimum_cpp_standard)

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)

Expand All @@ -91,12 +89,24 @@ def generate(self):
tc.variables["ENABLE_TEST"] = False
tc.variables["ENABLE_INTEGRATION_TEST"] = False
tc.variables["ENABLE_COVERAGE"] = False
tc.variables["LINK_CURL"] = True
tc.variables["CMAKE_OSX_DEPLOYMENT_TARGET"] = self._mac_os_minimum_required_version

if is_msvc(self):
tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self)
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW"
tc.generate()
tc = CMakeDeps(self)
tc.generate()
deps = CMakeDeps(self)
deps.generate()

def _patch_sources(self):
# INFO: https://github.com/abedra/libvault/pull/123
replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"),
"target_link_libraries(vault curl)",
"target_link_libraries(vault CURL::libcurl)")

def build(self):
apply_conandata_patches(self)
self._patch_sources()
cmake = CMake(self)
cmake.configure()
cmake.build()
Expand All @@ -112,6 +122,7 @@ def package_info(self):
self.cpp_info.libs = ["vault"]
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs.append("m")

if self.settings.compiler == "gcc" and Version(self.settings.compiler.version).major == "8":
self.cpp_info.system_libs.append("stdc++fs")

Expand Down
6 changes: 1 addition & 5 deletions recipes/libvault/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
versions:
"0.52.0":
folder: "all"
"0.51.0":
folder: "all"
"0.48.0":
"0.59.0":
folder: "all"

0 comments on commit 8b04335

Please sign in to comment.