1SUMMARY = "The X.Org X server"
2HOMEPAGE = "http://www.x.org"
3SECTION = "x11/base"
4LICENSE = "MIT"
5LIC_FILES_CHKSUM = "file://COPYING;md5=5df87950af51ac2c5822094553ea1880"
6
7# xf86-*-* packages depend on an X server built with the xfree86 DDX
8# so we have a virtual to represent that:
9# deprecated, we should use virtual/xserver instead
10PROVIDES = "virtual/xserver-xf86"
11
12# Other packages tend to just care that there is *an* X server:
13PROVIDES += "virtual/xserver"
14
15PE = "2"
16
17XORG_PN = "xorg-server"
18SRC_URI = "${XORG_MIRROR}/individual/xserver/${XORG_PN}-${PV}.tar.xz"
19
20UPSTREAM_CHECK_REGEX = "xorg-server-(?P<pver>\d+(\.(?!99)\d+)+)\.tar"
21
22CVE_PRODUCT = "xorg-server x_server"
23
24CVE_STATUS[CVE-2011-4613] = "not-applicable-platform: This is specific to Debian's xserver-wrapper.c"
25CVE_STATUS[CVE-2020-25697] = "upstream-wontfix: \
26As per upstream, exploiting this flaw is non-trivial and it requires exact \
27timing on the behalf of the attacker. Many graphical applications exit if their \
28connection to the X server is lost, so a typical desktop session is either \
29impossible or difficult to exploit. There is currently no upstream patch \
30available for this flaw."
31CVE_STATUS[CVE-2022-3553] = "cpe-incorrect: This is specific to XQuartz, which is the macOS X server port"
32
33S = "${WORKDIR}/${XORG_PN}-${PV}"
34
35inherit meson pkgconfig
36
37inherit features_check
38REQUIRED_DISTRO_FEATURES = "x11"
39
40LIB_DEPS = "pixman libxfont2 xtrans libxau libxext libxdmcp libdrm libxkbfile libpciaccess libxcvt libtirpc"
41DEPENDS = "xorgproto ${LIB_DEPS} font-util"
42
43# Split out some modules and extensions from the main package
44# These aren't needed for basic operations and only take up space:
45#  32.0k   libdri.so
46#  91.0k   libexa.so
47#  336.0k  libglx.so
48#  1360k   libint10.so
49#  180.0k  libwfb.so
50#  320.0k  libxaa.so
51#  124.0k  libxf1bpp.so
52#  84.0k   libxf4bpp.so
53#          librecord.so
54#          libextmod.so
55#          libdbe.so
56
57PACKAGES =+ "${PN}-sdl \
58             ${PN}-fbdev \
59             ${PN}-xvfb \
60             ${PN}-utils \
61             ${PN}-xephyr \
62             ${PN}-xwayland \
63             ${PN}-multimedia-modules \
64             ${PN}-extension-dri \
65             ${PN}-extension-dri2 \
66             ${PN}-extension-glx \
67             ${PN}-extension-record \
68             ${PN}-extension-extmod \
69             ${PN}-extension-dbe \
70             ${PN}-module-libint10 \
71             ${PN}-module-libafb \
72             ${PN}-module-libwfb  \
73             ${PN}-module-libmfb \
74             ${PN}-module-libcfb \
75             ${PN}-module-exa \
76             ${PN}-module-xaa \
77             ${PN}-module-libxf1bpp \
78             ${PN}-module-libxf4bpp \
79             xf86-video-modesetting"
80
81SUMMARY:xf86-video-modesetting = "X.Org X server -- modesetting display driver"
82INSANE_SKIP:${MLPREFIX}xf86-video-modesetting = "xorg-driver-abi"
83
84XSERVER_RDEPENDS = "xkeyboard-config rgb xserver-xf86-config xkbcomp xf86-input-libinput"
85RDEPENDS:${PN} += "${XSERVER_RDEPENDS}"
86RDEPENDS:${PN}-xwayland += "${XSERVER_RDEPENDS}"
87RDEPENDS:${PN}-xvfb += "xkeyboard-config"
88RDEPENDS:${PN}-module-exa = "${PN} (= ${EXTENDPKGV})"
89
90FILES:${PN} = "${bindir} ${libdir}/X11/Options ${libdir}/X11/Cards ${libdir}/X11/getconfig ${libdir}/X11/etc ${libdir}/modules/*.so ${libdir}/xorg/modules/input/*.so ${libdir}/xorg/modules/*.so /etc/X11 ${libdir}/xorg/protocol.txt ${datadir}/X11/xorg.conf.d"
91FILES:${PN}-dev += "${libdir}/xorg/modules/*.la ${libdir}/xorg/modules/*/*.la"
92FILES:${PN}-doc += "${libdir}/X11/doc ${datadir}/X11/xkb/compiled/README.compiled ${localstatedir}/lib/xkb/README.compiled"
93FILES:${PN}-sdl = "${bindir}/Xsdl"
94FILES:${PN}-fbdev = "${bindir}/Xfbdev"
95FILES:${PN}-xvfb = "${bindir}/Xvfb"
96FILES:${PN}-utils = "${bindir}/scanpci ${bindir}/pcitweak ${bindir}/ioport ${bindir}/in[bwl] ${bindir}/out[bwl] ${bindir}/mmap[rw] ${bindir}/gtf ${bindir}/getconfig ${bindir}/getconfig.pl"
97FILES:${PN}-xephyr = "${bindir}/Xephyr"
98FILES:${PN}-xwayland = "${bindir}/Xwayland"
99FILES:${PN}-multimedia-modules = "${libdir}/xorg/modules/multimedia/*drv*"
100FILES:${PN}-extension-dri = "${libdir}/xorg/modules/extensions/libdri.so"
101FILES:${PN}-extension-dri2 = "${libdir}/xorg/modules/extensions/libdri2.so"
102FILES:${PN}-extension-glx = "${libdir}/xorg/modules/extensions/libglx.so"
103FILES:${PN}-extension-record = "${libdir}/xorg/modules/extensions/librecord.so"
104FILES:${PN}-extension-extmod = "${libdir}/xorg/modules/extensions/libextmod.so"
105FILES:${PN}-extension-dbe = "${libdir}/xorg/modules/extensions/libdbe.so"
106FILES:${PN}-module-libint10 = "${libdir}/xorg/modules/libint10.so"
107FILES:${PN}-module-libafb = "${libdir}/xorg/modules/libafb.so"
108FILES:${PN}-module-libwfb = "${libdir}/xorg/modules/libwfb.so"
109FILES:${PN}-module-libmfb = "${libdir}/xorg/modules/libmfb.so"
110FILES:${PN}-module-libcfb = "${libdir}/xorg/modules/libcfb.so"
111FILES:${PN}-module-exa = "${libdir}/xorg/modules/libexa.so"
112FILES:${PN}-module-xaa = "${libdir}/xorg/modules/libxaa.so"
113FILES:${PN}-module-libxf1bpp = "${libdir}/xorg/modules/libxf1bpp.so"
114FILES:${PN}-module-libxf4bpp = "${libdir}/xorg/modules/libxf4bpp.so"
115FILES:xf86-video-modesetting = "${libdir}/xorg/modules/drivers/modesetting_drv.so"
116
117EXTRA_OEMESON += " \
118                 -Dxnest=false \
119                 -Dxvfb=true \
120                 -Ddtrace=false \
121                 -Dint10=x86emu \
122                 -Dxkb_output_dir=/var/lib/xkb \
123"
124
125OPENGL_PKGCONFIGS = "dri glx glamor dri3"
126PACKAGECONFIG ??= "dga dri2 udev ${XORG_CRYPTO} \
127                   ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', '${OPENGL_PKGCONFIGS}', '', d)} \
128                   ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-logind', '', d)} \
129"
130
131PACKAGECONFIG[udev] = "-Dudev=true,-Dudev=false,udev"
132PACKAGECONFIG[dga] = "-Ddga=true,-Ddga=false"
133PACKAGECONFIG[dri] = "-Ddri1=true,-Ddri1=false,virtual/mesa"
134PACKAGECONFIG[dri2] = "-Ddri2=true,-Ddri2=false"
135PACKAGECONFIG[dri3] = "-Ddri3=true,-Ddri3=false"
136PACKAGECONFIG[glx] = "-Dglx=true,-Dglx=false,virtual/libgl virtual/libx11"
137PACKAGECONFIG[glamor] = "-Dglamor=true,-Dglamor=false,libepoxy virtual/libgbm,libegl"
138PACKAGECONFIG[unwind] = "-Dlibunwind=true,-Dlibunwind=false,libunwind"
139PACKAGECONFIG[systemd-logind] = "-Dsystemd_logind=true,-Dsystemd_logind=false,dbus,"
140PACKAGECONFIG[xinerama] = "-Dxinerama=true,-Dxinerama=false"
141
142# Xorg requires a SHA1 implementation, pick one
143XORG_CRYPTO ??= "openssl"
144PACKAGECONFIG[openssl] = "-Dsha1=libcrypto,,openssl"
145PACKAGECONFIG[nettle] = "-Dsha1=libnettle,,nettle"
146PACKAGECONFIG[gcrypt] = "-Dsha1=libgcrypt,,libgcrypt"
147
148do_install:append () {
149        sed -i -e 's,${libdir}/xorg/modules,${prefix}/lib*/xorg/modules,' ${D}${mandir}/man5/xorg.conf.5
150}
151
152# Add runtime provides for the ABI versions of the video and input subsystems,
153# so that drivers can depend on the relevant version.
154python populate_packages:prepend() {
155    import subprocess
156
157    # Set PKG_CONFIG_PATH so pkg-config looks at the .pc files that are going
158    # into the new package, not the staged ones.
159    newenv = dict(os.environ)
160    newenv["PKG_CONFIG_PATH"] = d.expand("${PKGD}${libdir}/pkgconfig/")
161
162    def get_abi(name):
163        abis = {
164          "video": "abi_videodrv",
165          "input": "abi_xinput"
166        }
167        p = subprocess.Popen(args="pkg-config --variable=%s xorg-server" % abis[name],
168                             shell=True, env=newenv, stdout=subprocess.PIPE)
169        stdout, stderr = p.communicate()
170        output = stdout.decode("utf-8").split(".")[0]
171        mlprefix = d.getVar('MLPREFIX') or ''
172        return "%sxorg-abi-%s-%s" % (mlprefix, name, output)
173
174    pn = d.getVar("PN")
175    d.appendVar("RPROVIDES:" + pn, " " + get_abi("input"))
176    d.appendVar("RPROVIDES:" + pn, " " + get_abi("video"))
177}
178