diff mbox series

[bug#69637,mesa-updates,v2,5/5] gnu: mesa: Update to 24.0.3.

Message ID 06ab73253d226155792ae2817c74d0f8d790db14.1711091869.git.aurtzy@gmail.com
State New
Headers show
Series gnu: mesa: Update to 24.0.3. | expand

Commit Message

aurtzy March 22, 2024, 7:33 a.m. UTC
* gnu/packages/gl.scm (mesa): Update to 24.0.3.

Change-Id: Ic4176f8a747bcb4c5210af6ccb4569589192e4a7
---
 gnu/packages/gl.scm | 80 +++++++++++++++++++++++++++++++++++----------
 1 file changed, 62 insertions(+), 18 deletions(-)
diff mbox series

Patch

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index f8dc8c1d9d..0265716ac0 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -20,6 +20,7 @@ 
 ;;; Copyright © 2023 Kaelyn Takata <kaelyn.alexi@protonmail.com>
 ;;; Copyright © 2023, 2024 Zheng Junjie <873216071@qq.com>
 ;;; Copyright © 2024 Liliana Marie Prikler <liliana.prikler@gmail.com>
+;;; Copyright © 2024 aurtzy <aurtzy@gmail.com>
 ;;;
 ;;; 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,8 @@  (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 rust-apps)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages video)
   #:use-module (gnu packages vulkan)
@@ -297,17 +302,17 @@  (define libva-without-mesa
 (define-public mesa
   (package
     (name "mesa")
-    (version "23.3.2")
+    (version "24.0.3")
     (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
+         "1gpx3glifdvyw2fxigiannrxkdfhag6b6h0nxab3azbvlfickbkp"))))
     (build-system meson-build-system)
     (propagated-inputs
      ;; The following are in the Requires.private field of gl.pc.
@@ -340,15 +345,23 @@  (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)
+                 '())
+             ;; NVK-specific inputs
+             (if (target-x86-64?)
+                 (list clang-15
+                       rust-bindgen-cli
+                       rust)
+                 '()))))
     (outputs '("out" "bin"))
     (arguments
      (list
+      #:meson meson-1.3
       #:configure-flags
       #~(list
          #$@(cond
@@ -379,9 +392,12 @@  (define-public mesa
          "-Dgbm=enabled"
          "-Dshared-glapi=enabled"
 
-         ;; Explicitly enable Vulkan on some architectures.
+         ;; Explicitly enable Vulkan on some architectures.  TODO: Identify other
+         ;; architectures where nouveau (NVK) works and enable it for them
          #$@(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 +494,34 @@  (define-public mesa
                       (("'lp_test_arit', ") ""))))
                  (_
                   '((display "No tests to disable on this architecture.\n"))))))
+         #$@(if (target-x86-64?)
+                #~((add-after 'unpack 'change-subproject-sources
+                     ;; Patch subproject source URLs to point to the store, which lets
+                     ;; meson correctly identify rust inputs and avoid an attempt to
+                     ;; download them mid-build.
+                     (lambda _
+                       (for-each
+                        (match-lambda
+                          ((file input)
+                           (substitute* file
+                             (("source_url = .*$")
+                              "")
+                             (("source_hash = .*$")
+                              "")
+                             (("(source_filename = ).*$" all assign)
+                              (string-append assign input "\n")))))
+                        ;; TODO: Patch mesa to allow for using sources with different
+                        ;; versions so we don't have to package these crates
+                        ;; specifically for mesa.
+                        '(("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))