diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/SDL2/default.nix')
-rw-r--r-- | nixpkgs/pkgs/development/libraries/SDL2/default.nix | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/nixpkgs/pkgs/development/libraries/SDL2/default.nix b/nixpkgs/pkgs/development/libraries/SDL2/default.nix index 37e38e03b8cf..e02ea05a7262 100644 --- a/nixpkgs/pkgs/development/libraries/SDL2/default.nix +++ b/nixpkgs/pkgs/development/libraries/SDL2/default.nix @@ -36,6 +36,13 @@ stdenv.mkDerivation rec { patches = [ ./find-headers.patch ]; + # Fix with mesa 19.2: https://bugzilla.libsdl.org/show_bug.cgi?id=4797 + postPatch = '' + substituteInPlace include/SDL_opengl_glext.h \ + --replace "typedef ptrdiff_t GLsizeiptr;" "typedef signed long int khronos_ssize_t; typedef khronos_ssize_t GLsizeiptr;" \ + --replace "typedef ptrdiff_t GLintptr;" "typedef signed long int khronos_intptr_t; typedef khronos_intptr_t GLintptr;" + ''; + nativeBuildInputs = [ pkgconfig ]; propagatedBuildInputs = dlopenPropagatedBuildInputs; @@ -68,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" ''; |