-
Notifications
You must be signed in to change notification settings - Fork 1
/
conanfile.py
61 lines (51 loc) · 2.57 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
from conan.errors import ConanInvalidConfiguration
import os, glob, shutil
from conans import ConanFile, AutoToolsBuildEnvironment, tools
class LKSCTPToolsConan(ConanFile):
name = "lksctp-tools"
version = "1.0.17"
generators = "cmake"
settings = "os", "arch", "compiler", "build_type"
options = {"shared": [True, False], "fPIC": [True, False], "with_sctp": [True, False]}
default_options = {'shared': False, 'fPIC': True, 'with_sctp': False}
homepage = "http://lksctp.sourceforge.net/"
url = "https://github.com/bincrafters/conan-lksctp-tools"
description = "The lksctp-tools project provides a Linux user space library for SCTP"
license = "GPL-2.0, LGPL-2.1"
_source_subfolder = "source_subfolder"
def source(self):
source_url = "https://github.com/sctp/lksctp-tools"
tools.get("{0}/archive/{1}-{2}.tar.gz".format(source_url, self.name, self.version))
extracted_dir = self.name + "-" + self.name + "-" + self.version
os.rename(extracted_dir, self._source_subfolder)
def configure(self):
if self.settings.os != "Linux":
raise ConanInvalidConfiguration("Linux Kernel SCTP Tools is only supported for Linux.")
del self.settings.compiler.libcxx
del self.settings.compiler.cppstd
def build(self):
env_build = AutoToolsBuildEnvironment(self)
env_build.fpic = self.options.fPIC
with tools.environment_append(env_build.vars):
with tools.chdir(self._source_subfolder):
self.run("./bootstrap")
config_args = []
config_args.append('--disable-%s' % ('static' if self.options.shared else 'shared'))
config_args.append("--prefix=%s" % self.package_folder)
config_args.append("--disable-tests")
env_build.configure(configure_dir=self._source_subfolder, args=config_args)
env_build.make()
env_build.make(args=["install"])
def package(self):
self.copy(pattern="COPYING*", dst="licenses", src=self._source_subfolder, ignore_case=True, keep_path=False)
self.move_withsctp()
def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
self.cpp_info.libs.append("dl")
def move_withsctp(self):
with tools.chdir(os.path.join(self.package_folder, "lib")):
if self.options.with_sctp:
with tools.chdir("lksctp-tools"):
for libfile in glob.glob("libwithsctp*"):
os.rename(libfile, os.path.join("..", libfile))
shutil.rmtree("lksctp-tools")