Subject: [bug#69461] [mesa-updates 07/13] gnu: vulkan-loader: Update to vulkan-sdk-1.3.275.0

From: dan <[email-masked]>
Date: Thu, 29 Feb 2024 01:31:40 +0800

* gnu/packages/vulkan.scm (vulkan-loader): Update to vulkan-sdk-1.3.275.0.
  [arguments]<#:phases>: Change the place setting system googletest.
  [native-search-paths]: export XDG_DATA_DIRS.

Change-Id: Ibd74e303a2be4f972917c2e88367eca7db6fbc5b
---
 gnu/packages/vulkan.scm | 86 ++++++++++++++++++-----------------------
 1 file changed, 37 insertions(+), 49 deletions(-)

diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
index ea02d9887b..8e162402fa 100644
--- a/gnu/packages/vulkan.scm
+++ b/gnu/packages/vulkan.scm
@@ -46,7 +46,6 @@ (define-module (gnu packages vulkan)
   #:use-module (gnu packages wine)
   #:use-module (gnu packages xorg))
 
-;; Note: Remember to change vulkan-loader version when bumping this.
 (define %vulkan-sdk-version "vulkan-sdk-1.3.275.0")
 
 (define-public spirv-headers
@@ -245,19 +244,16 @@ (define-public vulkan-headers
 (define-public vulkan-loader
   (package
     (name "vulkan-loader")
-    ;; XXX: Take a slightly newer commit to fix a test failure on i686:
-    ;; https://github.com/KhronosGroup/Vulkan-Loader/pull/1036
-    (version "sdk-1.3.232")
+    (version %vulkan-sdk-version)
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
              (url "https://github.com/KhronosGroup/Vulkan-Loader")
-             (commit "v1.3.232")))
+             (commit version)))
        (file-name (git-file-name name version))
        (sha256
-        (base32
-         "0w69sh669sx9pwlvv2rv92ds2hm2rbzsa6qqcmd8kcad0qfq7dz2"))))
+        (base32 "0kcq6xsm151mk08vvqjlhj5mfxv4zgq35a2yi4f7yax20mfd8wz7"))))
     (build-system cmake-build-system)
     (arguments
      (list
@@ -265,45 +261,38 @@ (define-public vulkan-loader
       ;; Limit the tests to those architectures tested upstream.
       #:tests? (and (%current-system)
                     (target-x86?))
-      #:configure-flags
-      #~(list (string-append "-DVULKAN_HEADERS_INSTALL_DIR="
-                             (dirname (dirname
-                                       (search-input-directory
-                                        %build-inputs "include/vulkan"))))
-              #$@(if (%current-target-system)
-                     #~("-DBUILD_TESTS=OFF" "-DUSE_GAS=OFF")
-                     #~("-DBUILD_TESTS=ON")))
-       #:phases
-       #~(modify-phases %standard-phases
-           (add-after 'unpack 'fix-pkg-config-file
-             (lambda* (#:key inputs #:allow-other-keys)
-               (let ((vulkan-headers (dirname (search-input-directory
-                                               inputs "include/vulkan"))))
-                 ;; Ensure the pkg-config file refers to vulkan-headers.
-                 (substitute* "loader/vulkan.pc.in"
-                   (("^includedir=.*")
-                    (string-append "includedir=" vulkan-headers "\n"))))))
-           (add-after 'unpack 'use-system-googletest
-             (lambda _
-               ;; Inform the build system that googletest is already built.
-               (substitute* "CMakeLists.txt"
-                 ((".*if\\(TARGET gtest\\)")
-                  (string-append "    find_package(GTest REQUIRED)\n"
-                                 "    if(true)")))
-               ;; Use the namespaced variable.
-               (substitute* "tests/framework/CMakeLists.txt"
-                 (("PUBLIC gtest ")
-                  "PUBLIC GTest::gtest ")))))))
-    (native-inputs
-     (list googletest
-           libxrandr
-           pkg-config
-           python
-           wayland))
-    (inputs
-     (list vulkan-headers libxrandr))
-    (home-page
-     "https://github.com/KhronosGroup/Vulkan-Loader")
+      #:configure-flags #~(list (string-append "-DVULKAN_HEADERS_INSTALL_DIR="
+                                 (dirname (dirname (search-input-directory
+                                                    %build-inputs
+                                                    "include/vulkan"))))
+                                #$@(if (%current-target-system)
+                                       #~("-DBUILD_TESTS=OFF" "-DUSE_GAS=OFF")
+                                       #~("-DBUILD_TESTS=ON")))
+      #:phases #~(modify-phases %standard-phases
+                   (add-after 'unpack 'fix-pkg-config-file
+                     (lambda* (#:key inputs #:allow-other-keys)
+                       (let ((vulkan-headers (dirname (search-input-directory
+                                                       inputs "include/vulkan"))))
+                         ;; Ensure the pkg-config file refers to vulkan-headers.
+                         (substitute* "loader/vulkan.pc.in"
+                           (("^includedir=.*")
+                            (string-append "includedir=" vulkan-headers "\n"))))))
+                   (add-after 'unpack 'use-system-googletest
+                     (lambda _
+                       (substitute* "tests/CMakeLists.txt"
+                         (("message\\(FATAL_ERROR \"Could not find googletest directory. See BUILD.md\"\\)")
+                          "find_package(GTest REQUIRED)"))
+                       ;; Use the namespaced variable.
+                       (substitute* "tests/framework/CMakeLists.txt"
+                         (("PUBLIC gtest ")
+                          "PUBLIC GTest::gtest ")))))))
+    (native-inputs (list googletest libxrandr pkg-config python wayland))
+    (inputs (list vulkan-headers libxrandr))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "XDG_DATA_DIRS")
+            (files '("share")))))
+    (home-page "https://github.com/KhronosGroup/Vulkan-Loader")
     (synopsis "Khronos official ICD loader and validation layers for Vulkan")
     (description
      "Vulkan allows multiple @dfn{Installable Client Drivers} (ICDs) each
@@ -313,9 +302,8 @@ (define-public vulkan-loader
 and the ICD.")
     ;; This software is mainly Apache 2.0 licensed, but contains some components
     ;; covered by other licenses.  See COPYRIGHT.txt for details.
-    (license (list license:asl2.0       ;LICENSE.txt
-                   (license:x11-style "file://COPYRIGHT.txt")
-                   license:bsd-3))))
+    (license (list license:asl2.0 ;LICENSE.txt
+                   (license:x11-style "file://COPYRIGHT.txt") license:bsd-3))))
 
 (define-public vulkan-tools
   (package
-- 
2.41.0