diff options
author | Someone Serge <sergei.kozlukov@aalto.fi> | 2023-12-21 23:59:09 +0000 |
---|---|---|
committer | Someone Serge <sergei.kozlukov@aalto.fi> | 2023-12-24 23:56:00 +0000 |
commit | dad9c990826e522976afca663de01ae75aa439ad (patch) | |
tree | f8b3d218476654da67f6462ea03166df3315e37a /pkgs/development/cuda-modules/generic-builders | |
parent | 470305582d2117f494ebd245d5cdba817e02ed14 (diff) |
cudaPackages: replace the fhs paths in pkg-config files
Cf. https://github.com/NixOS/nixpkgs/issues/224119
Diffstat (limited to 'pkgs/development/cuda-modules/generic-builders')
-rw-r--r-- | pkgs/development/cuda-modules/generic-builders/manifest.nix | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/pkgs/development/cuda-modules/generic-builders/manifest.nix b/pkgs/development/cuda-modules/generic-builders/manifest.nix index 71c914c8c8f24..6b29f55c3e31b 100644 --- a/pkgs/development/cuda-modules/generic-builders/manifest.nix +++ b/pkgs/development/cuda-modules/generic-builders/manifest.nix @@ -94,7 +94,12 @@ backendStdenv.mkDerivation ( # Traversed in the order of the outputs speficied in outputs; # entries are skipped if they don't exist in outputs. outputToPatterns = { - bin = ["bin"]; + bin = [ "bin" ]; + dev = [ + "share/pkg-config" + "**/*.pc" + "**/*.cmake" + ]; lib = [ "lib" "lib64" @@ -116,6 +121,22 @@ backendStdenv.mkDerivation ( inherit (redistribRelease.${redistArch}) sha256; }; + postPatch = '' + if [[ -d pkg-config ]] ; then + mkdir -p share/pkg-config + mv pkg-config/* share/pkg-config/ + rmdir pkg-config + fi + + for pc in share/pkg-config/*.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 + ''; + # We do need some other phases, like configurePhase, so the multiple-output setup hook works. dontBuild = true; @@ -197,6 +218,20 @@ backendStdenv.mkDerivation ( runHook postInstall ''; + doInstallCheck = true; + allowFHSReferences = false; + postInstallCheck = '' + echo "Executing postInstallCheck" + + if [[ -z "''${allowFHSReferences-}" ]] ; then + mapfile -t outputPaths < <(for o in $(getAllOutputNames); do echo "''${!o}"; done) + if grep --max-count=5 --recursive --exclude=LICENSE /usr/ "''${outputPaths[@]}" ; then + echo "Detected references to /usr" >&2 + exit 1 + fi + fi + ''; + # libcuda needs to be resolved during runtime # NOTE: Due to the use of __structuredAttrs, we can't use a list for autoPatchelfIgnoreMissingDeps, since it # will take only the first value. Instead, we produce a string with the values separated by spaces. |