summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorCarles Pagès <page@ruiec.cat>2019-11-10 22:18:38 +0100
committerGitHub <noreply@github.com>2019-11-10 22:18:38 +0100
commit539e94030c226562433e5ff96299dffb0641427a (patch)
tree202188dee7330f5872c7d1a2eb342e61cb2a2dcb /pkgs
parent119b1b630d35f1c2d4ee42225ce2226facbfe962 (diff)
parent57908c1624f93fd5c77b5d6cd094ab6bca8577e8 (diff)
downloadnixpkgs-539e94030c226562433e5ff96299dffb0641427a.tar
nixpkgs-539e94030c226562433e5ff96299dffb0641427a.tar.gz
nixpkgs-539e94030c226562433e5ff96299dffb0641427a.tar.bz2
nixpkgs-539e94030c226562433e5ff96299dffb0641427a.tar.lz
nixpkgs-539e94030c226562433e5ff96299dffb0641427a.tar.xz
nixpkgs-539e94030c226562433e5ff96299dffb0641427a.tar.zst
nixpkgs-539e94030c226562433e5ff96299dffb0641427a.zip
Merge pull request #72736 from nh2/nix-sdl2-static-fixes
SDL2: Keep .a files on `dontDisableStatic`; don't move them to $dev; prune .la
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/libraries/SDL2/default.nix16
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"
   '';