Skip to content

Commit

Permalink
Add xml-security-c++ 2.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
sivachandran committed May 2, 2024
1 parent dab0e65 commit ad17296
Show file tree
Hide file tree
Showing 7 changed files with 1,063 additions and 0 deletions.
10 changes: 10 additions & 0 deletions recipes/xml-security-c/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
sources:
"2.0.4":
url: "https://github.com/apache/santuario-cpp/archive/refs/tags/2.0.4.zip"
sha256: "621582489cecf4d96c92cd5483f48a5e1ae9da2dbd92829c3d63e754d777d410"
patches:
"2.0.4":
- patch_file: "patches/001-cmake-support.patch"
patch_description: "adds cmake based build system"
patch_type: "conan"
patch_source: "https://github.com/sivachandran/santuario-cpp/tree/cmake/2.0.4-1"
104 changes: 104 additions & 0 deletions recipes/xml-security-c/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
from conan import ConanFile, conan_version
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir, collect_libs
from conan.tools.scm import Version
import os


required_conan_version = ">=1.53.0"

class PackageConan(ConanFile):
name = "xml-security-c"
description = (
"C++ library is an implementation of the XML Digital Signature and Encryption specifications"
)
license = "Apache-2.0"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://santuario.apache.org/cindex.html"
topics = ("santuario", "xml", "dsig", "enc", "digital-signature", "encryption", "verification")

package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
"with_xalan": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"with_xalan": False,
}

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):
self.requires("xerces-c/3.2.5")
self.requires("openssl/3.2.1")

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

def generate(self):
tc = CMakeToolchain(self)
if self.options.with_xalan:
tc.variables["WITH_XALAN"] = "YES"
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()

def package(self):
for license_file in ("LICENSE", "NOTICE"):
copy(self, license_file, src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
cmake = CMake(self)
cmake.install()

rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
rmdir(self, os.path.join(self.package_folder, "share"))
rm(self, "*.la", os.path.join(self.package_folder, "lib"))
rm(self, "*.pdb", os.path.join(self.package_folder, "lib"))
rm(self, "*.pdb", os.path.join(self.package_folder, "bin"))

def package_info(self):
self.cpp_info.libs = collect_libs(self)

# if package has an official FindPACKAGE.cmake listed in https://cmake.org/cmake/help/latest/manual/cmake-modules.7.html#find-modules
# examples: bzip2, freetype, gdal, icu, libcurl, libjpeg, libpng, libtiff, openssl, sqlite3, zlib...
# if package provides a CMake config file (package-config.cmake or packageConfig.cmake, with package::package target, usually installed in <prefix>/lib/cmake/<package>/)
self.cpp_info.set_property("cmake_file_name", "XmlSecurityC")
self.cpp_info.set_property("cmake_target_name", "XmlSecurityC::XmlSecurityC")
# if package provides a pkgconfig file (package.pc, usually installed in <prefix>/lib/pkgconfig/)
self.cpp_info.set_property("pkg_config_name", "xml-security-c.pc")

# If they are needed on Linux, m, pthread and dl are usually needed on FreeBSD too
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs.append("pthread")
elif self.settings.os == "Macos":
self.cpp_info.frameworks = ["CoreFoundation", "CoreServices"]

# TODO: to remove in conan v2 once cmake_find_package_* generators removed
if Version(conan_version).major < 2:
self.cpp_info.names["cmake_find_package"] = "XmlSecurityC"
self.cpp_info.names["cmake_find_package_multi"] = "XmlSecurity-C"
Loading

0 comments on commit ad17296

Please sign in to comment.