diff mbox series

[bug#58887,staging] gnu: vulkan-loader: Add native-search-paths field.

Message ID y765yg1hnql.wl-hako@ultrarare.space
State New
Headers show
Series [bug#58887,staging] gnu: vulkan-loader: Add native-search-paths field. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success
cbaines/issue success View issue

Commit Message

Hilton Chain Oct. 30, 2022, 5:41 a.m. UTC
* gnu/packages/vulkan.scm (vulkan-loader): Add native-search-paths field.
[source]: Change ICD and implicit layers looking up behaviour via snippet.
---
 gnu/packages/vulkan.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)


base-commit: 63bf06013820aa26aca7dc8f18cb79403b94e9a5

Comments

Ludovic Courtès Dec. 1, 2022, 3:49 p.m. UTC | #1
Hi,

Hilton Chain <hako@ultrarare.space> skribis:

> * gnu/packages/vulkan.scm (vulkan-loader): Add native-search-paths field.
> [source]: Change ICD and implicit layers looking up behaviour via snippet.

One comment:

[...]

> +    (native-search-paths
> +     (list (search-path-specification
> +            (variable "VK_ICD_PATH")
> +            (files '("share/vulkan/icd.d")))
> +           (search-path-specification
> +            (variable "VK_ILAYER_PATH")
> +            (files '("share/vulkan/implicit_layer.d")))))

Should these read “lib” rather than “share”, given that they contain
binaries if I’m not mistaken?

Should it be versioned too, like “lib/vulkan/3.0/icd.d”?

Other than that it LGTM.

Thanks,
Ludo’.
diff mbox series

Patch

diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
index f5c619a2b2..1371860583 100644
--- a/gnu/packages/vulkan.scm
+++ b/gnu/packages/vulkan.scm
@@ -215,6 +215,22 @@  (define-public vulkan-loader
              (url "https://github.com/KhronosGroup/Vulkan-Loader")
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
+       (modules '((guix build utils)))
+       (snippet
+        '(substitute* "loader/loader.c"
+           ;; v1.3.207-
+           (("VK_ICD_FILENAMES_ENV_VAR, NULL")
+            "\"VK_ICD_PATH\", override_paths")
+           (("false, NULL, NULL")
+            "false, \"VK_ILAYER_PATH\", override_paths")
+           ;; v1.3.207+
+           (("VK_ICD_FILENAMES_ENV_VAR")
+            "\"VK_ICD_PATH\"")
+           (("relative_location = VK_ILAYERS_INFO_RELATIVE_DIR;" all)
+            (string-append "override_env = loader_secure_getenv"
+                           "(\"VK_ILAYER_PATH\", inst);" all))
+           (("\\(IMPLICIT_LAYER, \\)NULL" m)
+            (string-append m "override_paths"))))
        (sha256
         (base32
          "15gx9ab6w1sjq9hkpbas7z2f8f47j6mlln6p3w26qmydjj8gfjjv"))))
@@ -251,6 +267,13 @@  (define-public vulkan-loader
        ("wayland" ,wayland)))
     (inputs
      (list vulkan-headers))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "VK_ICD_PATH")
+            (files '("share/vulkan/icd.d")))
+           (search-path-specification
+            (variable "VK_ILAYER_PATH")
+            (files '("share/vulkan/implicit_layer.d")))))
     (home-page
      "https://github.com/KhronosGroup/Vulkan-Loader")
     (synopsis "Khronos official ICD loader and validation layers for Vulkan")