-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
conanfile.py
116 lines (101 loc) · 7.89 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
from conan import ConanFile, conan_version
from conan.tools.gnu import PkgConfig
from conan.tools.system import package_manager
from conan.errors import ConanInvalidConfiguration
from conan.tools.scm import Version
required_conan_version = ">=1.50.0"
class XorgConan(ConanFile):
name = "xorg"
package_type = "shared-library"
url = "https://github.com/conan-io/conan-center-index"
license = "MIT"
homepage = "https://www.x.org/wiki/"
description = "The X.Org project provides an open source implementation of the X Window System."
settings = "os", "arch", "compiler", "build_type"
topics = ("x11", "xorg")
def validate(self):
if self.settings.os not in ["Linux", "FreeBSD"]:
raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD")
def package_id(self):
self.info.clear()
def system_requirements(self):
apt = package_manager.Apt(self)
apt.install(["libx11-dev", "libx11-xcb-dev", "libfontenc-dev", "libice-dev", "libsm-dev", "libxau-dev", "libxaw7-dev",
"libxcomposite-dev", "libxcursor-dev", "libxdamage-dev", "libxdmcp-dev", "libxext-dev", "libxfixes-dev",
"libxi-dev", "libxinerama-dev", "libxkbfile-dev", "libxmu-dev", "libxmuu-dev",
"libxpm-dev", "libxrandr-dev", "libxrender-dev", "libxres-dev", "libxss-dev", "libxt-dev", "libxtst-dev",
"libxv-dev", "libxxf86vm-dev", "libxcb-glx0-dev", "libxcb-render0-dev",
"libxcb-render-util0-dev", "libxcb-xkb-dev", "libxcb-icccm4-dev", "libxcb-image0-dev",
"libxcb-keysyms1-dev", "libxcb-randr0-dev", "libxcb-shape0-dev", "libxcb-sync-dev", "libxcb-xfixes0-dev",
"libxcb-xinerama0-dev", "libxcb-dri3-dev", "uuid-dev", "libxcb-cursor-dev", "libxcb-dri2-0-dev",
"libxcb-dri3-dev", "libxcb-present-dev", "libxcb-composite0-dev", "libxcb-ewmh-dev",
"libxcb-res0-dev"], update=True, check=True)
apt.install_substitutes(
["libxcb-util-dev"], ["libxcb-util0-dev"], update=True, check=True)
yum = package_manager.Yum(self)
yum.install(["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel",
"libXcursor-devel", "libXdmcp-devel", "libXtst-devel", "libXinerama-devel",
"libxkbfile-devel", "libXrandr-devel", "libXres-devel", "libXScrnSaver-devel",
"xcb-util-wm-devel", "xcb-util-image-devel", "xcb-util-keysyms-devel",
"xcb-util-renderutil-devel", "libXdamage-devel", "libXxf86vm-devel", "libXv-devel",
"xcb-util-devel", "libuuid-devel", "xcb-util-cursor-devel"], update=True, check=True)
dnf = package_manager.Dnf(self)
dnf.install(["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel",
"libXcursor-devel", "libXdmcp-devel", "libXtst-devel", "libXinerama-devel",
"libxkbfile-devel", "libXrandr-devel", "libXres-devel", "libXScrnSaver-devel",
"xcb-util-wm-devel", "xcb-util-image-devel", "xcb-util-keysyms-devel",
"xcb-util-renderutil-devel", "libXdamage-devel", "libXxf86vm-devel", "libXv-devel",
"xcb-util-devel", "libuuid-devel", "xcb-util-cursor-devel"], update=True, check=True)
zypper = package_manager.Zypper(self)
zypper.install(["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel",
"libXcursor-devel", "libXdmcp-devel", "libXtst-devel", "libXinerama-devel",
"libxkbfile-devel", "libXrandr-devel", "libXres-devel", "libXss-devel",
"xcb-util-wm-devel", "xcb-util-image-devel", "xcb-util-keysyms-devel",
"xcb-util-renderutil-devel", "libXdamage-devel", "libXxf86vm-devel", "libXv-devel",
"xcb-util-devel", "libuuid-devel", "xcb-util-cursor-devel"], update=True, check=True)
pacman = package_manager.PacMan(self)
pacman.install(["libxcb", "libfontenc", "libice", "libsm", "libxaw", "libxcomposite", "libxcursor",
"libxdamage", "libxdmcp", "libxtst", "libxinerama", "libxkbfile", "libxrandr", "libxres",
"libxss", "xcb-util-wm", "xcb-util-image", "xcb-util-keysyms", "xcb-util-renderutil",
"libxxf86vm", "libxv", "xcb-util", "util-linux-libs", "xcb-util-cursor"], update=True, check=True)
package_manager.Pkg(self).install(["libX11", "libfontenc", "libice", "libsm", "libxaw", "libxcomposite", "libxcursor",
"libxdamage", "libxdmcp", "libxtst", "libxinerama", "libxkbfile", "libxrandr", "libxres",
"libXScrnSaver", "xcb-util-wm", "xcb-util-image", "xcb-util-keysyms", "xcb-util-renderutil",
"libxxf86vm", "libxv", "xkeyboard-config", "xcb-util", "xcb-util-cursor"], update=True, check=True)
if Version(conan_version) >= "2.0.10":
alpine = package_manager.Apk(self)
alpine.install(["libx11-dev", " libxcb-dev", "libfontenc-dev", "libice-dev", "libsm-dev", " libxau-dev", "libxaw-dev",
"libxcomposite-dev", "libxcursor-dev", "libxdamage-dev", "libxdmcp-dev", " libxext-dev", "libxfixes-dev", "libxi-dev",
"libxinerama-dev", "libxkbfile-dev", " libxmu-dev", "libxpm-dev", "libxrandr-dev", "libxrender-dev", "libxres-dev",
"libxscrnsaver-dev", "libxt-dev", "libxtst-dev", "libxv-dev", "libxxf86vm-dev",
"xcb-util-wm-dev", "xcb-util-image-dev", "xcb-util-keysyms-dev", "xcb-util-renderutil-dev",
"libxinerama-dev", "libxcb-dev", "xcb-util-dev", "xcb-util-cursor-dev"], update=True, check=True)
def package_info(self):
if Version(conan_version) >= 2:
self.cpp_info.bindirs = []
self.cpp_info.includedirs = []
self.cpp_info.libdirs = []
for name in ["x11", "x11-xcb", "fontenc", "ice", "sm", "xau", "xaw7",
"xcomposite", "xcursor", "xdamage", "xdmcp", "xext", "xfixes", "xi",
"xinerama", "xkbfile", "xmu", "xmuu", "xpm", "xrandr", "xrender", "xres",
"xscrnsaver", "xt", "xtst", "xv", "xxf86vm",
"xcb-xkb", "xcb-icccm", "xcb-image", "xcb-keysyms", "xcb-randr", "xcb-render",
"xcb-renderutil", "xcb-shape", "xcb-shm", "xcb-sync", "xcb-xfixes",
"xcb-xinerama", "xcb", "xcb-atom", "xcb-aux", "xcb-event", "xcb-util",
"xcb-dri3", "xcb-cursor", "xcb-dri2", "xcb-dri3", "xcb-glx", "xcb-present",
"xcb-composite", "xcb-ewmh", "xcb-res"] + ([] if self.settings.os == "FreeBSD" else ["uuid"]):
pkg_config = PkgConfig(self, name)
pkg_config.fill_cpp_info(
self.cpp_info.components[name], is_system=self.settings.os != "FreeBSD")
self.cpp_info.components[name].version = pkg_config.version
self.cpp_info.components[name].set_property(
"pkg_config_name", name)
self.cpp_info.components[name].set_property(
"component_version", pkg_config.version)
self.cpp_info.components[name].bindirs = []
self.cpp_info.components[name].includedirs = []
self.cpp_info.components[name].libdirs = []
self.cpp_info.components[name].set_property("pkg_config_custom_content",
"\n".join(f"{key}={value}" for key, value in pkg_config.variables.items() if key not in ["pcfiledir","prefix", "includedir"]))
if self.settings.os == "Linux":
self.cpp_info.components["sm"].requires.append("uuid")