This repository has been archived by the owner on Sep 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
69 lines (57 loc) · 2.67 KB
/
conanfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
from conans import ConanFile, tools, CMake
import os
import glob
class LibgcryptConan(ConanFile):
name = "libgcrypt"
version = "1.8.4"
url = "http://github.com/bincrafters/conan-libgcrypt"
description = "Libgcrypt is a general purpose cryptographic library originally based on code from GnuPG"
license = "LGPL-2.1-or-later"
homepage = "https://www.gnupg.org/download/index.html#libgcrypt"
topics = ("conan", "libgcrypt", "gcrypt", "gnupg", "gpg", "crypto", "cryptography")
settings = "os", "arch", "compiler", "build_type"
options = {"shared": [True, False],
"fPIC": [True, False]}
default_options = {"shared": False, "fPIC": True}
_source_subfolder = "sources"
_build_subfolder = "build"
exports_sources = ["CMakeLists.txt", "patches/*.patch", "config.h.in", "gcrypt.h.in", "mod-source-info.h"]
generators = "cmake"
requires = 'libgpg-error/1.36@bincrafters/stable'
@property
def _is_msvc(self):
return self.settings.compiler == "Visual Studio"
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def configure(self):
del self.settings.compiler.libcxx
del self.settings.compiler.cppstd
def source(self):
source_url = "https://gnupg.org/ftp/gcrypt/libgcrypt"
tools.get("{0}/libgcrypt-{1}.tar.gz".format(source_url, self.version),
sha256="fc3c49cc8611068e6008482c3bbee6c66b9287808bbb4e14a473f4cc347b78ce")
extracted_dir = self.name + "-" + self.version
os.rename(extracted_dir, self._source_subfolder)
def _configure_cmake(self):
cmake = CMake(self)
cmake.configure(build_dir=self._build_subfolder)
return cmake
def build(self):
for filename in sorted(glob.glob("patches/*.patch")):
self.output.info('applying patch "%s"' % filename)
tools.patch(base_path=self._source_subfolder, patch_file=filename)
if self._is_msvc:
os.makedirs(os.path.join(self._source_subfolder, "sys"))
tools.download("https://raw.githubusercontent.com/win32ports/unistd_h/master/unistd.h",
os.path.join(self._source_subfolder, "unistd.h"))
tools.download("https://raw.githubusercontent.com/win32ports/sys_time_h/master/sys/time.h",
os.path.join(self._source_subfolder, "sys", "time.h"))
cmake = self._configure_cmake()
cmake.build()
def package(self):
self.copy(pattern="COPYING*", src="sources", dst="licenses")
cmake = self._configure_cmake()
cmake.install()
def package_info(self):
self.cpp_info.libs = ["gcrypt"]