Skip to content

Commit

Permalink
llvmPackages_19.libclc: fix cross compilation (NixOS#366701)
Browse files Browse the repository at this point in the history
  • Loading branch information
vcunat committed Dec 25, 2024
2 parents e86bead + 6ae428a commit f6a2e6a
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions pkgs/development/compilers/llvm/common/libclc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,20 @@ stdenv.mkDerivation rec {
--replace 'find_program( LLVM_SPIRV llvm-spirv PATHS ''${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH )' \
'find_program( LLVM_SPIRV llvm-spirv PATHS "${spirv-llvm-translator}/bin" NO_DEFAULT_PATH )'
''
+ lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
substituteInPlace CMakeLists.txt \
--replace 'COMMAND prepare_builtins' 'COMMAND ${buildLlvmTools.libclc.dev}/bin/prepare_builtins'
'';
+ lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) (
if (lib.versionOlder release_version "19") then
''
substituteInPlace CMakeLists.txt \
--replace 'COMMAND prepare_builtins' \
'COMMAND ${buildLlvmTools.libclc.dev}/bin/prepare_builtins'
''
else
''
substituteInPlace CMakeLists.txt \
--replace-fail 'set( prepare_builtins_exe prepare_builtins )' \
'set( prepare_builtins_exe ${buildLlvmTools.libclc.dev}/bin/prepare_builtins )'
''
);

nativeBuildInputs =
[
Expand Down

0 comments on commit f6a2e6a

Please sign in to comment.