3
0
Fork 0
forked from mirrors/nixpkgs

SDL: cleanup and add patch to discover extensions

This commit is contained in:
Nikolay Amiantov 2016-08-22 06:24:00 +03:00
parent 3e2458a085
commit b47327ebd5
10 changed files with 75 additions and 85 deletions

View file

@ -1,8 +1,8 @@
{ stdenv, fetchurl, fetchpatch, pkgconfig, audiofile, libcap
, openglSupport ? false, mesa ? null
, alsaSupport ? true, alsaLib ? null
, x11Support ? true, xlibsWrapper ? null, libXrandr ? null
, pulseaudioSupport ? true, libpulseaudio ? null
, openglSupport ? false, mesa_noglu
, alsaSupport ? true, alsaLib
, x11Support ? true, libXext, libICE, libXrandr
, pulseaudioSupport ? true, libpulseaudio
, OpenGL, CoreAudio, CoreServices, AudioUnit, Kernel, Cocoa
}:
@ -10,17 +10,12 @@
# PulseAudio.
assert (stdenv.isLinux && !(stdenv ? cross)) -> alsaSupport || pulseaudioSupport;
assert openglSupport -> (mesa != null && x11Support);
assert x11Support -> (xlibsWrapper != null && libXrandr != null);
assert alsaSupport -> alsaLib != null;
assert pulseaudioSupport -> libpulseaudio != null;
let
inherit (stdenv.lib) optional optionals;
in
stdenv.mkDerivation rec {
version = "1.2.15";
name = "SDL-${version}";
version = "1.2.15";
src = fetchurl {
url = "http://www.libsdl.org/release/${name}.tar.gz";
@ -34,10 +29,10 @@ stdenv.mkDerivation rec {
# Since `libpulse*.la' contain `-lgdbm', PulseAudio must be propagated.
propagatedBuildInputs =
optionals x11Support [ xlibsWrapper libXrandr ] ++
optionals x11Support [ libXext libICE libXrandr ] ++
optional alsaSupport alsaLib ++
optional stdenv.isLinux libcap ++
optional openglSupport mesa ++
optional openglSupport mesa_noglu ++
optional pulseaudioSupport libpulseaudio ++
optional stdenv.isDarwin Cocoa;
@ -57,9 +52,9 @@ stdenv.mkDerivation rec {
"--enable-rpath"
"--disable-pulseaudio-shared"
"--disable-osmesa-shared"
] ++ stdenv.lib.optionals (stdenv ? cross) ([
] ++ optionals (stdenv ? cross) ([
"--without-x"
] ++ stdenv.lib.optional alsaSupport "--with-alsa-prefix=${alsaLib.out}/lib");
] ++ optional alsaSupport "--with-alsa-prefix=${alsaLib.out}/lib");
patches = [
# Fix window resizing issues, e.g. for xmonad
@ -95,15 +90,18 @@ stdenv.mkDerivation rec {
url = "http://hg.libsdl.org/SDL/raw-rev/bbfb41c13a87";
sha256 = "1336g7waaf1c8yhkz11xbs500h8bmvabh4h437ax8l1xdwcppfxv";
})
./find-headers.patch
];
postFixup = ''moveToOutput share/aclocal "$dev" '';
setupHook = ./setup-hook.sh;
passthru = { inherit openglSupport; };
meta = with stdenv.lib; {
description = "A cross-platform multimedia library";
homepage = http://www.libsdl.org/;
homepage = "http://www.libsdl.org/";
maintainers = with maintainers; [ lovek323 ];
platforms = platforms.unix;
license = licenses.lgpl21;

View file

@ -0,0 +1,16 @@
diff -ru3 SDL-1.2.15/sdl-config.in SDL-1.2.15-new/sdl-config.in
--- SDL-1.2.15/sdl-config.in 2012-01-19 10:30:06.000000000 +0400
+++ SDL-1.2.15-new/sdl-config.in 2016-08-22 05:32:52.716397920 +0300
@@ -42,7 +42,11 @@
echo @SDL_VERSION@
;;
--cflags)
- echo -I@includedir@/SDL @SDL_CFLAGS@
+ SDL_CFLAGS=""
+ for i in @includedir@/SDL $SDL_PATH; do
+ SDL_CFLAGS="$SDL_CFLAGS -I$i"
+ done
+ echo $SDL_CFLAGS @SDL_CFLAGS@
;;
@ENABLE_SHARED_TRUE@ --libs)
@ENABLE_SHARED_TRUE@ echo -L@libdir@ @SDL_RLD_FLAGS@ @SDL_LIBS@

View file

@ -0,0 +1,11 @@
addSDLPath () {
if [ -e "$1/include/SDL" ]; then
export SDL_PATH="$SDL_PATH $1/include/SDL"
fi
}
if test -n "$crossConfig"; then
crossEnvHooks+=(addSDLPath)
else
envHooks+=(addSDLPath)
fi

View file

@ -1,7 +1,8 @@
{stdenv, fetchurl, SDL} :
{ stdenv, fetchurl, SDL }:
stdenv.mkDerivation rec {
name = "SDL_gfx-2.0.25";
name = "SDL_gfx-${version}";
version = "2.0.25";
src = fetchurl {
url = "http://www.ferzkopp.net/Software/SDL_gfx-2.0/${name}.tar.gz";
@ -10,16 +11,9 @@ stdenv.mkDerivation rec {
buildInputs = [ SDL ] ;
configureFlags = "--disable-mmx";
configureFlags = [ "--disable-mmx" ];
postInstall = ''
sed -i -e 's,"SDL.h",<SDL/SDL.h>,' \
$out/include/SDL/*.h
ln -s $out/include/SDL/*.h $out/include/;
'';
meta = {
meta = with stdenv.lib; {
description = "SDL graphics drawing primitives and support functions";
longDescription =
@ -40,10 +34,10 @@ stdenv.mkDerivation rec {
code. Its is written in plain C and can be used in C++ code.
'';
homepage = https://sourceforge.net/projects/sdlgfx/;
license = stdenv.lib.licenses.lgpl2Plus;
homepage = "https://sourceforge.net/projects/sdlgfx/";
license = licenses.zlib;
maintainers = [ stdenv.lib.maintainers.bjg ];
platforms = stdenv.lib.platforms.unix;
maintainers = with maintainers; [ bjg ];
platforms = platforms.unix;
};
}

View file

@ -1,7 +1,8 @@
{ stdenv, fetchurl, SDL, libpng, libjpeg, libtiff, libungif, libXpm }:
stdenv.mkDerivation rec {
name = "SDL_image-1.2.12";
name = "SDL_image-${version}";
version = "1.2.12";
src = fetchurl {
url = "http://www.libsdl.org/projects/SDL_image/release/${name}.tar.gz";
@ -10,18 +11,9 @@ stdenv.mkDerivation rec {
buildInputs = [ SDL libpng libjpeg libtiff libungif libXpm ];
postInstall = ''
sed -i -e 's,"SDL.h",<SDL/SDL.h>,' \
-e 's,"SDL_version.h",<SDL/SDL_version.h>,' \
-e 's,"begin_code.h",<SDL/begin_code.h>,' \
-e 's,"close_code.h",<SDL/close_code.h>,' \
$out/include/SDL/SDL_image.h
ln -sv SDL/SDL_image.h $out/include/SDL_image.h
'';
meta = with stdenv.lib; {
description = "SDL image library";
homepage = http://www.libsdl.org/projects/SDL_image/;
homepage = "http://www.libsdl.org/projects/SDL_image/";
maintainers = with maintainers; [ lovek323 ];
platforms = platforms.unix;
};

View file

@ -1,4 +1,4 @@
{ stdenv, fetchurl, SDL, libogg, libvorbis, smpeg, enableNativeMidi ? false, fluidsynth ? null }:
{ stdenv, lib, fetchurl, SDL, libogg, libvorbis, smpeg, enableNativeMidi ? false, fluidsynth ? null }:
stdenv.mkDerivation rec {
pname = "SDL_mixer";
@ -10,21 +10,9 @@ stdenv.mkDerivation rec {
sha256 = "0alrhqgm40p4c92s26mimg9cm1y7rzr6m0p49687jxd9g6130i0n";
};
buildInputs = [SDL libogg libvorbis fluidsynth smpeg];
buildInputs = [ SDL libogg libvorbis fluidsynth smpeg ];
configureFlags = "--disable-music-ogg-shared" + stdenv.lib.optionalString enableNativeMidi " --enable-music-native-midi-gpl";
postInstall = ''
ln -s $out/include/SDL/SDL_mixer.h $out/include/
for f in $out/include/SDL/SDL_mixer.h
do
for i in SDL_types.h SDL_rwops.h SDL_audio.h SDL_endian.h SDL_version.h begin_code.h close_code.h
do
substituteInPlace $f --replace "#include \"$i\"" "#include <SDL/$i>"
done
done
'';
configureFlags = [ "--disable-music-ogg-shared" ] ++ lib.optional enableNativeMidi " --enable-music-native-midi-gpl";
meta = with stdenv.lib; {
description = "SDL multi-channel audio mixer library";

View file

@ -11,21 +11,12 @@ stdenv.mkDerivation rec {
sha256 = "1d5c9xqlf4s1c01gzv6cxmg0r621pq9kfgxcg3197xw4p25pljjz";
};
propagatedBuildInputs = [SDL];
propagatedBuildInputs = [ SDL ];
postInstall = ''
sed -i -e 's,"SDL.h",<SDL/SDL.h>,' \
-e 's,"SDL_endian.h",<SDL/SDL_endian.h>,' \
-e 's,"SDL_version.h",<SDL/SDL_version.h>,' \
-e 's,"begin_code.h",<SDL/begin_code.h>,' \
-e 's,"close_code.h",<SDL/close_code.h>,' \
$out/include/SDL/SDL_net.h
ln -sv $out/include/SDL/SDL_net.h $out/include/
'';
meta = {
meta = with stdenv.lib; {
description = "SDL networking library";
platforms = stdenv.lib.platforms.unix;
platforms = platforms.unix;
license = licenses.zlib;
homepage = "https://www.libsdl.org/projects/SDL_net/release-1.2.html";
};
}

View file

@ -1,7 +1,8 @@
{stdenv, fetchurl, SDL, libvorbis, flac, libmikmod}:
{ stdenv, fetchurl, SDL, libvorbis, flac, libmikmod }:
stdenv.mkDerivation rec {
name = "SDL_sound-1.0.3";
name = "SDL_sound-${version}";
version = "1.0.3";
src = fetchurl {
url = "http://icculus.org/SDL_sound/downloads/${name}.tar.gz";
@ -10,10 +11,10 @@ stdenv.mkDerivation rec {
buildInputs = [ SDL libvorbis flac libmikmod ];
postInstall = "ln -s $out/include/SDL/SDL_sound.h $out/include/";
meta = {
meta = with stdenv.lib; {
description = "SDL sound library";
platforms = stdenv.lib.platforms.linux;
platforms = platforms.linux;
license = licenses.lgpl21;
homepage = "https://www.icculus.org/SDL_sound/";
};
}

View file

@ -1,19 +1,20 @@
{ stdenv, fetchurl, SDL }:
stdenv.mkDerivation {
name = "SDL_stretch-0.3.1";
stdenv.mkDerivation rec {
name = "SDL_stretch-${version}";
version = "0.3.1";
src = fetchurl {
url = "mirror://sourceforge/sdl-stretch/0.3.1/SDL_stretch-0.3.1.tar.bz2";
url = "mirror://sourceforge/sdl-stretch/${version}/${name}.tar.bz2";
sha256 = "1mzw68sn4yxbp8429jg2h23h8xw2qjid51z1f5pdsghcn3x0pgvw";
};
buildInputs = [ SDL ];
meta = {
meta = with stdenv.lib; {
description = "Stretch Functions For SDL";
homepage = "http://sdl-stretch.sourceforge.net/";
license = stdenv.lib.licenses.lgpl2;
platforms = stdenv.lib.platforms.linux;
license = licenses.lgpl2;
platforms = platforms.linux;
};
}

View file

@ -9327,9 +9327,7 @@ in
openglSupport = mesaSupported;
alsaSupport = stdenv.isLinux;
x11Support = !stdenv.isCygwin;
pulseaudioSupport = if (config ? pulseaudio)
then config.pulseaudio
else stdenv.isLinux;
pulseaudioSupport = config.pulseaudio or stdenv.isLinux;
inherit (darwin.apple_sdk.frameworks) OpenGL CoreAudio CoreServices AudioUnit Kernel Cocoa;
};