diff options
author | Niklas Hambüchen <mail@nh2.me> | 2019-11-03 18:36:28 +0100 |
---|---|---|
committer | Niklas Hambüchen <mail@nh2.me> | 2019-11-08 23:12:59 +0100 |
commit | 57908c1624f93fd5c77b5d6cd094ab6bca8577e8 (patch) | |
tree | e6e7b0114cda6bbe0b12a27d07c8a4aa8d5d7636 /pkgs/development/libraries/SDL2 | |
parent | 9d59d57d4504655a2b71a5fcf769978492525a43 (diff) | |
download | nixpkgs-57908c1624f93fd5c77b5d6cd094ab6bca8577e8.tar nixpkgs-57908c1624f93fd5c77b5d6cd094ab6bca8577e8.tar.gz nixpkgs-57908c1624f93fd5c77b5d6cd094ab6bca8577e8.tar.bz2 nixpkgs-57908c1624f93fd5c77b5d6cd094ab6bca8577e8.tar.lz nixpkgs-57908c1624f93fd5c77b5d6cd094ab6bca8577e8.tar.xz nixpkgs-57908c1624f93fd5c77b5d6cd094ab6bca8577e8.tar.zst nixpkgs-57908c1624f93fd5c77b5d6cd094ab6bca8577e8.zip |
SDL2: Keep .a files on `dontDisableStatic`; don't move them to $dev; prune .la.
Most other packages don't move `.a` files to "$dev", and that is because it makes the pkg-config `.pc` file wrong (the `libdir` is the non-dev one). Keeping them in the main output makes static linking of SDL2 work. See added comment about pruning of `.la` files.
Diffstat (limited to 'pkgs/development/libraries/SDL2')
-rw-r--r-- | pkgs/development/libraries/SDL2/default.nix | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/pkgs/development/libraries/SDL2/default.nix b/pkgs/development/libraries/SDL2/default.nix index 8fe6bbe6113..e02ea05a726 100644 --- a/pkgs/development/libraries/SDL2/default.nix +++ b/pkgs/development/libraries/SDL2/default.nix @@ -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" - rm $out/lib/*.a + if [ "$dontDisableStatic" -eq "1" ]; then + rm $out/lib/*.la + else + rm $out/lib/*.a + fi moveToOutput bin/sdl2-config "$dev" ''; |