This repository has been archived by the owner on Jan 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconanfile.py
64 lines (55 loc) · 2.82 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
from conans import ConanFile, AutoToolsBuildEnvironment, tools
from conans.errors import ConanInvalidConfiguration
import os
class LiunwindConan(ConanFile):
name = "libunwind"
version = "1.3.1"
description = "Manipulate the preserved state of each call-frame and resume the execution at any point."
topics = ("conan", "libunwind", "unwind", "debuggers", "exception-handling", "introspection", "setjmp")
url = "https://github.com/bincrafters/conan-libunwind"
homepage = "https://github.com/libunwind/libunwind"
license = "MIT"
exports = ["LICENSE.md"]
settings = "os", "arch", "compiler", "build_type"
options = {"shared": [True, False], "fPIC": [True, False], "coredump": [True, False], "ptrace": [True, False], "setjmp": [True, False]}
default_options = {"shared": False, "fPIC": True, "coredump": True, "ptrace": True, "setjmp": True}
requires = "xz_utils/5.2.4"
_autotools = None
@property
def _source_subfolder(self):
return "source_subfolder"
def configure(self):
if self.settings.os not in ["Linux", "FreeBSD"]:
raise ConanInvalidConfiguration("libunwind is not supported by your platform")
del self.settings.compiler.libcxx
del self.settings.compiler.cppstd
def source(self):
sha256 = "43997a3939b6ccdf2f669b50fdb8a4d3205374728c2923ddc2354c65260214f8"
tools.get("{0}/releases/download/v{1}/libunwind-{1}.tar.gz".format(self.homepage, self.version), sha256=sha256)
extracted_dir = self.name + "-" + self.version
os.rename(extracted_dir, self._source_subfolder)
def _configure_autotools(self):
if not self._autotools:
self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
args = [
"--enable-shared={}".format("yes" if self.options.shared else "no"),
"--enable-static={}".format("no" if self.options.shared else "yes"),
"--enable-coredump={}".format("yes" if self.options.coredump else "no"),
"--enable-ptrace={}".format("yes" if self.options.ptrace else "no"),
"--enable-setjmp={}".format("yes" if self.options.setjmp else "no"),
"--disable-tests",
"--disable-documentation"
]
self._autotools.configure(configure_dir=self._source_subfolder, args=args)
return self._autotools
def build(self):
autotools = self._configure_autotools()
autotools.make()
def package(self):
self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder)
autotools = self._configure_autotools()
autotools.install()
def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
if self.settings.os == "Linux":
self.cpp_info.libs.append("pthread")