-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconanfile.py
84 lines (73 loc) · 3.38 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
from conans import ConanFile, AutoToolsBuildEnvironment, tools
import os
class LibsndfileConan(ConanFile):
name = "libsndfile"
version = "1.0.28"
license = ("LGLP-2.1", "LGPL-3.0")
author = "Martin Delille <martin@phonations.com>"
url = "https://github.com/Phonations/conan-libsndfile"
homepage = "http://www.mega-nerd.com/libsndfile"
description = "A C library for reading and writing sound files containing sampled audio data."
exports = "LICENSE"
topics = ("audio", "sound", "wav", "aiff", "sampled-sound")
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": False, "fPIC": True}
_autotools = None
@property
def _source_subfolder(self):
return "source_subfolder"
def config_options(self):
if self.settings.os == "Windows":
self.options.clear()
def configure(self):
del self.settings.compiler.libcxx
if self.settings.os == "Windows":
del self.settings.build_type
del self.settings.compiler
def source(self):
source_sha256 = "1ff33929f042fa333aed1e8923aa628c3ee9e1eb85512686c55092d1e5a9dfa9"
extracted_folder = self.name + '-' + self.version
url = "{}/files/{}".format(self.homepage, extracted_folder)
tools.get("{}.tar.gz".format(url), sha256=source_sha256)
os.rename(extracted_folder, self._source_subfolder)
def _configure_autotools(self):
if not self._autotools:
args = [
("--enable-shared" if self.options.shared else "--enable-static"),
("--disable-static" if self.options.shared else "--disable-shared"),
"--disable-sqlite",
"--disable-alsa",
"--disable-external-libs"
]
self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
self._autotools.configure(configure_dir=self._source_subfolder, args=args)
return self._autotools
def build(self):
if self.settings.os == "Windows":
archs = {"x86": "w32", "x86_64": "w64"}
checksums = {
"x86": "a73e1a8f87207e121a78e7cfbfe758d3ad15a28a37e4ca0e96d43348d53a2a1f",
"x86_64": "b885e97c797c39127d7d252be0da704a8bbdb97948b562d95cd5b8821d2b42ba"
}
extracted_folder = self.name + '-' + self.version + '-' + archs[str(self.settings.arch)]
url = "{}/files/{}".format(self.homepage, extracted_folder)
tools.get("{}.zip".format(url), sha256=checksums[str(self.settings.arch)])
else:
autotools = self._configure_autotools()
autotools.make()
def package(self):
self.copy("COPYING", dst="licenses", src=self._source_subfolder)
if self.settings.os == "Windows":
self.copy("*.dll", dst="bin", src="bin")
self.copy("*.lib", dst="lib", src="lib")
self.copy("*.h", dst="include", src="include")
self.copy("*.hh", dst="include", src="include")
else:
autotools = self._configure_autotools()
autotools.install()
tools.rmdir(os.path.join(self.package_folder, "share"))
def package_info(self):
self.cpp_info.libs = ["sndfile"]
if self.settings.os == "Linux":
self.cpp_info.libs.append("m")