about summary refs log tree commit diff
path: root/pkgs/development/cuda-modules
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/cuda-modules')
-rw-r--r--pkgs/development/cuda-modules/generic-builders/manifest.nix27
-rw-r--r--pkgs/development/cuda-modules/setup-hooks/auto-add-cuda-compat-runpath.sh2
-rw-r--r--pkgs/development/cuda-modules/setup-hooks/auto-add-opengl-runpath-hook.sh2
3 files changed, 22 insertions, 9 deletions
diff --git a/pkgs/development/cuda-modules/generic-builders/manifest.nix b/pkgs/development/cuda-modules/generic-builders/manifest.nix
index 5a4c5280d7db..5cde8552effc 100644
--- a/pkgs/development/cuda-modules/generic-builders/manifest.nix
+++ b/pkgs/development/cuda-modules/generic-builders/manifest.nix
@@ -26,6 +26,7 @@
   redistribRelease,
   # See ./modules/generic/manifests/feature/release.nix
   featureRelease,
+  cudaMajorMinorVersion,
 }:
 let
   inherit (lib)
@@ -98,7 +99,7 @@ backendStdenv.mkDerivation (
     outputToPatterns = {
       bin = [ "bin" ];
       dev = [
-        "share/pkg-config"
+        "share/pkgconfig"
         "**/*.pc"
         "**/*.cmake"
       ];
@@ -127,22 +128,34 @@ backendStdenv.mkDerivation (
       sha256 = redistribRelease.${redistArch}.sha256 or lib.fakeHash;
     };
 
+    # Handle the pkg-config files:
+    # 1. No FHS
+    # 2. Location expected by the pkg-config wrapper
+    # 3. Generate unversioned names too
     postPatch = ''
-      if [[ -d pkg-config ]] ; then
-        mkdir -p share/pkg-config
-        mv pkg-config/* share/pkg-config/
-        rmdir pkg-config
-      fi
+      for path in pkg-config pkgconfig ; do
+        [[ -d "$path" ]] || continue
+        mkdir -p share/pkgconfig
+        mv "$path"/* share/pkgconfig/
+        rmdir "$path"
+      done
 
-      for pc in share/pkg-config/*.pc ; do
+      for pc in share/pkgconfig/*.pc ; do
         sed -i \
           -e "s|^cudaroot\s*=.*\$|cudaroot=''${!outputDev}|" \
           -e "s|^libdir\s*=.*/lib\$|libdir=''${!outputLib}/lib|" \
           -e "s|^includedir\s*=.*/include\$|includedir=''${!outputDev}/include|" \
           "$pc"
       done
+
+      # E.g. cuda-11.8.pc -> cuda.pc
+      for pc in share/pkgconfig/*-"$majorMinorVersion.pc" ; do
+        ln -s "$(basename "$pc")" "''${pc%-$majorMinorVersion.pc}".pc
+      done
     '';
 
+    env.majorMinorVersion = cudaMajorMinorVersion;
+
     # We do need some other phases, like configurePhase, so the multiple-output setup hook works.
     dontBuild = true;
 
diff --git a/pkgs/development/cuda-modules/setup-hooks/auto-add-cuda-compat-runpath.sh b/pkgs/development/cuda-modules/setup-hooks/auto-add-cuda-compat-runpath.sh
index 537daad2f00e..ae25cebaca6f 100644
--- a/pkgs/development/cuda-modules/setup-hooks/auto-add-cuda-compat-runpath.sh
+++ b/pkgs/development/cuda-modules/setup-hooks/auto-add-cuda-compat-runpath.sh
@@ -10,7 +10,7 @@ elfHasDynamicSection() {
 autoAddCudaCompatRunpathPhase() (
   local outputPaths
   mapfile -t outputPaths < <(for o in $(getAllOutputNames); do echo "${!o}"; done)
-  find "${outputPaths[@]}" -type f -executable -print0  | while IFS= read -rd "" f; do
+  find "${outputPaths[@]}" -type f -print0  | while IFS= read -rd "" f; do
     if isELF "$f"; then
       # patchelf returns an error on statically linked ELF files
       if elfHasDynamicSection "$f" ; then
diff --git a/pkgs/development/cuda-modules/setup-hooks/auto-add-opengl-runpath-hook.sh b/pkgs/development/cuda-modules/setup-hooks/auto-add-opengl-runpath-hook.sh
index f50a5f6c25c6..a6eeef7c7699 100644
--- a/pkgs/development/cuda-modules/setup-hooks/auto-add-opengl-runpath-hook.sh
+++ b/pkgs/development/cuda-modules/setup-hooks/auto-add-opengl-runpath-hook.sh
@@ -9,7 +9,7 @@ elfHasDynamicSection() {
 autoAddOpenGLRunpathPhase() (
   local outputPaths
   mapfile -t outputPaths < <(for o in $(getAllOutputNames); do echo "${!o}"; done)
-  find "${outputPaths[@]}" -type f -executable -print0  | while IFS= read -rd "" f; do
+  find "${outputPaths[@]}" -type f -print0  | while IFS= read -rd "" f; do
     if isELF "$f"; then
       # patchelf returns an error on statically linked ELF files
       if elfHasDynamicSection "$f" ; then