From c3eb04f48df613f41220739ab642e183f2ee8c23 Mon Sep 17 00:00:00 2001 From: Daniel Martinez Date: Mon, 18 Nov 2024 19:04:45 -0500 Subject: [PATCH 1/2] mesa: build with llvm19 --- srcpkgs/mesa/template | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template index 0ff83ace1550a2..4a14daebc2fbe7 100644 --- a/srcpkgs/mesa/template +++ b/srcpkgs/mesa/template @@ -1,9 +1,9 @@ # Template file for 'mesa' pkgname=mesa version=24.2.6 -revision=1 +revision=2 build_style=meson -_llvmver=18 +_llvmver=19 #Disable LTO flag should be present, see https://gitlab.freedesktop.org/mesa/mesa/-/issues/6911 configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled @@ -26,6 +26,7 @@ changelog="https://docs.mesa3d.org/relnotes.html" distfiles="https://mesa.freedesktop.org/archive/mesa-${version}.tar.xz" checksum=2b68c4a6f204c1999815a457299f81c41ba7bf48c4674b0b2d1d8864f41f3709 +build_helper="qemu" build_options="wayland" build_options_default="wayland" @@ -142,7 +143,8 @@ fi # enabled currently by amd drivers if [ "$_have_opencl" ]; then hostmakedepends+=" clang${_llvmver} rust rust-bindgen" - makedepends+=" clang${_llvmver} libclc rust SPIRV-LLVM-Translator-devel SPIRV-Tools-devel" + makedepends+=" clang${_llvmver} libclc${_llvmver} rust + SPIRV-LLVM-Translator${_llvmver}-devel SPIRV-Tools-devel" subpackages+=" mesa-opencl" configure_args+=" -Dgallium-opencl=icd -Dgallium-rusticl=true -Drust_std=2021" fi @@ -184,6 +186,18 @@ case "$XBPS_TARGET_MACHINE" in ppc*) configure_args+=" -Dpower8=false" ;; esac +pre_configure() { + if [ "$CROSS_BUILD" ]; then + # Bug with our current llvm19 package causes a broken symlink: + # /usr/aarch64-linux-gnu/usr/lib/libLLVM-19.so -> /usr/lib/llvm/19/lib/libLLVM-19.so + # The symlink should be relative, not absolute. + # This causes breakage because the symlink is to the + # so of the wrong (host) architecture + # rm the broken symlink for now, will be fixed in the next version + rm -f "${XBPS_CROSS_BASE}/usr/lib/libLLVM-${_llvmver}.so" + fi +} + post_configure() { if [ "$CROSS_BUILD" ]; then find -iname "*.ninja" -exec sed -i "{}" \ @@ -304,7 +318,7 @@ libxatracker_package() { mesa-opencl_package() { short_desc="Mesa implementation of OpenCL (r600+ only)" - depends="libclc" + depends="libclc${_llvmver}" pkg_install() { vmove etc/OpenCL vmove usr/lib/gallium-pipe From 9123307bc118845b23f685fc79536b0474e284d8 Mon Sep 17 00:00:00 2001 From: Daniel Martinez Date: Wed, 20 Nov 2024 23:01:48 -0500 Subject: [PATCH 2/2] xbps-src: llvm-config wrapper --- common/build-helper/meson.sh | 6 +++--- common/hooks/pre-configure/02-script-wrapper.sh | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/common/build-helper/meson.sh b/common/build-helper/meson.sh index e414afbfba4bb3..02fb515f2bea6f 100644 --- a/common/build-helper/meson.sh +++ b/common/build-helper/meson.sh @@ -69,13 +69,13 @@ cat > "${XBPS_WRAPPERDIR}/meson/xbps_meson.cross" <<-EOF g-ir-scanner = '${XBPS_CROSS_BASE}/usr/bin/g-ir-scanner' g-ir-compiler = '${XBPS_CROSS_BASE}/usr/bin/g-ir-compiler' g-ir-generate = '${XBPS_CROSS_BASE}/usr/bin/g-ir-generate' - llvm-config = '/usr/bin/llvm-config' + llvm-config = 'llvm-config-qemu' cups-config = '${XBPS_CROSS_BASE}/usr/bin/cups-config' - + [properties] needs_exe_wrapper = true bindgen_clang_arguments = ['-target', '${XBPS_CROSS_TRIPLET}'] - + [host_machine] system = 'linux' cpu_family = '${_MESON_CPU_FAMILY}' diff --git a/common/hooks/pre-configure/02-script-wrapper.sh b/common/hooks/pre-configure/02-script-wrapper.sh index 004c68442c061c..c6383cd4f72963 100644 --- a/common/hooks/pre-configure/02-script-wrapper.sh +++ b/common/hooks/pre-configure/02-script-wrapper.sh @@ -50,6 +50,20 @@ generic_wrapper3() { chmod 755 ${XBPS_WRAPPERDIR}/${wrapper} } +qemu_wrapper() { + local wrapper="$1" + [ ! -x ${XBPS_CROSS_BASE}/usr/bin/${wrapper} ] && return 0 + [ ! -x qemu-${XBPS_TARGET_QEMU_MACHINE}-static ] && return 0 + [ -x ${XBPS_WRAPPERDIR}/${wrapper}-qemu ] && return 0 + +cat >>${XBPS_WRAPPERDIR}/${wrapper}-qemu<<_EOF +#!/bin/sh +export QEMU_LD_PREFIX=${XBPS_CROSS_BASE} +exec qemu-${XBPS_TARGET_QEMU_MACHINE}-static ${XBPS_CROSS_BASE}/usr/bin/${wrapper} "\$@" +_EOF + chmod 755 ${XBPS_WRAPPERDIR}/${wrapper}-qemu +} + apr_apu_wrapper() { local wrapper="$1" @@ -240,4 +254,5 @@ hook() { python_wrapper python-config 2.7 python_wrapper python3-config 3.12 apr_apu_wrapper apu-1-config + qemu_wrapper llvm-config }