Subject: [PATCH mesa-updates 6/6] gnu: mesa: Update to 24.0.2.

From: aurtzy <[email-masked]>
Date: Fri, 8 Mar 2024 15:27:16 -0500

* gnu/packages/gl.scm (mesa): Update to 24.0.2.

Change-Id: Ic4176f8a747bcb4c5210af6ccb4569589192e4a7
---
 gnu/packages/gl.scm | 68 +++++++++++++++++++++++++++++++++------------
 1 file changed, 51 insertions(+), 17 deletions(-)

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index f8dc8c1d9d..156c7cacbe 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -20,6 +20,7 @@
 ;;; Copyright © 2023 Kaelyn Takata <[email-masked]>
 ;;; Copyright © 2023, 2024 Zheng Junjie <[email-masked]>
 ;;; Copyright © 2024 Liliana Marie Prikler <[email-masked]>
+;;; Copyright © 2024 aurtzy <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -40,8 +41,10 @@ (define-module (gnu packages gl)
   #:use-module (gnu packages)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages bison)
+  #:use-module (gnu packages build-tools)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages crates-io)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages elf)
   #:use-module (gnu packages flex)
@@ -55,6 +58,7 @@ (define-module (gnu packages gl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages rust)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages video)
   #:use-module (gnu packages vulkan)
@@ -297,17 +301,17 @@ (define libva-without-mesa
 (define-public mesa
   (package
     (name "mesa")
-    (version "23.3.2")
+    (version "24.0.2")
     (source
-      (origin
-        (method url-fetch)
-        (uri (list (string-append "https://archive.mesa3d.org/"
-                                  "mesa-" version ".tar.xz")
-                   (string-append "ftp://ftp.freedesktop.org/pub/mesa/"
-                                  "mesa-" version ".tar.xz")))
-        (sha256
-         (base32
-          "1p4swrbmz3kb1805kdj973hf8virgmix4m9qprmcb2bgl4gviz1w"))))
+     (origin
+       (method url-fetch)
+       (uri (list (string-append "https://archive.mesa3d.org/"
+                                 "mesa-" version ".tar.xz")
+                  (string-append "ftp://ftp.freedesktop.org/pub/mesa/"
+                                 "mesa-" version ".tar.xz")))
+       (sha256
+        (base32
+         "1s69asdh7cz10abr63q8qdiamdcy7cjkzd9yp398wvfhva78mqll"))))
     (build-system meson-build-system)
     (propagated-inputs
      ;; The following are in the Requires.private field of gl.pc.
@@ -340,15 +344,22 @@ (define-public mesa
             python-mako
             python-wrapper
             (@ (gnu packages base) which)
-            (if (%current-target-system)
-              (list cmake-minimal-cross
-                    pkg-config-for-build
-                    wayland
-                    wayland-protocols)
-              '())))
+            (append
+             (if (%current-target-system)
+                 (list cmake-minimal-cross
+                       pkg-config-for-build
+                       wayland
+                       wayland-protocols)
+                 '())
+             (if (target-x86-64?)
+                 (list clang-15
+                       rust-bindgen-cli-0.69
+                       rust)
+                 '()))))
     (outputs '("out" "bin"))
     (arguments
      (list
+      #:meson meson-1.3
       #:configure-flags
       #~(list
          #$@(cond
@@ -381,7 +392,9 @@ (define-public mesa
 
          ;; Explicitly enable Vulkan on some architectures.
          #$@(cond
-             ((or (target-x86-32?) (target-x86-64?))
+             ((target-x86-64?)
+              '("-Dvulkan-drivers=intel,intel_hasvk,amd,swrast,nouveau-experimental"))
+             ((target-x86-32?)
               '("-Dvulkan-drivers=intel,intel_hasvk,amd,swrast"))
              ((or (target-ppc64le?) (target-ppc32?))
               '("-Dvulkan-drivers=amd,swrast"))
@@ -478,6 +491,27 @@ (define-public mesa
                       (("'lp_test_arit', ") ""))))
                  (_
                   '((display "No tests to disable on this architecture.\n"))))))
+          (add-after 'unpack 'change-subproject-sources
+            ;; Subproject source URLs are patched to point to the store,
+            ;; which avoids an attempt to download them mid-build.
+            (lambda _
+              (for-each
+               (lambda (subproject)
+                 (let ((file (car subproject))
+                       (input (cdr subproject)))
+                   (substitute* file
+                     (("https.*/download")
+                      (string-append "file://" input)))))
+               '#$(if (target-x86-64?)
+                      #~(("subprojects/syn.wrap"
+                          . #$(package-source rust-syn-2.0.39))
+                         ("subprojects/unicode-ident.wrap"
+                          . #$(package-source rust-unicode-ident-1))
+                         ("subprojects/quote.wrap"
+                          . #$(package-source rust-quote-1.0.33))
+                         ("subprojects/proc-macro2.wrap"
+                          . #$(package-source rust-proc-macro2-1.0.70)))
+                      '()))))
          (add-before 'configure 'fix-dlopen-libnames
            (lambda _
              (let ((out #$output))
-- 
2.41.0