Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions pkgs/development/libraries/SDL2/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,21 @@ stdenv.mkDerivation rec {
++ optional alsaSupport "--with-alsa-prefix=${alsaLib.out}/lib"
++ optional stdenv.isDarwin "--disable-sdltest";

# We remove libtool .la files when static libs are requested,
# because they make the builds of downstream libs like `SDL_tff`
# fail with `cannot find -lXext, `-lXcursor` etc. linker errors
# because the `.la` files are not pruned if static libs exist
# (see https://github.com/NixOS/nixpkgs/commit/fd97db43bcb05e37f6bb77f363f1e1e239d9de53)
# and they also don't carry the necessary `-L` paths of their
# X11 dependencies.
# For static linking, it is better to rely on `pkg-config` `.pc`
# files.
postInstall = ''
moveToOutput lib/libSDL2main.a "$dev"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this file (and other .a) still be removed when dontDisableStatic is true? Otherwise we get .a files in the SDL closure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right.

It seems SDL2 does not quite respect --disable-static; it still generates libSDL2main.a and libSDL2_test.a.

I've force-pushed an else branch that deletes them.

It also generates libSDL2main.la and libSDL2_test.la which are prett useless given that the .a files they mention are nonexistent. Should I delete them, or do we not care?

Also, with what comand can I rebuild everything that depends on SDL2, so that I can check if anything used the libSDL2main.a that before was in the $dev output?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the 'else' branch to keep removing the .a libs. Your force push failed? Otherwise looks good to me

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your force push failed?

Oops, you are right. Fixed now, sorry.

rm $out/lib/*.a
if [ "$dontDisableStatic" -eq "1" ]; then
rm $out/lib/*.la
else
rm $out/lib/*.a
fi
moveToOutput bin/sdl2-config "$dev"
'';

Expand Down