This repository has been archived by the owner on Aug 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconanfile.py
80 lines (69 loc) · 2.63 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
from conans import ConanFile, Meson, tools
from conans.errors import ConanInvalidConfiguration
import os
import shutil
class XkbcommonConan(ConanFile):
name = "xkbcommon"
description = "keymap handling library for toolkits and window systems"
topics = ("conan", "xkbcommon", "keyboard")
url = "https://github.com/bincrafters/conan-xkbcommon"
homepage = "https://github.com/xkbcommon/libxkbcommon"
license = "MIT"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
"with_x11": [True, False],
"with_wayland": [True, False],
"docs": [True, False]
}
default_options = {
"shared": True,
"fPIC": True,
"with_x11": True,
"with_wayland": False,
"docs": False
}
_source_subfolder = "source_subfolder"
_build_subfolder = "build_subfolder"
def configure(self):
if self.settings.os != "Linux":
raise ConanInvalidConfiguration("This library is only compatible with Linux")
del self.settings.compiler.libcxx
del self.settings.compiler.cppstd
def build_requirements(self):
if not tools.which("meson"):
self.build_requires("meson/0.54.2")
if not tools.which("bison"):
self.build_requires("bison/3.5.3")
if not tools.which("pkg-config"):
self.build_requires("pkg-config_installer/0.29.2@bincrafters/stable")
def requirements(self):
self.requires("xorg/system")
def source(self):
tools.get(**self.conan_data["sources"][self.version])
extracted_dir = "libxkbcommon-" + self.name + "-" + self.version
os.rename(extracted_dir, self._source_subfolder)
def _configure_meson(self):
defs={
"enable-wayland": self.options.with_wayland,
"enable-docs": self.options.docs,
"enable-x11": self.options.with_x11,
"libdir": os.path.join(self.package_folder, "lib"),
"default_library": ("shared" if self.options.shared else "static")}
meson = Meson(self)
meson.configure(
defs=defs,
source_folder=self._source_subfolder,
build_folder=self._build_subfolder,
pkg_config_paths=self.build_folder)
return meson
def build(self):
meson = self._configure_meson()
meson.build()
def package(self):
self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder)
meson = self._configure_meson()
meson.install()
def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)