-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libglvnd, ocl-icd, vulkan-loader: Add /run/opengl-driver(-32) to RUNP…
…ATH. (#60985) libglvnd, ocl-icd, vulkan-loader: Add /run/opengl-driver(-32) to RUNPATH.
- Loading branch information
Showing
10 changed files
with
110 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ lib, stdenv }: | ||
|
||
stdenv.mkDerivation { | ||
name = "add-opengl-runpath"; | ||
|
||
driverLink = "/run/opengl-driver" + lib.optionalString stdenv.isi686 "-32"; | ||
|
||
buildCommand = '' | ||
mkdir -p $out/nix-support | ||
substituteAll ${./setup-hook.sh} $out/nix-support/setup-hook | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Set RUNPATH so that driver libraries in /run/opengl-driver(-32)/lib can be found. | ||
# This is needed to not rely on LD_LIBRARY_PATH which does not work with setuid | ||
# executables. Fixes https://github.com/NixOS/nixpkgs/issues/22760. It must be run | ||
# in postFixup because RUNPATH stripping in fixup would undo it. Note that patchelf | ||
# actually sets RUNPATH not RPATH, which applies only to dependencies of the binary | ||
# it set on (including for dlopen), so the RUNPATH must indeed be set on these | ||
# libraries and would not work if set only on executables. | ||
addOpenGLRunpath() { | ||
local forceRpath= | ||
|
||
while [ $# -gt 0 ]; do | ||
case "$1" in | ||
--) shift; break;; | ||
--force-rpath) shift; forceRpath=1;; | ||
--*) | ||
echo "addOpenGLRunpath: ERROR: Invalid command line" \ | ||
"argument: $1" >&2 | ||
return 1;; | ||
*) break;; | ||
esac | ||
done | ||
|
||
for file in "$@"; do | ||
local origRpath="$(patchelf --print-rpath "$file")" | ||
patchelf --set-rpath "@driverLink@/lib:$origRpath" ${forceRpath:+--force-rpath} "$file" | ||
done | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters