Timo Aaltonen pushed to branch debian-unstable at X Strike Force / lib / mesa


Commits:
82eed41b by Simon McVittie at 2025-04-23T16:47:51+01:00
Share a single JSON manifest per Vulkan driver between all architectures

Because our Vulkan driver libraries are installed to a directory in the
dynamic linker's search path, we can list them in their JSON manifest
by the library's basename rather than its absolute path. This makes the
content of the JSON manifest the same for each architecture, so it can
be a single file shared between architectures via dpkg's multiarch file
reference-counting.

This avoids multiarch file collisions between pairs of architectures
that have the same Meson CPU name but a different library directory,
such as armel and armhf.

The JSON manifests for Mesa's EGL driver and Vulkan layers, and for the
Nvidia proprietary driver's Vulkan driver, are already implemented
this way.

Closes: #980148
Signed-off-by: Simon McVittie <[email protected]>


- - - - -


2 changed files:

- + debian/merge-vulkan-driver-manifests.sh
- debian/rules


Changes:

=====================================
debian/merge-vulkan-driver-manifests.sh
=====================================
@@ -0,0 +1,37 @@
+#!/bin/sh
+# Copyright 2025 Collabora Ltd.
+# SPDX-License-Identifier: MIT
+
+# Usage: debian/merge-vulkan-driver-manifests.sh debian/tmp
+# DEB_HOST_MULTIARCH must be set in the environment.
+#
+# If the JSON manifest describing a Vulkan driver contains for example
+# "library_path": "/usr/lib/x86_64-linux-gnu/libvulkan_lvp.so"
+# then replace it with
+# "library_path": "libvulkan_lvp.so"
+# to get the same content for each architecture, and rename from for example
+# "lvp_icd.x86_64.json"
+# to
+# "lvp_icd.json"
+# so that the same JSON manifest will be shared between all multiarch
+# architectures.
+#
+# This avoids multiarch collisions on pairs of architectures where the
+# Meson CPU name is the same but the library path is different, notably
+# armel/armhf. https://bugs.debian.org/980148
+
+set -eu
+
+DESTDIR="$1"
+
+for file in "$DESTDIR"/usr/share/vulkan/icd.d/*.*.json; do
+       if grep -q 
'library_path.*/usr/lib/'"${DEB_HOST_MULTIARCH}"'/lib[^/"]*\.so' "${file}"; then
+               replacement="${file%.*.json}.json"
+               sed -E -e '/library_path/ 
s,/usr/lib/'"${DEB_HOST_MULTIARCH}"'/(lib[^/"]*\.so),\1,' \
+                       < "${file}" > "${replacement}"
+               diff -s -u "${file}" "${replacement}" || true
+               rm "${file}"
+       else
+               echo "multiarch library path not found in $file, leaving it 
as-is"
+       fi
+done


=====================================
debian/rules
=====================================
@@ -233,6 +233,7 @@ override_dh_auto_configure: rewrite_wrap_files
 
 override_dh_auto_install:
        dh_auto_install
+       debian/merge-vulkan-driver-manifests.sh debian/tmp
        for file in debian/*.links.in; \
        do \
                sed -e"s,\$${DEB_HOST_MULTIARCH},$(DEB_HOST_MULTIARCH),g" \



View it on GitLab: 
https://salsa.debian.org/xorg-team/lib/mesa/-/commit/82eed41b2456c20eac16f86456a8c583753a94f2

-- 
View it on GitLab: 
https://salsa.debian.org/xorg-team/lib/mesa/-/commit/82eed41b2456c20eac16f86456a8c583753a94f2
You're receiving this email because of your account on salsa.debian.org.


Reply via email to