Skip to content

Commit fb4b83f

Browse files
committed
SDL_compat: set rpath during installation
1 parent 0b772ee commit fb4b83f

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

pkgs/by-name/sd/SDL_compat/package.nix

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,17 @@ stdenv.mkDerivation (finalAttrs: {
5252
]
5353
++ lib.optionals openglSupport [ libGLU ];
5454

55+
postPatch = ''
56+
substituteInPlace CMakeLists.txt \
57+
--replace-fail 'set(CMAKE_SKIP_RPATH TRUE)' 'set(CMAKE_SKIP_RPATH FALSE)'
58+
'';
59+
60+
dontPatchELF = true; # don't strip rpath
61+
62+
cmakeFlags = [
63+
(lib.cmakeFeature "CMAKE_INSTALL_RPATH" (lib.makeLibraryPath [ sdl2-compat ]))
64+
];
65+
5566
enableParallelBuilding = true;
5667

5768
postInstall = ''
@@ -66,25 +77,6 @@ stdenv.mkDerivation (finalAttrs: {
6677
patches = [ ./find-headers.patch ];
6778
setupHook = ./setup-hook.sh;
6879

69-
postFixup = ''
70-
for lib in $out/lib/*${stdenv.hostPlatform.extensions.sharedLibrary}* ; do
71-
if [[ -L "$lib" ]]; then
72-
${
73-
if stdenv.hostPlatform.isDarwin then
74-
''
75-
install_name_tool ${
76-
lib.strings.concatMapStrings (x: " -add_rpath ${lib.makeLibraryPath [ x ]} ") finalAttrs.buildInputs
77-
} "$lib"
78-
''
79-
else
80-
''
81-
patchelf --set-rpath "$(patchelf --print-rpath $lib):${lib.makeLibraryPath finalAttrs.buildInputs}" "$lib"
82-
''
83-
}
84-
fi
85-
done
86-
'';
87-
8880
meta = {
8981
homepage = "https://www.libsdl.org/";
9082
description = "Cross-platform multimedia library - build SDL 1.2 applications against 2.0";

0 commit comments

Comments
 (0)