2010-08-11 20:14:25 +00:00
|
|
|
{ stdenv, fetchurl, pkgconfig
|
2009-05-11 19:57:42 +00:00
|
|
|
, openglSupport ? false, mesa ? null
|
2006-09-11 23:06:26 +00:00
|
|
|
, alsaSupport ? true, alsaLib ? null
|
2010-08-11 20:14:25 +00:00
|
|
|
, x11Support ? true, x11 ? null, libXrandr ? null
|
2009-05-11 19:57:42 +00:00
|
|
|
, pulseaudioSupport ? true, pulseaudio ? null
|
2006-09-11 23:06:26 +00:00
|
|
|
}:
|
2006-01-26 14:01:08 +00:00
|
|
|
|
2009-10-21 13:21:18 +00:00
|
|
|
# OSS is no longer supported, for it's much crappier than ALSA and
|
|
|
|
# PulseAudio.
|
|
|
|
assert alsaSupport || pulseaudioSupport;
|
|
|
|
|
2010-08-11 20:14:25 +00:00
|
|
|
assert openglSupport -> (mesa != null && x11Support);
|
|
|
|
assert x11Support -> (x11 != null && libXrandr != null);
|
2006-09-11 23:06:26 +00:00
|
|
|
assert alsaSupport -> alsaLib != null;
|
2009-05-11 19:57:42 +00:00
|
|
|
assert pulseaudioSupport -> pulseaudio != null;
|
2004-09-26 18:12:51 +00:00
|
|
|
|
2010-08-11 20:14:25 +00:00
|
|
|
let
|
|
|
|
configureFlagsFun = attrs: ''
|
|
|
|
--disable-oss
|
|
|
|
--disable-x11-shared --disable-alsa-shared --enable-rpath --disable-pulseaudio-shared
|
|
|
|
${if alsaSupport then "--with-alsa-prefix=${attrs.alsaLib}/lib" else ""}
|
|
|
|
'';
|
|
|
|
in
|
2009-10-21 13:21:22 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "SDL-1.2.14";
|
|
|
|
|
2004-09-26 18:12:51 +00:00
|
|
|
src = fetchurl {
|
2009-10-21 13:21:22 +00:00
|
|
|
url = "http://www.libsdl.org/release/${name}.tar.gz";
|
|
|
|
sha256 = "1dnrxr18cyar0xd13dca7h8wp1fin4n3iyncxfq6pjrlf0l7x4jx";
|
2004-09-26 18:12:51 +00:00
|
|
|
};
|
2009-10-21 13:21:22 +00:00
|
|
|
|
2009-05-11 21:11:25 +00:00
|
|
|
# Since `libpulse*.la' contain `-lgdbm', PulseAudio must be propagated.
|
2010-08-11 20:14:25 +00:00
|
|
|
propagatedBuildInputs = stdenv.lib.optionals x11Support [ x11 libXrandr ] ++
|
2009-05-11 21:11:25 +00:00
|
|
|
stdenv.lib.optional pulseaudioSupport pulseaudio;
|
|
|
|
|
2009-05-11 19:57:42 +00:00
|
|
|
buildInputs = [ pkgconfig ] ++
|
2008-06-14 20:46:34 +00:00
|
|
|
stdenv.lib.optional openglSupport mesa ++
|
2009-05-11 21:11:25 +00:00
|
|
|
stdenv.lib.optional alsaSupport alsaLib;
|
2009-05-11 19:57:42 +00: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-11 20:14:25 +00:00
|
|
|
configureFlags = configureFlagsFun { inherit alsaLib; };
|
|
|
|
|
|
|
|
crossAttrs = {
|
|
|
|
configureFlags = configureFlagsFun { alsaLib = alsaLib.hostDrv; };
|
|
|
|
};
|
2008-06-14 20:46:34 +00:00
|
|
|
|
|
|
|
passthru = {inherit openglSupport;};
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "A cross-platform multimedia library";
|
|
|
|
homepage = http://www.libsdl.org/;
|
|
|
|
};
|
2004-09-26 18:12:51 +00:00
|
|
|
}
|