mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-31 17:23:34 +00:00
cudaPackages.autoAddOpenGLRunpathHook: fix to skip unsupported/unneed
This commit is contained in:
parent
6a830314d4
commit
03e72e46cb
@ -1,14 +1,24 @@
|
||||
# Run autoOpenGLRunpath on all files
|
||||
# shellcheck shell=bash
|
||||
# Run addOpenGLRunpath on all dynamically linked, ELF files
|
||||
echo "Sourcing auto-add-opengl-runpath-hook"
|
||||
|
||||
autoAddOpenGLRunpathPhase () {
|
||||
# TODO: support multiple outputs
|
||||
for file in $(find ${out,lib,bin} -type f); do
|
||||
addOpenGLRunpath $file
|
||||
done
|
||||
}
|
||||
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
|
||||
if isELF "$f"; then
|
||||
# patchelf returns an error on statically linked ELF files
|
||||
if patchelf --print-interpreter "$f" >/dev/null 2>&1; then
|
||||
echo "autoAddOpenGLRunpathHook: patching $f"
|
||||
addOpenGLRunpath "$f"
|
||||
elif [ -n "${DEBUG-}" ]; then
|
||||
echo "autoAddOpenGLRunpathHook: skipping ELF file $f"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
)
|
||||
|
||||
if [ -z "${dontUseAutoAddOpenGLRunpath-}" ]; then
|
||||
echo "Using autoAddOpenGLRunpathPhase"
|
||||
postFixupHooks+=(autoAddOpenGLRunpathPhase)
|
||||
echo "Using autoAddOpenGLRunpathPhase"
|
||||
postFixupHooks+=(autoAddOpenGLRunpathPhase)
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user