forked from gerbera/gerbera
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
189 lines (164 loc) · 5.79 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
from conans import CMake, ConanFile, tools
from conans.errors import ConanException
class GerberaConan(ConanFile):
name = "gerbera"
license = "GPLv2"
generators = ("cmake", "cmake_find_package", "virtualrunenv")
settings = "os", "arch", "compiler", "build_type"
options = {
"js": [True, False],
"debug_logging": [True, False],
"tests": [True, False],
"magic": [True, False],
"curl": [True, False],
"taglib": [True, False],
"exif": [True, False],
"matroska": [True, False],
"mysql": [True, False],
"ffmpeg": [True, False],
"ffmpegthumbnailer": [True, False],
}
default_options = {
"js": True,
"debug_logging": False,
"tests": False,
"magic": True,
"curl": True,
"taglib": True,
"exif": True,
"matroska": True,
# The following are false in CMakeLists.txt, but almost always turned on.
"mysql": True,
"ffmpeg": True,
"ffmpegthumbnailer": True,
}
scm = {"type": "git", "url": "auto", "revision": "auto"}
requires = [
"fmt/7.0.1",
"spdlog/1.8.2",
"pugixml/1.10",
"libiconv/1.16",
"sqlite3/3.31.1",
"zlib/1.2.11",
"pupnp/[>=1.14.0]",
]
def configure(self):
tools.check_min_cppstd(self, "17")
if self.options.tests:
# We have our own main function,
# Moreover, if "shared" is True then main is an .so...
self.options["gtest"].no_main = True
@property
def _needs_system_uuid(self):
if self.options.ffmpeg:
os_info = tools.OSInfo()
# ffmpeg on Ubuntu has libuuid as a deep transitive dependency
# and fails to link otherwise.
return os_info.with_apt
def requirements(self):
if self.options.tests:
self.requires("gtest/1.10.0")
if self.options.js:
self.requires("duktape/2.5.0")
if self.options.curl:
self.requires("libcurl/7.74.0")
if self.options.mysql:
self.requires("openssl/1.1.1i")
self.requires("mariadb-connector-c/3.1.11")
if not self._needs_system_uuid:
self.requires("libuuid/1.0.3")
def system_requirements(self):
if tools.cross_building(self):
self.output.info("Cross-compiling, not installing system packages")
return
os_info = tools.OSInfo()
if os_info.with_apt:
pm = "apt"
elif os_info.with_pacman:
pm = "pacman"
elif os_info.with_yum:
pm = "yum"
elif os_info.is_freebsd:
pm = "freebsd"
else:
self.output.warn("Don't know how to install packages.")
return
installer = tools.SystemPackageTool(conanfile=self)
if self.options.magic:
installer.install(
{
"apt": "libmagic-dev",
"pacman": "file",
"yum": "file-devel",
"freebsd": [],
}[pm]
)
if self.options.taglib:
installer.install(
{
"apt": "libtag1-dev",
"pacman": "taglib",
"yum": "libtag-devel",
"freebsd": "taglib",
}[pm]
)
if self.options.exif:
installer.install(
{
"apt": "libexif-dev",
"pacman": "libexif",
"yum": "libexif-devel",
"freebsd": "libexif",
}[pm]
)
if self.options.matroska:
installer.install(
{
"apt": "libmatroska-dev",
"pacman": "libmatroska",
"yum": "libmatroska-devel",
"freebsd": "libmatroska",
}[pm]
)
if self.options.ffmpeg:
installer.install(
{
"apt": "libavformat-dev",
"pacman": "ffmpeg",
"yum": "ffmpeg-devel",
"freebsd": "ffmpeg",
}[pm]
)
if self._needs_system_uuid:
installer.install(
{"apt": "uuid-dev", "pacman": [], "yum": [], "freebsd": []}[pm]
)
if self.options.ffmpegthumbnailer:
installer.install(
{
"apt": "libffmpegthumbnailer-dev",
"pacman": "ffmpegthumbnailer",
"yum": "ffmpegthumbnailer-devel",
"freebsd": "ffmpegthumbnailer",
}[pm]
)
def build(self):
cmake = CMake(self)
cmake.definitions["WITH_JS"] = self.options.js
cmake.definitions["WITH_DEBUG"] = self.options.debug_logging
cmake.definitions["WITH_TESTS"] = self.options.tests
cmake.definitions["WITH_MAGIC"] = self.options.magic
cmake.definitions["WITH_CURL"] = self.options.curl
cmake.definitions["WITH_TAGLIB"] = self.options.taglib
cmake.definitions["WITH_EXIF"] = self.options.exif
cmake.definitions["WITH_MATROSKA"] = self.options.matroska
cmake.definitions["WITH_MYSQL"] = self.options.mysql
cmake.definitions["WITH_AVCODEC"] = self.options.ffmpeg
cmake.definitions["WITH_FFMPEGTHUMBNAILER"] = self.options.ffmpegthumbnailer
if self.settings.os != "Linux" or tools.cross_building(self):
cmake.definitions["WITH_SYSTEMD"] = False
cmake.configure()
cmake.build()
if tools.get_env("CONAN_RUN_TESTS", True):
with tools.run_environment(self):
cmake.test(output_on_failure=True)