lol

SDL: Refactor package and fix Darwin cross-builds.

First of all, this needs two upstream patches for supporting OS X 10.9,
also the cross-gcc doesn't accept -fpascal-strings, so drop the flag.

And except putting all configure flags into a multiline string, we're
now using a list, which is easier when it comes to handling optional
components.

As X isn't used on recent Mac OS X versions and Windows, I'm temporarily
using --without-x for cross-builds until we have a better way to check
for those things.

Also, don't add audiofile to buildInputs if we're cross-compiling for
MinGW.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>

aszlig 6998a866 cdaced58

+30 -13
+30 -13
pkgs/development/libraries/SDL/default.nix
··· 7 7 8 8 # OSS is no longer supported, for it's much crappier than ALSA and 9 9 # PulseAudio. 10 - assert alsaSupport || pulseaudioSupport; 10 + assert !(stdenv ? cross) -> alsaSupport || pulseaudioSupport; 11 11 12 12 assert openglSupport -> (mesa != null && x11Support); 13 13 assert x11Support -> (x11 != null && libXrandr != null); 14 14 assert alsaSupport -> alsaLib != null; 15 15 assert pulseaudioSupport -> pulseaudio != null; 16 16 17 - let 18 - configureFlagsFun = attrs: '' 19 - --disable-oss --disable-video-x11-xme 20 - --disable-x11-shared --disable-alsa-shared --enable-rpath --disable-pulseaudio-shared 21 - --disable-osmesa-shared 22 - ${if alsaSupport then "--with-alsa-prefix=${attrs.alsaLib}/lib" else ""} 23 - ''; 24 - in 25 17 stdenv.mkDerivation rec { 26 18 version = "1.2.15"; 27 19 name = "SDL-${version}"; ··· 35 27 propagatedBuildInputs = stdenv.lib.optionals x11Support [ x11 libXrandr ] ++ 36 28 stdenv.lib.optional pulseaudioSupport pulseaudio; 37 29 38 - buildInputs = [ pkgconfig audiofile ] ++ 30 + buildInputs = let 31 + notMingw = !(stdenv ? cross) || stdenv.cross.libc != "msvcrt"; 32 + in stdenv.lib.optional notMingw audiofile; 33 + 34 + nativeBuildInputs = [ pkgconfig ] ++ 39 35 stdenv.lib.optional openglSupport [ mesa ] ++ 40 36 stdenv.lib.optional alsaSupport alsaLib; 41 37 42 38 # XXX: By default, SDL wants to dlopen() PulseAudio, in which case 43 39 # we must arrange to add it to its RPATH; however, `patchelf' seems 44 40 # to fail at doing this, hence `--disable-pulseaudio-shared'. 45 - configureFlags = configureFlagsFun { inherit alsaLib; }; 41 + configureFlags = [ 42 + "--disable-oss" 43 + "--disable-video-x11-xme" 44 + "--disable-x11-shared" 45 + "--disable-alsa-shared" 46 + "--enable-rpath" 47 + "--disable-pulseaudio-shared" 48 + "--disable-osmesa-shared" 49 + ] ++ stdenv.lib.optionals (stdenv ? cross) ([ 50 + "--without-x" 51 + ] ++ stdenv.lib.optional alsaSupport "--with-alsa-prefix=${alsaLib}/lib"); 46 52 47 - crossAttrs = { 48 - configureFlags = configureFlagsFun { alsaLib = alsaLib.crossDrv; }; 53 + crossAttrs =stdenv.lib.optionalAttrs (stdenv.cross.libc == "libSystem") { 54 + patches = let 55 + f = rev: sha256: fetchurl { 56 + url = "http://hg.libsdl.org/SDL/raw-rev/${rev}"; 57 + inherit sha256; 58 + }; 59 + in [ 60 + (f "e9466ead70e5" "0ygir3k83d0vxp7s3k48jn3j8n2bnv9wm6613wpx3ybnjrxabrip") 61 + (f "bbfb41c13a87" "17v29ybjifvka19m8qf14rjc43nfdwk9v9inaizznarhb17amlnv") 62 + ]; 63 + postPatch = '' 64 + sed -i -e 's/ *-fpascal-strings//' configure 65 + ''; 49 66 }; 50 67 51 68 passthru = {inherit openglSupport;};