-
Notifications
You must be signed in to change notification settings - Fork 1
/
conanfile.py
66 lines (58 loc) · 2.55 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
from conans import ConanFile, AutoToolsBuildEnvironment, tools
from conan.errors import ConanInvalidConfiguration
import os
class LibtirpcConan(ConanFile):
name = "libtirpc"
version = "1.1.4"
description = "Libtirpc is a port of Suns Transport-Independent RPC library to Linux"
topics = ("conan", "tirpc", "RPC", "sun", "transport", "independent")
url = "https://github.com/bincrafters/conan-libtirpc"
homepage = "https://sourceforge.net/projects/libtirpc"
license = "BSD-3-Clause"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
}
_source_subfolder = "source_subfolder"
_autotools = None
def configure(self):
if self.settings.os != "Linux":
raise ConanInvalidConfiguration("libtirpc is only supported for Linux")
del self.settings.compiler.libcxx
del self.settings.compiler.cppstd
def source(self):
url = "{homepage}/files/{name}/{version}/{name}-{version}.tar.bz2".format(
homepage=self.homepage, name=self.name, version=self.version
)
sha256 = "2ca529f02292e10c158562295a1ffd95d2ce8af97820e3534fe1b0e3aec7561d"
tools.get(url, sha256=sha256)
os.rename("{}-{}".format(self.name, self.version), self._source_subfolder)
def _configure_autotools(self):
if not self._autotools:
conf_args = [
"--disable-gssapi",
"--enable-ipv6",
"--enable-shared" if self.options.shared else "--disable-shared",
"--disable-static" if self.options.shared else "--enable-static",
"--with-pic" if self.options.fPIC else "--without-pic",
]
self._autotools = AutoToolsBuildEnvironment(self)
self._autotools.configure(configure_dir=os.path.join(self.source_folder, self._source_subfolder), args=conf_args)
return self._autotools
def build(self):
autotools = self._configure_autotools()
autotools.make()
def package(self):
self.copy("COPYING", dst="licenses", src=self._source_subfolder)
autotools = self._configure_autotools()
autotools.install()
tools.rmdir(os.path.join(self.package_folder, "share"))
tools.rmdir(os.path.join(self.package_folder, "etc"))
def package_info(self):
self.cpp_info.includedirs = ["include", os.path.join("include", "tirpc")]
self.cpp_info.libs = ["tirpc", "pthread"]