With AMDVLK being put out to pasture I wanted to get RADV working but the vulkan-radeon package wont install due to the systemd-libs requirement so I worked out a PKGBUILD that I thought others might get some use out of as well. Hopefully RADV becomes part of the default Obarun MESA install for the next release so this will no longer be needed.
pkgname=mesa-radv-icd
pkgver=git$(date +%Y%m%d%H%M)
pkgrel=1
arch=('x86_64')
pkgdesc="RADV Vulkan ICD and driver built from Mesa (coexists with system mesa)"
url="https://www.mesa3d.org/"
license=('MIT' 'BSD')
depends=('vulkan-icd-loader' 'libdrm' 'libx11' 'libxrandr')
makedepends=('meson' 'ninja' 'git' 'python' 'vulkan-headers' 'llvm' 'libx11' 'wayland-protocols' 'libdrm' 'clang')
source=("git+https://gitlab.freedesktop.org/mesa/mesa.git")
sha256sums=('SKIP')
_get_srcdir() {
if [ -d "${srcdir}/mesa" ]; then
echo "${srcdir}/mesa"
else
echo "${srcdir}"
fi
}
prepare() {
sd="$(_get_srcdir)"
cd "${sd}" || return 1
# optional: git checkout <tag-or-commit>
}
build() {
sd="$(_get_srcdir)"
cd "${sd}" || return 1
rm -rf builddir
# Optionally force clang:
# export CC=clang
# export CXX=clang++
meson setup builddir \
-Dprefix=/usr \
-Dvulkan-drivers=amd \
-Dgallium-drivers= \
-Dplatforms=x11,wayland \
-Dshared-glapi=enabled \
-Dbuildtype=release \
-Db_lto=false \
-Dc_args="-O2" \
-Dcpp_args="-O2"
ninja -C builddir
}
package() {
set -x
sd="$(_get_srcdir)"
cd "${sd}" || return 1
install -d "${pkgdir}/usr/share/vulkan/icd.d"
install -d "${pkgdir}/usr/lib"
install -d "${pkgdir}/usr/share/doc/${pkgname}"
vulkan_dir="${sd}/builddir/src/amd/vulkan"
# Find ICD JSON (try several common names)
found_icd=""
for p in 'radv_icd*.json' 'radeon_icd*.json' 'radeon_devenv_icd*.json'; do
if [ -d "${vulkan_dir}" ]; then
f="$(find "${vulkan_dir}" -maxdepth 3 -type f -name "${p}" -print -quit 2>/dev/null || true)"
if [ -n "${f}" ]; then
found_icd="${f}"
break
fi
fi
f="$(find "${sd}/builddir" "${sd}/src" -type f -name "${p}" -print -quit 2>/dev/null || true)"
if [ -n "${f}" ]; then
found_icd="${f}"
break
fi
done
if [ -z "${found_icd}" ]; then
echo "ERROR: ICD JSON not found; listing candidate directories:"
ls -la "${vulkan_dir}" || true
find "${sd}/builddir" "${sd}/src" -maxdepth 4 -type f -name '*icd*.json' -print || true
set +x
return 1
fi
echo "Installing ICD JSON: ${found_icd}"
install -Dm644 "${found_icd}" "${pkgdir}/usr/share/vulkan/icd.d/radv_icd.x86_64.json"
# Helper to copy files and recreate symlinks
copy_file_or_symlink() {
srcpath="$1"
bn="$(basename "${srcpath}")"
dest="${pkgdir}/usr/lib/${bn}"
if [ -L "${srcpath}" ]; then
target="$(readlink -f "${srcpath}")"
install -Dm644 "${target}" "${pkgdir}/usr/lib/$(basename "${target}")"
ln -sf "$(basename "${target}")" "${dest}"
else
install -Dm644 "${srcpath}" "${dest}"
fi
}
# Copy libvulkan_radeon and helper libs. Use temp files to avoid subshell scoping issues.
copied=0
# First: search vulkan_dir (includes files inside .so.p)
if [ -d "${vulkan_dir}" ]; then
tmpf="$(mktemp -t mesa-radv-icd.XXXXXX)" || tmpf="/tmp/mesa-radv-icd.$$"
find "${vulkan_dir}" -maxdepth 4 -type f \( -name 'libvulkan_radeon.so*' -o -name 'radv*.so*' -o -name 'radeon*.so*' -o -name 'amdgpu*.so*' \) -print0 2>/dev/null > "${tmpf}"
if [ -s "${tmpf}" ]; then
while IFS= read -r -d '' f; do
copy_file_or_symlink "${f}"
copied=1
done < "${tmpf}"
fi
rm -f "${tmpf}"
fi
# Fallback: search entire builddir/src tree
if [ "${copied}" -eq 0 ]; then
tmpf="$(mktemp -t mesa-radv-icd.XXXXXX)" || tmpf="/tmp/mesa-radv-icd.$$"
find "${sd}/builddir" "${sd}/src" -type f -maxdepth 8 \( -name 'libvulkan_radeon.so*' -o -name 'radv*.so*' -o -name 'radeon*.so*' -o -name 'amdgpu*.so*' \) -print0 2>/dev/null > "${tmpf}"
if [ -s "${tmpf}" ]; then
while IFS= read -r -d '' f; do
copy_file_or_symlink "${f}"
copied=1
done < "${tmpf}"
fi
rm -f "${tmpf}"
fi
if [ "${copied}" -eq 0 ]; then
echo "ERROR: libvulkan_radeon or RADV helper libs not found; listing vulkan dir:"
ls -la "${vulkan_dir}" || true
set +x
return 1
fi
chmod -R 755 "${pkgdir}/usr/lib" || true
chmod 644 "${pkgdir}/usr/share/vulkan/icd.d/radv_icd.x86_64.json" || true
if [ -f "${sd}/COPYING" ]; then
install -Dm644 "${sd}/COPYING" "${pkgdir}/usr/share/doc/${pkgname}/COPYING"
fi
set +x
echo "package() completed successfully"
}