2013-01-30 19:44:55 +04:00
|
|
|
{ stdenv, fetchurl, pkgconfig, audiofile
|
2013-02-01 01:44:31 +04:00
|
|
|
, openglSupport ? false, mesa ? null
|
2006-09-12 03:06:26 +04:00
|
|
|
, alsaSupport ? true, alsaLib ? null
|
2010-08-12 00:14:25 +04:00
|
|
|
, x11Support ? true, x11 ? null, libXrandr ? null
|
2009-05-11 23:57:42 +04:00
|
|
|
, pulseaudioSupport ? true, pulseaudio ? null
|
2006-09-12 03:06:26 +04:00
|
|
|
}:
|
2006-01-26 17:01:08 +03:00
|
|
|
|
2009-10-21 17:21:18 +04:00
|
|
|
# OSS is no longer supported, for it's much crappier than ALSA and
|
|
|
|
# PulseAudio.
|
|
|
|
assert alsaSupport || pulseaudioSupport;
|
|
|
|
|
2013-02-01 01:44:31 +04:00
|
|
|
assert openglSupport -> (mesa != null && x11Support);
|
2010-08-12 00:14:25 +04:00
|
|
|
assert x11Support -> (x11 != null && libXrandr != null);
|
2006-09-12 03:06:26 +04:00
|
|
|
assert alsaSupport -> alsaLib != null;
|
2009-05-11 23:57:42 +04:00
|
|
|
assert pulseaudioSupport -> pulseaudio != null;
|
2004-09-26 22:12:51 +04:00
|
|
|
|
2010-08-12 00:14:25 +04:00
|
|
|
let
|
|
|
|
configureFlagsFun = attrs: ''
|
2013-01-30 19:44:55 +04:00
|
|
|
--disable-oss --disable-video-x11-xme
|
2010-08-12 00:14:25 +04:00
|
|
|
--disable-x11-shared --disable-alsa-shared --enable-rpath --disable-pulseaudio-shared
|
2013-01-30 19:44:55 +04:00
|
|
|
--disable-osmesa-shared
|
2010-08-12 00:14:25 +04:00
|
|
|
${if alsaSupport then "--with-alsa-prefix=${attrs.alsaLib}/lib" else ""}
|
|
|
|
'';
|
|
|
|
in
|
2009-10-21 17:21:22 +04:00
|
|
|
stdenv.mkDerivation rec {
|
2013-09-06 05:47:49 +04:00
|
|
|
version = "1.2.15";
|
|
|
|
name = "SDL-${version}";
|
2009-10-21 17:21:22 +04:00
|
|
|
|
2004-09-26 22:12:51 +04:00
|
|
|
src = fetchurl {
|
2013-09-06 05:47:49 +04:00
|
|
|
url = "http://www.libsdl.org/release/${name}.tar.gz";
|
2013-01-30 19:44:55 +04:00
|
|
|
sha256 = "005d993xcac8236fpvd1iawkz4wqjybkpn8dbwaliqz5jfkidlyn";
|
2004-09-26 22:12:51 +04:00
|
|
|
};
|
2009-10-21 17:21:22 +04:00
|
|
|
|
2009-05-12 01:11:25 +04:00
|
|
|
# Since `libpulse*.la' contain `-lgdbm', PulseAudio must be propagated.
|
2010-08-12 00:14:25 +04:00
|
|
|
propagatedBuildInputs = stdenv.lib.optionals x11Support [ x11 libXrandr ] ++
|
2009-05-12 01:11:25 +04:00
|
|
|
stdenv.lib.optional pulseaudioSupport pulseaudio;
|
|
|
|
|
2013-01-30 19:44:55 +04:00
|
|
|
buildInputs = [ pkgconfig audiofile ] ++
|
2013-02-01 01:44:31 +04:00
|
|
|
stdenv.lib.optional openglSupport [ mesa ] ++
|
2009-05-12 01:11:25 +04:00
|
|
|
stdenv.lib.optional alsaSupport alsaLib;
|
2009-05-11 23:57:42 +04:00
|
|
|
|
|
|
|
# XXX: By default, SDL wants to dlopen() PulseAudio, in which case
|
|
|
|
# we must arrange to add it to its RPATH; however, `patchelf' seems
|
|
|
|
# to fail at doing this, hence `--disable-pulseaudio-shared'.
|
2010-08-12 00:14:25 +04:00
|
|
|
configureFlags = configureFlagsFun { inherit alsaLib; };
|
|
|
|
|
|
|
|
crossAttrs = {
|
2012-12-28 22:08:19 +04:00
|
|
|
configureFlags = configureFlagsFun { alsaLib = alsaLib.crossDrv; };
|
2010-08-12 00:14:25 +04:00
|
|
|
};
|
2008-06-15 00:46:34 +04:00
|
|
|
|
|
|
|
passthru = {inherit openglSupport;};
|
|
|
|
|
2013-09-06 05:47:49 +04:00
|
|
|
meta = with stdenv.lib; {
|
2008-06-15 00:46:34 +04:00
|
|
|
description = "A cross-platform multimedia library";
|
2013-09-06 05:47:49 +04:00
|
|
|
homepage = http://www.libsdl.org/;
|
|
|
|
maintainers = with maintainers; [ lovek323 ];
|
|
|
|
platforms = platforms.unix;
|
2008-06-15 00:46:34 +04:00
|
|
|
};
|
2004-09-26 22:12:51 +04:00
|
|
|
}
|