xorg/system

The X.Org project provides an open source implementation of the X Window System.
MIT
License
system
Version
101,899
Downloads
Loading...
Loading...
1
from conans import ConanFile, tools
2
from conans.errors import ConanException, ConanInvalidConfiguration
3
4
required_conan_version = ">=1.32"
5
6
class ConanXOrg(ConanFile):
7
    name = "xorg"
8
    url = "https://github.com/conan-io/conan-center-index"
9
    license = "MIT"
10
    homepage = "https://www.x.org/wiki/"
11
    description = "The X.Org project provides an open source implementation of the X Window System."
12
    settings = "os"
13
    topics = ("conan", "x11", "xorg")
14
15
    def configure(self):
16
        if self.settings.os not in ["Linux", "FreeBSD"]:
17
            raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD")
18
19
    def package_id(self):
20
        self.info.header_only()
21
22
    def _fill_cppinfo_from_pkgconfig(self, name):
23
        pkg_config = tools.PkgConfig(name)
24
        if not pkg_config.provides:
25
            raise ConanException("OpenGL development files aren't available, give up")
26
        libs = [lib[2:] for lib in pkg_config.libs_only_l]
27
        lib_dirs = [lib[2:] for lib in pkg_config.libs_only_L]
28
        ldflags = [flag for flag in pkg_config.libs_only_other]
29
        include_dirs = [include[2:] for include in pkg_config.cflags_only_I]
30
        cflags = [flag for flag in pkg_config.cflags_only_other if not flag.startswith("-D")]
31
        defines = [flag[2:] for flag in pkg_config.cflags_only_other if flag.startswith("-D")]
32
33
        self.cpp_info.components[name].system_libs = libs
34
        self.cpp_info.components[name].libdirs = lib_dirs
35
        self.cpp_info.components[name].sharedlinkflags = ldflags
36
        self.cpp_info.components[name].exelinkflags = ldflags
37
        self.cpp_info.components[name].defines = defines
38
        self.cpp_info.components[name].includedirs = include_dirs
39
        self.cpp_info.components[name].cflags = cflags
40
        self.cpp_info.components[name].cxxflags = cflags
41
        self.cpp_info.components[name].version = pkg_config.version[0]
42
43
    def system_requirements(self):
44
        packages = []
45
        if tools.os_info.is_linux and self.settings.os == "Linux":
46
            if tools.os_info.with_apt:
47
                packages = ["xorg-dev", "libx11-xcb-dev", "libxcb-render0-dev", "libxcb-render-util0-dev", "libxcb-xkb-dev",
48
                            "libxcb-icccm4-dev", "libxcb-image0-dev", "libxcb-keysyms1-dev", "libxcb-randr0-dev", "libxcb-shape0-dev",
49
                            "libxcb-sync-dev", "libxcb-xfixes0-dev", "libxcb-xinerama0-dev", "xkb-data", "libxcb-dri3-dev"]
50
                if (tools.os_info.linux_distro == "ubuntu" and tools.os_info.os_version < "15") or\
51
                   (tools.os_info.linux_distro == "debian" and tools.os_info.os_version < "12") or\
52
                   (tools.os_info.linux_distro == "raspbian" and tools.os_info.os_version < "12"):
53
                    packages.append( "libxcb-util0-dev" )
54
                else:
55
                    packages.append( "libxcb-util-dev" )
56
            elif tools.os_info.with_yum or tools.os_info.with_dnf:
57
                packages = ["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel",
58
                            "libXcursor-devel", "libXdmcp-devel", "libXft-devel", "libXtst-devel", "libXinerama-devel",
59
                            "libxkbfile-devel", "libXrandr-devel", "libXres-devel", "libXScrnSaver-devel", "libXvMC-devel",
60
                            "xorg-x11-xtrans-devel", "xcb-util-wm-devel", "xcb-util-image-devel", "xcb-util-keysyms-devel",
61
                            "xcb-util-renderutil-devel", "libXdamage-devel", "libXxf86vm-devel", "libXv-devel",
62
                            "xkeyboard-config-devel", "xcb-util-devel"]
63
            elif tools.os_info.with_pacman:
64
                packages = ["libxcb", "libfontenc", "libice", "libsm", "libxaw", "libxcomposite", "libxcursor",
65
                            "libxdamage", "libxdmcp", "libxft", "libxtst", "libxinerama", "libxkbfile", "libxrandr", "libxres",
66
                            "libxss", "libxvmc", "xtrans", "xcb-util-wm", "xcb-util-image","xcb-util-keysyms", "xcb-util-renderutil",
67
                            "libxxf86vm", "libxv", "xkeyboard-config", "xcb-util"]
68
            elif tools.os_info.with_zypper:
69
                packages = ["xorg-x11-devel", "xcb-util-wm-devel", "xcb-util-image-devel", "xcb-util-keysyms-devel",
70
                            "xcb-util-renderutil-devel", "xkeyboard-config", "xcb-util-devel"]
71
            else:
72
                self.output.warn("Do not know how to install 'xorg' for {}.".format(tools.os_info.linux_distro))
73
        
74
        elif tools.os_info.is_freebsd and self.settings.os == "FreeBSD":
75
            packages = ["libX11", "libfontenc", "libice", "libsm", "libxaw", "libxcomposite", "libxcursor",
76
                        "libxdamage", "libxdmcp", "libxft", "libxtst", "libxinerama", "libxkbfile", "libxrandr", "libxres",
77
                        "libXScrnSaver", "libxvmc", "xtrans", "xcb-util-wm", "xcb-util-image", "xcb-util-keysyms", "xcb-util-renderutil",
78
                        "libxxf86vm", "libxv", "xkeyboard-config", "xcb-util"]
79
        if packages:
80
            package_tool = tools.SystemPackageTool(conanfile=self, default_mode="verify")
81
            package_tool.install_packages(update=True, packages=packages)
82
83
    def package_info(self):
84
        for name in ["x11", "x11-xcb", "fontenc", "ice", "sm", "xau", "xaw7",
85
                     "xcomposite", "xcursor", "xdamage", "xdmcp", "xext", "xfixes", "xft", "xi",
86
                     "xinerama", "xkbfile", "xmu", "xmuu", "xpm", "xrandr", "xrender", "xres",
87
                     "xscrnsaver", "xt", "xtst", "xv", "xvmc", "xxf86vm", "xtrans",
88
                     "xcb-xkb", "xcb-icccm", "xcb-image", "xcb-keysyms", "xcb-randr", "xcb-render",
89
                     "xcb-renderutil", "xcb-shape", "xcb-shm", "xcb-sync", "xcb-xfixes",
90
                     "xcb-xinerama", "xcb", "xkeyboard-config", "xcb-atom", "xcb-aux", "xcb-event", "xcb-util",
91
                     "xcb-dri3"]:
92
            self._fill_cppinfo_from_pkgconfig(name)
93
94