summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-graphics/xorg-driver/xorg-driver-common.inc18
-rw-r--r--meta/recipes-graphics/xorg-driver/xorg-driver-input.inc2
-rw-r--r--meta/recipes-graphics/xorg-driver/xorg-driver-video.inc2
-rw-r--r--meta/recipes-graphics/xorg-xserver/xserver-abi.inc48
-rw-r--r--meta/recipes-graphics/xorg-xserver/xserver-xorg.inc32
5 files changed, 58 insertions, 44 deletions
diff --git a/meta/recipes-graphics/xorg-driver/xorg-driver-common.inc b/meta/recipes-graphics/xorg-driver/xorg-driver-common.inc
index 38848676f4..dd964d466d 100644
--- a/meta/recipes-graphics/xorg-driver/xorg-driver-common.inc
+++ b/meta/recipes-graphics/xorg-driver/xorg-driver-common.inc
@@ -20,20 +20,6 @@ inherit_defer ${XORGBUILDCLASS}
20# depends on virtual/xserver 20# depends on virtual/xserver
21REQUIRED_DISTRO_FEATURES = "x11" 21REQUIRED_DISTRO_FEATURES = "x11"
22 22
23# Function to add the relevant ABI dependency to drivers, which should be called
24# from a PACKAGEFUNC.
25def _add_xorg_abi_depends(d, name):
26 # Map of ABI names exposed in the dependencies to pkg-config variables
27 abis = {
28 "video": "abi_videodrv",
29 "input": "abi_xinput"
30 }
31
32 output = os.popen("pkg-config xorg-server --variable=%s" % abis[name]).read()
33 mlprefix = d.getVar('MLPREFIX') or ''
34 abi = "%sxorg-abi-%s-%s" % (mlprefix, name, output.split(".")[0])
35
36 pn = d.getVar("PN")
37 d.appendVar('RDEPENDS:' + pn, ' ' + abi)
38
39SECURITY_LDFLAGS = "${SECURITY_X_LDFLAGS}" 23SECURITY_LDFLAGS = "${SECURITY_X_LDFLAGS}"
24
25require recipes-graphics/xorg-xserver/xserver-abi.inc
diff --git a/meta/recipes-graphics/xorg-driver/xorg-driver-input.inc b/meta/recipes-graphics/xorg-driver/xorg-driver-input.inc
index 4efb90278c..269a78931e 100644
--- a/meta/recipes-graphics/xorg-driver/xorg-driver-input.inc
+++ b/meta/recipes-graphics/xorg-driver/xorg-driver-input.inc
@@ -1,7 +1,7 @@
1require xorg-driver-common.inc 1require xorg-driver-common.inc
2 2
3python add_xorg_abi_depends() { 3python add_xorg_abi_depends() {
4 _add_xorg_abi_depends(d, "input") 4 _add_xorg_abi_depends(d, "xinput")
5} 5}
6PACKAGEFUNCS =+ "add_xorg_abi_depends" 6PACKAGEFUNCS =+ "add_xorg_abi_depends"
7 7
diff --git a/meta/recipes-graphics/xorg-driver/xorg-driver-video.inc b/meta/recipes-graphics/xorg-driver/xorg-driver-video.inc
index c9365d8954..18441210c2 100644
--- a/meta/recipes-graphics/xorg-driver/xorg-driver-video.inc
+++ b/meta/recipes-graphics/xorg-driver/xorg-driver-video.inc
@@ -1,6 +1,6 @@
1require xorg-driver-common.inc 1require xorg-driver-common.inc
2 2
3python add_xorg_abi_depends() { 3python add_xorg_abi_depends() {
4 _add_xorg_abi_depends(d, "video") 4 _add_xorg_abi_depends(d, "videodrv")
5} 5}
6PACKAGEFUNCS =+ "add_xorg_abi_depends" 6PACKAGEFUNCS =+ "add_xorg_abi_depends"
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-abi.inc b/meta/recipes-graphics/xorg-xserver/xserver-abi.inc
new file mode 100644
index 0000000000..9731185649
--- /dev/null
+++ b/meta/recipes-graphics/xorg-xserver/xserver-abi.inc
@@ -0,0 +1,48 @@
1# Add runtime provides for the ABI versions, so that drivers can depend on the
2# relevant version. This should be called from PACKAGEFUNCS.
3python add_xorg_abi_provides() {
4 import subprocess
5
6 pn = d.getVar("PN")
7 mlprefix = d.getVar("MLPREFIX") or ""
8
9 # Set PKG_CONFIG_PATH so pkg-config looks at the .pc files that are going
10 # into the new package, not the staged ones.
11 newenv = dict(os.environ)
12 newenv["PKG_CONFIG_PATH"] = d.expand("${PKGD}${libdir}/pkgconfig/:") + newenv["PKG_CONFIG_PATH"]
13
14 # Get the list of ABIs that the pc file declares
15 cmd = ("pkg-config", "--print-variables", "xorg-server")
16 output = subprocess.run(cmd, check=True, capture_output=True, text=True, env=newenv).stdout
17 abis = [var for var in output.splitlines() if var.startswith("abi_")]
18
19 # Set RPROVIDES for those ABIs with the major version
20 for abi in abis:
21 cmd = ("pkg-config", "--variable", abi, "xorg-server")
22 version = subprocess.run(cmd, check=True, capture_output=True, text=True, env=newenv).stdout
23 major = version.split(".")[0]
24
25 provides = " %sxorg-%s-%s" % (mlprefix, abi.replace("_", "-"), major)
26 d.appendVar("RPROVIDES:" + pn, provides)
27}
28
29# Add the specified ABI dependency to the specified package.
30# If package is not set then PN is used.
31# This should be called via a shim function in PACKAGEFUNCS.
32def _add_xorg_abi_depends(d, abi, package=None):
33 import subprocess
34
35 if not package:
36 package = d.getVar("PN")
37
38 # Set PKG_CONFIG_PATH to cater for the case where xserver is
39 # itself providing drivers.
40 newenv = dict(os.environ)
41 newenv["PKG_CONFIG_PATH"] = d.expand("${PKGD}${libdir}/pkgconfig/:") + newenv["PKG_CONFIG_PATH"]
42
43 mlprefix = d.getVar("MLPREFIX") or ""
44 cmd = ("pkg-config", "xorg-server", "--variable=abi_%s" % abi)
45 output = subprocess.run(cmd, text=True, capture_output=True, check=True, env=newenv).stdout
46 abi = "%sxorg-abi-%s-%s" % (mlprefix, abi, output.split(".")[0])
47
48 d.appendVar('RDEPENDS:' + package, ' ' + abi)
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xorg.inc b/meta/recipes-graphics/xorg-xserver/xserver-xorg.inc
index e2754426cf..3eb0de7b35 100644
--- a/meta/recipes-graphics/xorg-xserver/xserver-xorg.inc
+++ b/meta/recipes-graphics/xorg-xserver/xserver-xorg.inc
@@ -79,7 +79,6 @@ PACKAGES =+ "${PN}-sdl \
79 xf86-video-modesetting" 79 xf86-video-modesetting"
80 80
81SUMMARY:xf86-video-modesetting = "X.Org X server -- modesetting display driver" 81SUMMARY:xf86-video-modesetting = "X.Org X server -- modesetting display driver"
82INSANE_SKIP:${MLPREFIX}xf86-video-modesetting = "xorg-driver-abi"
83 82
84XSERVER_RDEPENDS = "xkeyboard-config rgb xserver-xf86-config xkbcomp xf86-input-libinput" 83XSERVER_RDEPENDS = "xkeyboard-config rgb xserver-xf86-config xkbcomp xf86-input-libinput"
85RDEPENDS:${PN} += "${XSERVER_RDEPENDS}" 84RDEPENDS:${PN} += "${XSERVER_RDEPENDS}"
@@ -149,31 +148,12 @@ do_install:append () {
149 sed -i -e 's,${libdir}/xorg/modules,${prefix}/lib*/xorg/modules,' ${D}${mandir}/man5/xorg.conf.5 148 sed -i -e 's,${libdir}/xorg/modules,${prefix}/lib*/xorg/modules,' ${D}${mandir}/man5/xorg.conf.5
150} 149}
151 150
152# Add runtime provides for the ABI versions of the video and input subsystems, 151require xserver-abi.inc
153# so that drivers can depend on the relevant version. 152
154python populate_packages:prepend() { 153python add_xorg_abi_depends() {
155 import subprocess 154 _add_xorg_abi_depends(d, "videodrv", d.expand("${MLPREFIX}xf86-video-modesetting"))
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} 155}
178 156
157PACKAGEFUNCS =+ "add_xorg_abi_provides add_xorg_abi_depends"
158
179CVE_STATUS[CVE-2023-5574] = "${@bb.utils.contains('PACKAGECONFIG', 'xvfb', 'unpatched', 'not-applicable-config: specific to Xvfb', d)}" 159CVE_STATUS[CVE-2023-5574] = "${@bb.utils.contains('PACKAGECONFIG', 'xvfb', 'unpatched', 'not-applicable-config: specific to Xvfb', d)}"