From 2aab62fe24307cd0b9a5f168bae0a004b1f54f67 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Sun, 15 Oct 2023 13:00:24 +0300 Subject: gnu: mesa: Fix cross-compiling. * gnu/packages/gl.scm (mesa)[native-inputs]: When cross-compiling add pkg-config-for-build, wayland, wayland-protocols. [arguments]: Adjust configure-flags to use cond to also match the architecture when cross-compiling. Add phase when cross-compilng to set the location of llvm-config. --- gnu/packages/gl.scm | 52 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 20 deletions(-) (limited to 'gnu/packages/gl.scm') diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm index fd59ad9605..6472158abc 100644 --- a/gnu/packages/gl.scm +++ b/gnu/packages/gl.scm @@ -301,32 +301,37 @@ (define-public mesa wayland-protocols `(,zstd "lib"))) (native-inputs - (list bison - flex - gettext-minimal - glslang - pkg-config - python-libxml2 ;for OpenGL ES 1.1 and 2.0 support - python-mako - python-wrapper - (@ (gnu packages base) which))) + (cons* bison + flex + gettext-minimal + glslang + pkg-config + python-libxml2 ;for OpenGL ES 1.1 and 2.0 support + python-mako + python-wrapper + (@ (gnu packages base) which) + (if (%current-target-system) + (list pkg-config-for-build + wayland + wayland-protocols) + '()))) (outputs '("out" "bin")) (arguments (list #:configure-flags #~(list - #$@(match (%current-system) - ("aarch64-linux" + #$@(cond + ((target-aarch64?) ;; TODO: Fix svga driver for non-Intel architectures. '("-Dgallium-drivers=etnaviv,freedreno,kmsro,lima,nouveau,\ panfrost,r300,r600,swrast,tegra,v3d,vc4,virgl")) - ("armhf-linux" + ((target-arm32?) ;; Freedreno FTBFS when built on a 64-bit machine. '("-Dgallium-drivers=etnaviv,kmsro,lima,nouveau,panfrost,\ r300,r600,swrast,tegra,v3d,vc4,virgl")) - ((or "powerpc64le-linux" "powerpc-linux" "riscv64-linux") + ((or (target-ppc64le?) (target-ppc32?) (target-riscv64?)) '("-Dgallium-drivers=nouveau,r300,r600,radeonsi,swrast,virgl")) - (_ + (else '("-Dgallium-drivers=crocus,iris,nouveau,r300,r600,radeonsi,\ svga,swrast,virgl"))) ;; Enable various optional features. TODO: opencl requires libclc, @@ -344,16 +349,16 @@ (define-public mesa "-Dshared-glapi=enabled" ;; Explicitly enable Vulkan on some architectures. - #$@(match (%current-system) - ((or "i686-linux" "x86_64-linux") + #$@(cond + ((or (target-x86-32?) (target-x86-64?)) '("-Dvulkan-drivers=intel,intel_hasvk,amd,swrast")) - ((or "powerpc64le-linux" "powerpc-linux") + ((or (target-ppc64le?) (target-ppc32?)) '("-Dvulkan-drivers=amd,swrast")) - ("aarch64-linux" + ((target-aarch64?) '("-Dvulkan-drivers=freedreno,amd,broadcom,swrast")) - ("riscv64-linux" + ((target-riscv64?) '("-Dvulkan-drivers=amd,swrast")) - (_ + (else '("-Dvulkan-drivers=auto"))) ;; Enable the Vulkan overlay layer on all architectures. @@ -381,6 +386,13 @@ (define-public mesa (guix build meson-build-system)) #:phases #~(modify-phases %standard-phases + #$@(if (%current-target-system) + #~((add-after 'unpack 'fix-cross-compiling + (lambda* (#:key inputs #:allow-other-keys) + ;; It isn't a problem to use the host's llvm-config. + (setenv "LLVM_CONFIG" + (search-input-file inputs "/bin/llvm-config"))))) + #~()) (add-after 'unpack 'disable-failing-test (lambda _ ;; Disable the intel vulkan (anv_state_pool) tests, as they may -- cgit v1.2.3