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 { stdenv, fetchurl, fetchpatch, pkgconfig, audiofile, libcap
, openglSupport ? false, mesa ? null , openglSupport ? false, mesa_noglu
, alsaSupport ? true, alsaLib ? null , alsaSupport ? true, alsaLib
, x11Support ? true, xlibsWrapper ? null, libXrandr ? null , x11Support ? true, libXext, libICE, libXrandr
, pulseaudioSupport ? true, libpulseaudio ? null , pulseaudioSupport ? true, libpulseaudio
, OpenGL, CoreAudio, CoreServices, AudioUnit, Kernel, Cocoa , OpenGL, CoreAudio, CoreServices, AudioUnit, Kernel, Cocoa
}: }:
@ -10,17 +10,12 @@
# PulseAudio. # PulseAudio.
assert (stdenv.isLinux && !(stdenv ? cross)) -> alsaSupport || pulseaudioSupport; 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 let
inherit (stdenv.lib) optional optionals; inherit (stdenv.lib) optional optionals;
in in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "1.2.15";
name = "SDL-${version}"; name = "SDL-${version}";
version = "1.2.15";
src = fetchurl { src = fetchurl {
url = "http://www.libsdl.org/release/${name}.tar.gz"; 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. # Since `libpulse*.la' contain `-lgdbm', PulseAudio must be propagated.
propagatedBuildInputs = propagatedBuildInputs =
optionals x11Support [ xlibsWrapper libXrandr ] ++ optionals x11Support [ libXext libICE libXrandr ] ++
optional alsaSupport alsaLib ++ optional alsaSupport alsaLib ++
optional stdenv.isLinux libcap ++ optional stdenv.isLinux libcap ++
optional openglSupport mesa ++ optional openglSupport mesa_noglu ++
optional pulseaudioSupport libpulseaudio ++ optional pulseaudioSupport libpulseaudio ++
optional stdenv.isDarwin Cocoa; optional stdenv.isDarwin Cocoa;
@ -57,9 +52,9 @@ stdenv.mkDerivation rec {
"--enable-rpath" "--enable-rpath"
"--disable-pulseaudio-shared" "--disable-pulseaudio-shared"
"--disable-osmesa-shared" "--disable-osmesa-shared"
] ++ stdenv.lib.optionals (stdenv ? cross) ([ ] ++ optionals (stdenv ? cross) ([
"--without-x" "--without-x"
] ++ stdenv.lib.optional alsaSupport "--with-alsa-prefix=${alsaLib.out}/lib"); ] ++ optional alsaSupport "--with-alsa-prefix=${alsaLib.out}/lib");
patches = [ patches = [
# Fix window resizing issues, e.g. for xmonad # Fix window resizing issues, e.g. for xmonad
@ -95,15 +90,18 @@ stdenv.mkDerivation rec {
url = "http://hg.libsdl.org/SDL/raw-rev/bbfb41c13a87"; url = "http://hg.libsdl.org/SDL/raw-rev/bbfb41c13a87";
sha256 = "1336g7waaf1c8yhkz11xbs500h8bmvabh4h437ax8l1xdwcppfxv"; sha256 = "1336g7waaf1c8yhkz11xbs500h8bmvabh4h437ax8l1xdwcppfxv";
}) })
./find-headers.patch
]; ];
postFixup = ''moveToOutput share/aclocal "$dev" ''; postFixup = ''moveToOutput share/aclocal "$dev" '';
setupHook = ./setup-hook.sh;
passthru = { inherit openglSupport; }; passthru = { inherit openglSupport; };
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "A cross-platform multimedia library"; description = "A cross-platform multimedia library";
homepage = http://www.libsdl.org/; homepage = "http://www.libsdl.org/";
maintainers = with maintainers; [ lovek323 ]; maintainers = with maintainers; [ lovek323 ];
platforms = platforms.unix; platforms = platforms.unix;
license = licenses.lgpl21; 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 { stdenv.mkDerivation rec {
name = "SDL_gfx-2.0.25"; name = "SDL_gfx-${version}";
version = "2.0.25";
src = fetchurl { src = fetchurl {
url = "http://www.ferzkopp.net/Software/SDL_gfx-2.0/${name}.tar.gz"; url = "http://www.ferzkopp.net/Software/SDL_gfx-2.0/${name}.tar.gz";
@ -10,16 +11,9 @@ stdenv.mkDerivation rec {
buildInputs = [ SDL ] ; buildInputs = [ SDL ] ;
configureFlags = "--disable-mmx"; configureFlags = [ "--disable-mmx" ];
postInstall = '' meta = with stdenv.lib; {
sed -i -e 's,"SDL.h",<SDL/SDL.h>,' \
$out/include/SDL/*.h
ln -s $out/include/SDL/*.h $out/include/;
'';
meta = {
description = "SDL graphics drawing primitives and support functions"; description = "SDL graphics drawing primitives and support functions";
longDescription = longDescription =
@ -40,10 +34,10 @@ stdenv.mkDerivation rec {
code. Its is written in plain C and can be used in C++ code. code. Its is written in plain C and can be used in C++ code.
''; '';
homepage = https://sourceforge.net/projects/sdlgfx/; homepage = "https://sourceforge.net/projects/sdlgfx/";
license = stdenv.lib.licenses.lgpl2Plus; license = licenses.zlib;
maintainers = [ stdenv.lib.maintainers.bjg ]; maintainers = with maintainers; [ bjg ];
platforms = stdenv.lib.platforms.unix; platforms = platforms.unix;
}; };
} }

View File

@ -1,7 +1,8 @@
{ stdenv, fetchurl, SDL, libpng, libjpeg, libtiff, libungif, libXpm }: { stdenv, fetchurl, SDL, libpng, libjpeg, libtiff, libungif, libXpm }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "SDL_image-1.2.12"; name = "SDL_image-${version}";
version = "1.2.12";
src = fetchurl { src = fetchurl {
url = "http://www.libsdl.org/projects/SDL_image/release/${name}.tar.gz"; 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 ]; 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; { meta = with stdenv.lib; {
description = "SDL image library"; description = "SDL image library";
homepage = http://www.libsdl.org/projects/SDL_image/; homepage = "http://www.libsdl.org/projects/SDL_image/";
maintainers = with maintainers; [ lovek323 ]; maintainers = with maintainers; [ lovek323 ];
platforms = platforms.unix; 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 { stdenv.mkDerivation rec {
pname = "SDL_mixer"; pname = "SDL_mixer";
@ -10,21 +10,9 @@ stdenv.mkDerivation rec {
sha256 = "0alrhqgm40p4c92s26mimg9cm1y7rzr6m0p49687jxd9g6130i0n"; 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"; configureFlags = [ "--disable-music-ogg-shared" ] ++ lib.optional 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
'';
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "SDL multi-channel audio mixer library"; description = "SDL multi-channel audio mixer library";

View File

@ -11,21 +11,12 @@ stdenv.mkDerivation rec {
sha256 = "1d5c9xqlf4s1c01gzv6cxmg0r621pq9kfgxcg3197xw4p25pljjz"; sha256 = "1d5c9xqlf4s1c01gzv6cxmg0r621pq9kfgxcg3197xw4p25pljjz";
}; };
propagatedBuildInputs = [SDL]; propagatedBuildInputs = [ SDL ];
postInstall = '' meta = with stdenv.lib; {
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 = {
description = "SDL networking library"; 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 { stdenv.mkDerivation rec {
name = "SDL_sound-1.0.3"; name = "SDL_sound-${version}";
version = "1.0.3";
src = fetchurl { src = fetchurl {
url = "http://icculus.org/SDL_sound/downloads/${name}.tar.gz"; url = "http://icculus.org/SDL_sound/downloads/${name}.tar.gz";
@ -10,10 +11,10 @@ stdenv.mkDerivation rec {
buildInputs = [ SDL libvorbis flac libmikmod ]; buildInputs = [ SDL libvorbis flac libmikmod ];
postInstall = "ln -s $out/include/SDL/SDL_sound.h $out/include/"; meta = with stdenv.lib; {
meta = {
description = "SDL sound library"; 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, fetchurl, SDL }:
stdenv.mkDerivation { stdenv.mkDerivation rec {
name = "SDL_stretch-0.3.1"; name = "SDL_stretch-${version}";
version = "0.3.1";
src = fetchurl { 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"; sha256 = "1mzw68sn4yxbp8429jg2h23h8xw2qjid51z1f5pdsghcn3x0pgvw";
}; };
buildInputs = [ SDL ]; buildInputs = [ SDL ];
meta = { meta = with stdenv.lib; {
description = "Stretch Functions For SDL"; description = "Stretch Functions For SDL";
homepage = "http://sdl-stretch.sourceforge.net/"; homepage = "http://sdl-stretch.sourceforge.net/";
license = stdenv.lib.licenses.lgpl2; license = licenses.lgpl2;
platforms = stdenv.lib.platforms.linux; platforms = platforms.linux;
}; };
} }

View File

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