mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 06:01:15 +00:00
SDL2: cleanup and add patch to discover extensions
This commit is contained in:
parent
b47327ebd5
commit
7bf7f19765
|
@ -1,8 +1,11 @@
|
|||
{ stdenv, fetchurl, pkgconfig, audiofile
|
||||
, openglSupport ? false, mesa ? null
|
||||
, alsaSupport ? true, alsaLib ? null
|
||||
, x11Support ? true, xlibsWrapper ? null, libXrandr ? null
|
||||
, pulseaudioSupport ? true, libpulseaudio ? null
|
||||
{ stdenv, lib, fetchurl, pkgconfig, audiofile
|
||||
, openglSupport ? false, mesa_noglu
|
||||
, alsaSupport ? true, alsaLib
|
||||
, x11Support ? true, libICE, libXi, libXScrnSaver, libXcursor, libXinerama, libXext, libXxf86vm, libXrandr
|
||||
, dbusSupport ? false, dbus
|
||||
, udevSupport ? false, udev
|
||||
, ibusSupport ? false, ibus
|
||||
, pulseaudioSupport ? true, libpulseaudio
|
||||
, AudioUnit, Cocoa, CoreAudio, CoreServices, ForceFeedback, OpenGL
|
||||
}:
|
||||
|
||||
|
@ -10,35 +13,39 @@
|
|||
# PulseAudio.
|
||||
assert !stdenv.isDarwin -> alsaSupport || pulseaudioSupport;
|
||||
|
||||
assert openglSupport -> (stdenv.isDarwin || mesa != null && x11Support);
|
||||
assert x11Support -> (xlibsWrapper != null && libXrandr != null);
|
||||
assert alsaSupport -> alsaLib != null;
|
||||
assert pulseaudioSupport -> libpulseaudio != null;
|
||||
assert openglSupport -> (stdenv.isDarwin || mesa_noglu != null && x11Support);
|
||||
|
||||
let
|
||||
configureFlagsFun = attrs: ''
|
||||
--disable-oss --disable-x11-shared
|
||||
--disable-pulseaudio-shared --disable-alsa-shared
|
||||
${if alsaSupport then "--with-alsa-prefix=${attrs.alsaLib.out}/lib" else ""}
|
||||
${if (!x11Support) then "--without-x" else ""}
|
||||
'';
|
||||
configureFlagsFun = attrs: [
|
||||
"--disable-oss" "--disable-x11-shared"
|
||||
"--disable-pulseaudio-shared" "--disable-alsa-shared"
|
||||
] ++ lib.optional alsaSupport "--with-alsa-prefix=${attrs.alsaLib.out}/lib"
|
||||
++ lib.optional (!x11Support) "--without-x";
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
name = "SDL2-2.0.3";
|
||||
name = "SDL2-${version}";
|
||||
version = "2.0.4";
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://www.libsdl.org/release/${name}.tar.gz";
|
||||
sha256 = "0369ngvb46x6c26h8zva4x22ywgy6mvn0wx87xqwxg40pxm9m9m5";
|
||||
sha256 = "0jqp46mxxbh9lhpx1ih6sp93k752j2smhpc0ad0q4cb3px0famfs";
|
||||
};
|
||||
|
||||
# Since `libpulse*.la' contain `-lgdbm', PulseAudio must be propagated.
|
||||
propagatedBuildInputs = stdenv.lib.optionals x11Support [ xlibsWrapper libXrandr ] ++
|
||||
stdenv.lib.optional pulseaudioSupport libpulseaudio;
|
||||
patches = [ ./find-headers.patch ];
|
||||
|
||||
buildInputs = [ pkgconfig audiofile ] ++
|
||||
stdenv.lib.optional openglSupport mesa ++
|
||||
stdenv.lib.optional alsaSupport alsaLib ++
|
||||
stdenv.lib.optionals stdenv.isDarwin [ AudioUnit Cocoa CoreAudio CoreServices ForceFeedback OpenGL ];
|
||||
nativeBuildInputs = [ pkgconfig ];
|
||||
|
||||
# Since `libpulse*.la' contain `-lgdbm', PulseAudio must be propagated.
|
||||
propagatedBuildInputs = lib.optionals x11Support [ libICE libXi libXScrnSaver libXcursor libXinerama libXext libXrandr libXxf86vm ] ++
|
||||
lib.optional pulseaudioSupport libpulseaudio;
|
||||
|
||||
buildInputs = [ audiofile ] ++
|
||||
lib.optional openglSupport mesa_noglu ++
|
||||
lib.optional alsaSupport alsaLib ++
|
||||
lib.optional dbusSupport dbus ++
|
||||
lib.optional udevSupport udev ++
|
||||
lib.optional ibusSupport ibus ++
|
||||
lib.optionals stdenv.isDarwin [ AudioUnit Cocoa CoreAudio CoreServices ForceFeedback OpenGL ];
|
||||
|
||||
# https://bugzilla.libsdl.org/show_bug.cgi?id=1431
|
||||
dontDisableStatic = true;
|
||||
|
@ -49,20 +56,22 @@ stdenv.mkDerivation rec {
|
|||
configureFlags = configureFlagsFun { inherit alsaLib; };
|
||||
|
||||
crossAttrs = {
|
||||
configureFlags = configureFlagsFun { alsaLib = alsaLib.crossDrv; };
|
||||
configureFlags = configureFlagsFun { alsaLib = alsaLib.crossDrv; };
|
||||
};
|
||||
|
||||
postInstall = ''
|
||||
rm $out/lib/*.a
|
||||
'';
|
||||
|
||||
passthru = {inherit openglSupport;};
|
||||
setupHook = ./setup-hook.sh;
|
||||
|
||||
meta = {
|
||||
passthru = { inherit openglSupport; };
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "A cross-platform multimedia library";
|
||||
homepage = http://www.libsdl.org/;
|
||||
license = stdenv.lib.licenses.zlib;
|
||||
platforms = stdenv.lib.platforms.all;
|
||||
maintainers = [ stdenv.lib.maintainers.page ];
|
||||
homepage = "http://www.libsdl.org/";
|
||||
license = licenses.zlib;
|
||||
platforms = platforms.all;
|
||||
maintainers = with maintainers; [ page ];
|
||||
};
|
||||
}
|
||||
|
|
26
pkgs/development/libraries/SDL2/find-headers.patch
Normal file
26
pkgs/development/libraries/SDL2/find-headers.patch
Normal file
|
@ -0,0 +1,26 @@
|
|||
diff -ru3 SDL2-2.0.4/sdl2-config.cmake.in SDL2-2.0.4-new/sdl2-config.cmake.in
|
||||
--- SDL2-2.0.4/sdl2-config.cmake.in 2016-01-02 22:56:31.000000000 +0300
|
||||
+++ SDL2-2.0.4-new/sdl2-config.cmake.in 2016-08-22 05:26:42.420397323 +0300
|
||||
@@ -6,5 +6,5 @@
|
||||
set(SDL2_PREFIX "@prefix@")
|
||||
set(SDL2_EXEC_PREFIX "@prefix@")
|
||||
set(SDL2_LIBDIR "@libdir@")
|
||||
-set(SDL2_INCLUDE_DIRS "@includedir@/SDL2")
|
||||
+set(SDL2_INCLUDE_DIRS "@includedir@/SDL2" $ENV{SDL2_PATH})
|
||||
set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} @SDL_RLD_FLAGS@ @SDL_LIBS@")
|
||||
diff -ru3 SDL2-2.0.4/sdl2-config.in SDL2-2.0.4-new/sdl2-config.in
|
||||
--- SDL2-2.0.4/sdl2-config.in 2016-01-02 22:56:31.000000000 +0300
|
||||
+++ SDL2-2.0.4-new/sdl2-config.in 2016-08-22 05:32:02.256397839 +0300
|
||||
@@ -42,7 +42,11 @@
|
||||
echo @SDL_VERSION@
|
||||
;;
|
||||
--cflags)
|
||||
- echo -I@includedir@/SDL2 @SDL_CFLAGS@
|
||||
+ SDL_CFLAGS=""
|
||||
+ for i in @includedir@/SDL2 $SDL2_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@
|
11
pkgs/development/libraries/SDL2/setup-hook.sh
Normal file
11
pkgs/development/libraries/SDL2/setup-hook.sh
Normal file
|
@ -0,0 +1,11 @@
|
|||
addSDL2Path () {
|
||||
if [ -e "$1/include/SDL2" ]; then
|
||||
export SDL2_PATH="$SDL2_PATH $1/include/SDL2"
|
||||
fi
|
||||
}
|
||||
|
||||
if test -n "$crossConfig"; then
|
||||
crossEnvHooks+=(addSDL2Path)
|
||||
else
|
||||
envHooks+=(addSDL2Path)
|
||||
fi
|
|
@ -1,27 +1,20 @@
|
|||
{ stdenv, fetchurl, SDL2, libpng, libjpeg, libtiff, libungif, libXpm, zlib }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "SDL2_image-2.0.1";
|
||||
name = "SDL2_image-${version}";
|
||||
version = "2.0.1";
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://www.libsdl.org/projects/SDL_image/release/${name}.tar.gz";
|
||||
sha256 = "0r3z1l7fdn76qkpy7snpkcjqz8dkv2zp6lsqpq25q4m5xsyaygis";
|
||||
};
|
||||
|
||||
buildInputs = [SDL2 libpng libjpeg libtiff libungif libXpm zlib];
|
||||
buildInputs = [ SDL2 libpng libjpeg libtiff libungif libXpm zlib ];
|
||||
|
||||
postInstall = ''
|
||||
sed -i -e 's,"SDL.h",<SDL2/SDL.h>,' \
|
||||
-e 's,"SDL_version.h",<SDL2/SDL_version.h>,' \
|
||||
-e 's,"begin_code.h",<SDL2/begin_code.h>,' \
|
||||
-e 's,"close_code.h",<SDL2/close_code.h>,' \
|
||||
$out/include/SDL2/SDL_image.h
|
||||
ln -sv SDL2/SDL_image.h $out/include/SDL_image.h
|
||||
'';
|
||||
|
||||
meta = {
|
||||
meta = with stdenv.lib; {
|
||||
description = "SDL image library";
|
||||
homepage = "http://www.libsdl.org/projects/SDL_image/";
|
||||
platforms = stdenv.lib.platforms.linux;
|
||||
platforms = platforms.linux;
|
||||
license = licenses.zlib;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
{ stdenv, fetchurl, SDL2, libogg, libvorbis, enableNativeMidi ? false }:
|
||||
{ stdenv, lib, fetchurl, SDL2, libogg, libvorbis, enableNativeMidi ? false }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "SDL2_mixer-2.0.1";
|
||||
name = "SDL2_mixer-${version}";
|
||||
version = "2.0.1";
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://www.libsdl.org/projects/SDL_mixer/release/${name}.tar.gz";
|
||||
sha256 = "0pv9jzjpcjlbiaybvwrb4avmv46qk7iqxlnqrd2dfj82c4mgc92s";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [SDL2 libogg libvorbis];
|
||||
propagatedBuildInputs = [ SDL2 libogg libvorbis ];
|
||||
|
||||
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/SDL2/SDL_mixer.h $out/include/";
|
||||
|
||||
meta = {
|
||||
meta = with stdenv.lib; {
|
||||
description = "SDL multi-channel audio mixer library";
|
||||
platforms = stdenv.lib.platforms.linux;
|
||||
platforms = platforms.linux;
|
||||
homepage = "https://www.libsdl.org/projects/SDL_mixer/";
|
||||
license = licenses.zlib;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
{ stdenv, fetchurl, SDL2 }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "SDL2_net-2.0.0";
|
||||
name = "SDL2_net-${version}";
|
||||
version = "2.0.1";
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://www.libsdl.org/projects/SDL_net/release/${name}.tar.gz";
|
||||
sha256 = "d715be30783cc99e541626da52079e308060b21d4f7b95f0224b1d06c1faacab";
|
||||
sha256 = "08cxc1bicmyk89kiks7izw1rlx5ng5n6xpy8fy0zxni3b9z8mkhm";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [SDL2];
|
||||
|
||||
postInstall = "ln -s $out/include/SDL2/SDL_net.h $out/include/";
|
||||
propagatedBuildInputs = [ SDL2 ];
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "SDL multiplatform networking library";
|
||||
homepage = https://www.libsdl.org/projects/SDL_net;
|
||||
homepage = "https://www.libsdl.org/projects/SDL_net";
|
||||
license = licenses.zlib;
|
||||
maintainers = [ maintainers.MP2E ];
|
||||
maintainers = with maintainers; [ MP2E ];
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
{ stdenv, fetchurl, SDL2, freetype }:
|
||||
{ stdenv, fetchurl, SDL2, freetype, mesa_noglu }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "SDL2_ttf-2.0.14";
|
||||
name = "SDL2_ttf-${version}";
|
||||
version = "2.0.14";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://www.libsdl.org/projects/SDL_ttf/release/${name}.tar.gz";
|
||||
sha256 = "0xljwcpvd2knrjdfag5b257xqayplz55mqlszrqp0kpnphh5xnrl";
|
||||
};
|
||||
|
||||
buildInputs = [SDL2 freetype];
|
||||
buildInputs = [ SDL2 freetype mesa_noglu ];
|
||||
|
||||
postInstall = "ln -s $out/include/SDL2/SDL_ttf.h $out/include/";
|
||||
|
||||
meta = {
|
||||
meta = with stdenv.lib; {
|
||||
description = "SDL TrueType library";
|
||||
platforms = stdenv.lib.platforms.linux;
|
||||
platforms = platforms.linux;
|
||||
license = licenses.zlib;
|
||||
homepage = "https://www.libsdl.org/projects/SDL_ttf/";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9351,7 +9351,8 @@ in
|
|||
openglSupport = mesaSupported;
|
||||
alsaSupport = stdenv.isLinux;
|
||||
x11Support = !stdenv.isCygwin;
|
||||
pulseaudioSupport = config.pulseaudio or false; # better go through ALSA
|
||||
udevSupport = stdenv.isLinux;
|
||||
pulseaudioSupport = config.pulseaudio or stdenv.isLinux;
|
||||
inherit (darwin.apple_sdk.frameworks) AudioUnit Cocoa CoreAudio CoreServices ForceFeedback OpenGL;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue