Skip to content

Commit f6a2e6a

Browse files
committed
llvmPackages_19.libclc: fix cross compilation (#366701)
2 parents e86bead + 6ae428a commit f6a2e6a

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

pkgs/development/compilers/llvm/common/libclc.nix

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,20 @@ stdenv.mkDerivation rec {
7474
--replace 'find_program( LLVM_SPIRV llvm-spirv PATHS ''${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH )' \
7575
'find_program( LLVM_SPIRV llvm-spirv PATHS "${spirv-llvm-translator}/bin" NO_DEFAULT_PATH )'
7676
''
77-
+ lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
78-
substituteInPlace CMakeLists.txt \
79-
--replace 'COMMAND prepare_builtins' 'COMMAND ${buildLlvmTools.libclc.dev}/bin/prepare_builtins'
80-
'';
77+
+ lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) (
78+
if (lib.versionOlder release_version "19") then
79+
''
80+
substituteInPlace CMakeLists.txt \
81+
--replace 'COMMAND prepare_builtins' \
82+
'COMMAND ${buildLlvmTools.libclc.dev}/bin/prepare_builtins'
83+
''
84+
else
85+
''
86+
substituteInPlace CMakeLists.txt \
87+
--replace-fail 'set( prepare_builtins_exe prepare_builtins )' \
88+
'set( prepare_builtins_exe ${buildLlvmTools.libclc.dev}/bin/prepare_builtins )'
89+
''
90+
);
8191

8292
nativeBuildInputs =
8393
[

0 commit comments

Comments
 (0)