SDL, SDL2: don't link statically to any of the inputs
This commit is contained in:
parent
6166027ca8
commit
f114118842
|
@ -17,17 +17,10 @@ assert openglSupport -> (stdenv.isDarwin || x11Support && libGL != null && libGL
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
# XXX: By default, SDL wants to dlopen() PulseAudio, in which case
|
|
||||||
# we must arrange to add it to its RPATH; however, `patchelf' seems
|
|
||||||
# to fail at doing this, hence `--disable-pulseaudio-shared'.
|
|
||||||
configureFlagsFun = attrs: [
|
configureFlagsFun = attrs: [
|
||||||
"--disable-oss"
|
"--disable-oss"
|
||||||
"--disable-video-x11-xme"
|
"--disable-video-x11-xme"
|
||||||
"--disable-x11-shared"
|
|
||||||
"--disable-alsa-shared"
|
|
||||||
"--enable-rpath"
|
"--enable-rpath"
|
||||||
"--disable-pulseaudio-shared"
|
|
||||||
"--disable-osmesa-shared"
|
|
||||||
] ++ optional (!x11Support) "--without-x"
|
] ++ optional (!x11Support) "--without-x"
|
||||||
++ optional alsaSupport "--with-alsa-prefix=${attrs.alsaLib.out}/lib";
|
++ optional alsaSupport "--with-alsa-prefix=${attrs.alsaLib.out}/lib";
|
||||||
|
|
||||||
|
@ -47,7 +40,6 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
nativeBuildInputs = [ pkgconfig ];
|
nativeBuildInputs = [ pkgconfig ];
|
||||||
|
|
||||||
# Since `libpulse*.la' contain `-lgdbm', PulseAudio must be propagated.
|
|
||||||
propagatedBuildInputs = [ ]
|
propagatedBuildInputs = [ ]
|
||||||
++ optionals x11Support [ libXext libICE libXrandr ]
|
++ optionals x11Support [ libXext libICE libXrandr ]
|
||||||
++ optional stdenv.isLinux libcap
|
++ optional stdenv.isLinux libcap
|
||||||
|
@ -114,6 +106,15 @@ stdenv.mkDerivation rec {
|
||||||
moveToOutput share/aclocal "$dev"
|
moveToOutput share/aclocal "$dev"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# See the same place in the expression for SDL2
|
||||||
|
postFixup = ''
|
||||||
|
for lib in $out/lib/*.so* ; do
|
||||||
|
if [[ -L "$lib" ]]; then
|
||||||
|
patchelf --set-rpath "$(patchelf --print-rpath $lib):${lib.makeLibraryPath propagatedBuildInputs}" "$lib"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
setupHook = ./setup-hook.sh;
|
setupHook = ./setup-hook.sh;
|
||||||
|
|
||||||
passthru = { inherit openglSupport; };
|
passthru = { inherit openglSupport; };
|
||||||
|
|
|
@ -21,14 +21,10 @@ assert openglSupport -> (stdenv.isDarwin || x11Support && libGL != null);
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
# XXX: By default, SDL wants to dlopen() PulseAudio, in which case
|
|
||||||
# we must arrange to add it to its RPATH; however, `patchelf' seems
|
|
||||||
# to fail at doing this, hence `--disable-pulseaudio-shared'.
|
|
||||||
configureFlagsFun = attrs: [
|
configureFlagsFun = attrs: [
|
||||||
"--disable-oss" "--disable-x11-shared" "--disable-wayland-shared"
|
"--disable-oss"
|
||||||
"--disable-pulseaudio-shared" "--disable-alsa-shared"
|
] ++ optional (!x11Support) "--without-x"
|
||||||
] ++ optional alsaSupport "--with-alsa-prefix=${attrs.alsaLib.out}/lib"
|
++ optional alsaSupport "--with-alsa-prefix=${attrs.alsaLib.out}/lib";
|
||||||
++ optional (!x11Support) "--without-x";
|
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
|
@ -48,17 +44,16 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
nativeBuildInputs = [ pkgconfig ];
|
nativeBuildInputs = [ pkgconfig ];
|
||||||
|
|
||||||
# Since `libpulse*.la' contain `-lgdbm', PulseAudio must be propagated.
|
|
||||||
propagatedBuildInputs = [ libiconv ]
|
propagatedBuildInputs = [ libiconv ]
|
||||||
|
++ optional dbusSupport dbus
|
||||||
|
++ optional udevSupport udev
|
||||||
++ optionals x11Support [ libICE libXi libXScrnSaver libXcursor libXinerama libXext libXrandr libXxf86vm ]
|
++ optionals x11Support [ libICE libXi libXScrnSaver libXcursor libXinerama libXext libXrandr libXxf86vm ]
|
||||||
++ optionals waylandSupport [ wayland wayland-protocols libxkbcommon ]
|
++ optionals waylandSupport [ wayland wayland-protocols libxkbcommon ]
|
||||||
|
++ optional alsaSupport alsaLib
|
||||||
++ optional pulseaudioSupport libpulseaudio;
|
++ optional pulseaudioSupport libpulseaudio;
|
||||||
|
|
||||||
buildInputs = [ audiofile ]
|
buildInputs = [ audiofile ]
|
||||||
++ optional openglSupport libGL
|
++ optional openglSupport libGL
|
||||||
++ optional alsaSupport alsaLib
|
|
||||||
++ optional dbusSupport dbus
|
|
||||||
++ optional udevSupport udev
|
|
||||||
++ optional ibusSupport ibus
|
++ optional ibusSupport ibus
|
||||||
++ optionals stdenv.isDarwin [ AudioUnit Cocoa CoreAudio CoreServices ForceFeedback OpenGL ];
|
++ optionals stdenv.isDarwin [ AudioUnit Cocoa CoreAudio CoreServices ForceFeedback OpenGL ];
|
||||||
|
|
||||||
|
@ -81,6 +76,28 @@ stdenv.mkDerivation rec {
|
||||||
moveToOutput bin/sdl2-config "$dev"
|
moveToOutput bin/sdl2-config "$dev"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# SDL is weird in that instead of just dynamically linking with
|
||||||
|
# libraries when you `--enable-*` (or when `configure` finds) them
|
||||||
|
# it `dlopen`s them at runtime. In principle, this means it can
|
||||||
|
# ignore any missing optional dependencies like alsa, pulseaudio,
|
||||||
|
# some x11 libs, wayland, etc if they are missing on the system
|
||||||
|
# and/or work with wide array of versions of said libraries. In
|
||||||
|
# nixpkgs, however, we don't need any of that. Moreover, since we
|
||||||
|
# don't have a global ld-cache we have to stuff all the propagated
|
||||||
|
# libraries into rpath by hand or else some applications that use
|
||||||
|
# SDL API that requires said libraries will fail to start.
|
||||||
|
#
|
||||||
|
# You can grep SDL sources with `grep -rE 'SDL_(NAME|.*_SYM)'` to
|
||||||
|
# confirm that they actually use most of the `propagatedBuildInputs`
|
||||||
|
# from above in this way. This is pretty weird.
|
||||||
|
postFixup = ''
|
||||||
|
for lib in $out/lib/*.so* ; do
|
||||||
|
if [[ -L "$lib" ]]; then
|
||||||
|
patchelf --set-rpath "$(patchelf --print-rpath $lib):${lib.makeLibraryPath propagatedBuildInputs}" "$lib"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
setupHook = ./setup-hook.sh;
|
setupHook = ./setup-hook.sh;
|
||||||
|
|
||||||
passthru = { inherit openglSupport; };
|
passthru = { inherit openglSupport; };
|
||||||
|
|
Loading…
Reference in New Issue