diff --git a/pkgs/development/compilers/llvm/common/libclc/libclc-gnu-install-dirs.patch b/pkgs/development/compilers/llvm/16/libclc/gnu-install-dirs.patch similarity index 100% rename from pkgs/development/compilers/llvm/common/libclc/libclc-gnu-install-dirs.patch rename to pkgs/development/compilers/llvm/16/libclc/gnu-install-dirs.patch diff --git a/pkgs/development/compilers/llvm/20/libclc/use-default-paths.patch b/pkgs/development/compilers/llvm/20/libclc/use-default-paths.patch new file mode 100644 index 000000000000..2fbcf56426d6 --- /dev/null +++ b/pkgs/development/compilers/llvm/20/libclc/use-default-paths.patch @@ -0,0 +1,22 @@ +From e8b910246d0c7c3d9fff994f71c6f8a48ec09a50 Mon Sep 17 00:00:00 2001 +From: Tristan Ross +Date: Sat, 24 Aug 2024 19:56:24 -0700 +Subject: [PATCH] [libclc] use default paths with find_program when possible + +--- + libclc/CMakeLists.txt | 4 ++-- + 1 file changed, 1 insertions(+), 1 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 02bb859ae8590b..6bcd8ae52a5794 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -55,7 +55,7 @@ if( LIBCLC_STANDALONE_BUILD OR CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DI + # Import required tools + if( NOT EXISTS ${LIBCLC_CUSTOM_LLVM_TOOLS_BINARY_DIR} ) + foreach( tool IN ITEMS clang llvm-as llvm-link opt ) +- find_program( LLVM_TOOL_${tool} ${tool} PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH ) ++ find_program( LLVM_TOOL_${tool} ${tool} PATHS ${LLVM_TOOLS_BINARY_DIR} ) + set( ${tool}_exe ${LLVM_TOOL_${tool}} ) + set( ${tool}_target ) + endforeach() diff --git a/pkgs/development/compilers/llvm/21/libclc/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/21/libclc/gnu-install-dirs.patch new file mode 100644 index 000000000000..637e33d981ef --- /dev/null +++ b/pkgs/development/compilers/llvm/21/libclc/gnu-install-dirs.patch @@ -0,0 +1,8 @@ +--- a/libclc.pc.in ++++ b/libclc.pc.in +@@ -1,4 +1,4 @@ +-libexecdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/clc ++libexecdir=@CMAKE_INSTALL_FULL_DATADIR@/clc + + Name: libclc + Description: Library requirements of the OpenCL C programming language diff --git a/pkgs/development/compilers/llvm/common/default.nix b/pkgs/development/compilers/llvm/common/default.nix index 2fc33f526385..f5c478f88e13 100644 --- a/pkgs/development/compilers/llvm/common/default.nix +++ b/pkgs/development/compilers/llvm/common/default.nix @@ -484,7 +484,7 @@ let } // lib.optionalAttrs - (lib.versionAtLeast metadata.release_version "16" && lib.versionOlder metadata.release_version "20") + (lib.versionAtLeast metadata.release_version "16" && lib.versionOlder metadata.release_version "22") { libclc = callPackage ./libclc { }; } diff --git a/pkgs/development/compilers/llvm/common/libclc/default.nix b/pkgs/development/compilers/llvm/common/libclc/default.nix index 5a3f7d4eba67..cd407ccf4486 100644 --- a/pkgs/development/compilers/llvm/common/libclc/default.nix +++ b/pkgs/development/compilers/llvm/common/libclc/default.nix @@ -50,7 +50,7 @@ stdenv.mkDerivation (finalAttrs: { ]; patches = [ - ./libclc-gnu-install-dirs.patch + (getVersionFile "libclc/gnu-install-dirs.patch") ] # LLVM 19 changes how host tools are looked up. # Need to remove NO_DEFAULT_PATH and the PATHS arguments for find_program diff --git a/pkgs/development/compilers/llvm/common/patches.nix b/pkgs/development/compilers/llvm/common/patches.nix index 4574dd6cea48..21eb8c4471c3 100644 --- a/pkgs/development/compilers/llvm/common/patches.nix +++ b/pkgs/development/compilers/llvm/common/patches.nix @@ -236,7 +236,23 @@ "libclc/use-default-paths.patch" = [ { after = "19"; + before = "20"; path = ../19; } + { + after = "20"; + path = ../20; + } + ]; + "libclc/gnu-install-dirs.patch" = [ + { + after = "16"; + before = "21"; + path = ../16; + } + { + after = "21"; + path = ../21; + } ]; }