about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorMario Rodas <marsam@users.noreply.github.com>2023-09-21 19:25:08 -0500
committerGitHub <noreply@github.com>2023-09-21 19:25:08 -0500
commit9543950110be753eb8e66d43431acccb20d352b0 (patch)
treed3645c1dc1262c39b7a1f11b00ec7b3629cc6779 /pkgs
parentaea649223beaf0ade154eff5c3206982d21a5e88 (diff)
parent238571b21b35085b22a219bc01cf73a0582bc2bb (diff)
Merge pull request #253026 from reckenrode/llvm-spirv-16
llvm-spirv-translator: add llvm 16 variant
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/compilers/spirv-llvm-translator/default.nix18
1 files changed, 17 insertions, 1 deletions
diff --git a/pkgs/development/compilers/spirv-llvm-translator/default.nix b/pkgs/development/compilers/spirv-llvm-translator/default.nix
index 19fa928a4d0e7..c5e8ee5a6214e 100644
--- a/pkgs/development/compilers/spirv-llvm-translator/default.nix
+++ b/pkgs/development/compilers/spirv-llvm-translator/default.nix
@@ -1,5 +1,6 @@
 { lib, stdenv
 , fetchFromGitHub
+, fetchpatch
 , cmake
 , pkg-config
 , lit
@@ -14,7 +15,11 @@ let
 
   # ROCm will always be at the latest version
   branch =
-    if llvmMajor == "15" || isROCm then rec {
+    if llvmMajor == "16" then rec {
+      version = "16.0.0";
+      rev = "v${version}";
+      hash = "sha256-EUabcYqSjXshbPmcs1DRLvCSL1nd9rEdpqELBrItCW8=";
+    } else if llvmMajor == "15" || isROCm then rec {
       version = "15.0.0";
       rev = "v${version}";
       hash = "sha256-OsDohXRxovtEXaWiRGp8gJ0dXmoALyO+ZimeSO8aPVI=";
@@ -38,6 +43,14 @@ stdenv.mkDerivation {
     inherit (branch) rev hash;
   };
 
+  patches = lib.optionals (llvmMajor == "16")[
+    # Fixes builds that link against external LLVM dynamic library
+    (fetchpatch {
+      url = "https://github.com/KhronosGroup/SPIRV-LLVM-Translator/commit/f3b9b604d7eda18d0d1029d94a6eebd33aa3a3fe.patch";
+      hash = "sha256-opDjyZcy7O4wcSfm/A51NCIiDyIvbcmbv9ns1njdJbc=";
+    })
+  ];
+
   nativeBuildInputs = [ pkg-config cmake spirv-tools ]
     ++ (if isROCm then [ llvm ] else [ llvm.dev ]);
 
@@ -62,6 +75,9 @@ stdenv.mkDerivation {
 
   postInstall = ''
     install -D tools/llvm-spirv/llvm-spirv $out/bin/llvm-spirv
+  '' + lib.optionalString stdenv.isDarwin ''
+    install_name_tool $out/bin/llvm-spirv \
+      -change @rpath/libLLVMSPIRVLib.dylib $out/lib/libLLVMSPIRVLib.dylib
   '';
 
   meta = with lib; {