summary refs log tree commit diff
path: root/pkgs/development/libraries
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2016-08-22 06:24:00 +0300
committerNikolay Amiantov <ab@fmap.me>2016-08-22 06:30:00 +0300
commitb47327ebd535468f71bbf6a46366e0bd9357b599 (patch)
tree987e9ce4217b3a72404729c539a6e5f13420a5e2 /pkgs/development/libraries
parent3e2458a08537e1cd6a5dbcd2ad0cd7fe83be5d34 (diff)
downloadnixpkgs-b47327ebd535468f71bbf6a46366e0bd9357b599.tar
nixpkgs-b47327ebd535468f71bbf6a46366e0bd9357b599.tar.gz
nixpkgs-b47327ebd535468f71bbf6a46366e0bd9357b599.tar.bz2
nixpkgs-b47327ebd535468f71bbf6a46366e0bd9357b599.tar.lz
nixpkgs-b47327ebd535468f71bbf6a46366e0bd9357b599.tar.xz
nixpkgs-b47327ebd535468f71bbf6a46366e0bd9357b599.tar.zst
nixpkgs-b47327ebd535468f71bbf6a46366e0bd9357b599.zip
SDL: cleanup and add patch to discover extensions
Diffstat (limited to 'pkgs/development/libraries')
-rw-r--r--pkgs/development/libraries/SDL/default.nix28
-rw-r--r--pkgs/development/libraries/SDL/find-headers.patch16
-rw-r--r--pkgs/development/libraries/SDL/setup-hook.sh11
-rw-r--r--pkgs/development/libraries/SDL_gfx/default.nix24
-rw-r--r--pkgs/development/libraries/SDL_image/default.nix14
-rw-r--r--pkgs/development/libraries/SDL_mixer/default.nix18
-rw-r--r--pkgs/development/libraries/SDL_net/default.nix19
-rw-r--r--pkgs/development/libraries/SDL_sound/default.nix13
-rw-r--r--pkgs/development/libraries/SDL_stretch/default.nix13
9 files changed, 74 insertions, 82 deletions
diff --git a/pkgs/development/libraries/SDL/default.nix b/pkgs/development/libraries/SDL/default.nix
index 6c3920ff8aa..ca0bbd6a01c 100644
--- a/pkgs/development/libraries/SDL/default.nix
+++ b/pkgs/development/libraries/SDL/default.nix
@@ -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;
diff --git a/pkgs/development/libraries/SDL/find-headers.patch b/pkgs/development/libraries/SDL/find-headers.patch
new file mode 100644
index 00000000000..5f75ae9e830
--- /dev/null
+++ b/pkgs/development/libraries/SDL/find-headers.patch
@@ -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@
diff --git a/pkgs/development/libraries/SDL/setup-hook.sh b/pkgs/development/libraries/SDL/setup-hook.sh
new file mode 100644
index 00000000000..3696e743a07
--- /dev/null
+++ b/pkgs/development/libraries/SDL/setup-hook.sh
@@ -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
diff --git a/pkgs/development/libraries/SDL_gfx/default.nix b/pkgs/development/libraries/SDL_gfx/default.nix
index 7bff348b754..ff8c081af93 100644
--- a/pkgs/development/libraries/SDL_gfx/default.nix
+++ b/pkgs/development/libraries/SDL_gfx/default.nix
@@ -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;
   };
 }
diff --git a/pkgs/development/libraries/SDL_image/default.nix b/pkgs/development/libraries/SDL_image/default.nix
index a1d83950477..62af47807cc 100644
--- a/pkgs/development/libraries/SDL_image/default.nix
+++ b/pkgs/development/libraries/SDL_image/default.nix
@@ -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;
   };
diff --git a/pkgs/development/libraries/SDL_mixer/default.nix b/pkgs/development/libraries/SDL_mixer/default.nix
index 2db10eeea76..d3d57947464 100644
--- a/pkgs/development/libraries/SDL_mixer/default.nix
+++ b/pkgs/development/libraries/SDL_mixer/default.nix
@@ -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";
diff --git a/pkgs/development/libraries/SDL_net/default.nix b/pkgs/development/libraries/SDL_net/default.nix
index 045ad8925d9..b151d0ee83e 100644
--- a/pkgs/development/libraries/SDL_net/default.nix
+++ b/pkgs/development/libraries/SDL_net/default.nix
@@ -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";
   };
 }
diff --git a/pkgs/development/libraries/SDL_sound/default.nix b/pkgs/development/libraries/SDL_sound/default.nix
index 5ca64730f51..8d088b6bbf4 100644
--- a/pkgs/development/libraries/SDL_sound/default.nix
+++ b/pkgs/development/libraries/SDL_sound/default.nix
@@ -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/";
   };
 }
diff --git a/pkgs/development/libraries/SDL_stretch/default.nix b/pkgs/development/libraries/SDL_stretch/default.nix
index 52c43da9d16..2a4ddac524c 100644
--- a/pkgs/development/libraries/SDL_stretch/default.nix
+++ b/pkgs/development/libraries/SDL_stretch/default.nix
@@ -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;
   };
 }