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