diff --git a/pkgs/development/libraries/SDL2/default.nix b/pkgs/development/libraries/SDL2/default.nix new file mode 100644 index 00000000000..7bc27362a29 --- /dev/null +++ b/pkgs/development/libraries/SDL2/default.nix @@ -0,0 +1,56 @@ +{ stdenv, fetchurl, pkgconfig, audiofile +, openglSupport ? false, mesa ? null +, alsaSupport ? true, alsaLib ? null +, x11Support ? true, x11 ? null, libXrandr ? null +, pulseaudioSupport ? true, pulseaudio ? null +}: + +# OSS is no longer supported, for it's much crappier than ALSA and +# PulseAudio. +assert alsaSupport || pulseaudioSupport; + +assert openglSupport -> (mesa != null && x11Support); +assert x11Support -> (x11 != null && libXrandr != null); +assert alsaSupport -> alsaLib != null; +assert pulseaudioSupport -> pulseaudio != null; + +let + configureFlagsFun = attrs: '' + --disable-oss --disable-video-x11-xme + --disable-x11-shared --disable-alsa-shared --enable-rpath --disable-pulseaudio-shared + --disable-osmesa-shared --enable-static + ${if alsaSupport then "--with-alsa-prefix=${attrs.alsaLib}/lib" else ""} + ''; +in +stdenv.mkDerivation rec { + name = "SDL2-2.0.0"; + + src = fetchurl { + url = "http://www.libsdl.org/release/${name}.tar.gz"; + sha256 = "0y3in99brki7vc2mb4c0w39v70mf4h341mblhh8nmq4h7lawhskg"; + }; + + # Since `libpulse*.la' contain `-lgdbm', PulseAudio must be propagated. + propagatedBuildInputs = stdenv.lib.optionals x11Support [ x11 libXrandr ] ++ + stdenv.lib.optional pulseaudioSupport pulseaudio; + + buildInputs = [ pkgconfig audiofile ] ++ + stdenv.lib.optional openglSupport [ mesa ] ++ + stdenv.lib.optional alsaSupport alsaLib; + + # 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'. + configureFlags = configureFlagsFun { inherit alsaLib; }; + + crossAttrs = { + configureFlags = configureFlagsFun { alsaLib = alsaLib.crossDrv; }; + }; + + passthru = {inherit openglSupport;}; + + meta = { + description = "A cross-platform multimedia library"; + homepage = http://www.libsdl.org/; + }; +} diff --git a/pkgs/development/libraries/SDL2_gfx/default.nix b/pkgs/development/libraries/SDL2_gfx/default.nix new file mode 100644 index 00000000000..693b7bf8fe1 --- /dev/null +++ b/pkgs/development/libraries/SDL2_gfx/default.nix @@ -0,0 +1,54 @@ +{stdenv, fetchsvn, SDL2} : + +let rev = 5; in +stdenv.mkDerivation rec { + name = "SDL2_gfx-${toString rev}"; + + src = fetchsvn { + url = http://svn.code.sf.net/p/sdl2gfx/code/trunk; + inherit rev; + sha256 = "1hzilbn1412m2b44mygrbdfh1gvks4v5p0kmafz248jf9ifsvmzp"; + }; + + buildInputs = [ SDL2 ] ; + + configureFlags = "--disable-mmx"; + + postInstall = '' + sed -i -e 's,"SDL.h",,' \ + $out/include/SDL2/*.h + + ln -s $out/include/SDL2/SDL2_framerate.h $out/include/SDL2/SDL_framerate.h; + ln -s $out/include/SDL2/SDL2_gfxPrimitives.h $out/include/SDL2/SDL_gfxPrimitives.h; + ln -s $out/include/SDL2/SDL2_rotozoom.h $out/include/SDL2/SDL_rotozoom.h; + ln -s $out/include/SDL2/*.h $out/include/; + ''; + + meta = { + description = "SDL graphics drawing primitives and support functions"; + + longDescription = + '' The SDL_gfx library evolved out of the SDL_gfxPrimitives code + which provided basic drawing routines such as lines, circles or + polygons and SDL_rotozoom which implemented a interpolating + rotozoomer for SDL surfaces. + + The current components of the SDL_gfx library are: + + * Graphic Primitives (SDL_gfxPrimitves.h) + * Rotozoomer (SDL_rotozoom.h) + * Framerate control (SDL_framerate.h) + * MMX image filters (SDL_imageFilter.h) + * Custom Blit functions (SDL_gfxBlitFunc.h) + + The library is backwards compatible to the above mentioned + code. Its is written in plain C and can be used in C++ code. + ''; + + homepage = https://sourceforge.net/projects/sdlgfx/; + license = "LGPLv2+"; + + maintainers = [ stdenv.lib.maintainers.bjg ]; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/development/libraries/SDL2_image/default.nix b/pkgs/development/libraries/SDL2_image/default.nix new file mode 100644 index 00000000000..73b5ba8d929 --- /dev/null +++ b/pkgs/development/libraries/SDL2_image/default.nix @@ -0,0 +1,27 @@ +{ stdenv, fetchurl, SDL2, libpng, libjpeg, libtiff, libungif, libXpm, zlib }: + +stdenv.mkDerivation rec { + name = "SDL2_image-2.0.0"; + + src = fetchurl { + url = "http://www.libsdl.org/projects/SDL_image/release/${name}.tar.gz"; + sha256 = "0d3jlhkmr0j5a2dd5h6y29jfcsj7mkl16wghm6n3nqqp7g3ib65j"; + }; + + buildInputs = [SDL2 libpng libjpeg libtiff libungif libXpm zlib]; + + postInstall = '' + sed -i -e 's,"SDL.h",,' \ + -e 's,"SDL_version.h",,' \ + -e 's,"begin_code.h",,' \ + -e 's,"close_code.h",,' \ + $out/include/SDL2/SDL_image.h + ln -sv SDL2/SDL_image.h $out/include/SDL_image.h + ''; + + meta = { + description = "SDL image library"; + homepage = "http://www.libsdl.org/projects/SDL_image/"; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/development/libraries/SDL2_mixer/default.nix b/pkgs/development/libraries/SDL2_mixer/default.nix new file mode 100644 index 00000000000..6d29ddf6eea --- /dev/null +++ b/pkgs/development/libraries/SDL2_mixer/default.nix @@ -0,0 +1,20 @@ +{ stdenv, fetchurl, SDL2, libogg, libvorbis, enableNativeMidi ? false }: + +stdenv.mkDerivation rec { + name = "SDL2_mixer-2.0.0"; + + src = fetchurl { + url = "http://www.libsdl.org/projects/SDL_mixer/release/${name}.tar.gz"; + sha256 = "0nvjdxjchrajrn0jag877hdx9zb788hsd315zzg1lyck2wb0xkm8"; + }; + + buildInputs = [SDL2 libogg libvorbis]; + + configureFlags = "--disable-music-ogg-shared" + stdenv.lib.optionalString enableNativeMidi "--enable-music-native-midi-gpl"; + + postInstall = "ln -s $out/include/SDL2/SDL_mixer.h $out/include/"; + + meta = { + description = "SDL multi-channel audio mixer library"; + }; +} diff --git a/pkgs/development/libraries/libyaml-cpp/0.3.x.nix b/pkgs/development/libraries/libyaml-cpp/0.3.x.nix new file mode 100644 index 00000000000..4b0acd83fc3 --- /dev/null +++ b/pkgs/development/libraries/libyaml-cpp/0.3.x.nix @@ -0,0 +1,18 @@ +{stdenv, fetchurl, cmake, boostHeaders}: + +stdenv.mkDerivation { + name = "libyaml-cpp-0.3.0"; + + src = fetchurl { + url = http://yaml-cpp.googlecode.com/files/yaml-cpp-0.3.0.tar.gz; + sha256 = "10kv25zgq96ybxc6c19lzpax1xi5lpxrdqa9x52nffsql6skil1c"; + }; + + buildInputs = [ cmake boostHeaders ]; + + meta = { + homepage = http://code.google.com/p/yaml-cpp/; + description = "A YAML parser and emitter for C++"; + license = "MIT"; + }; +} diff --git a/pkgs/development/libraries/libyaml-cpp/default.nix b/pkgs/development/libraries/libyaml-cpp/default.nix new file mode 100644 index 00000000000..09860522ef4 --- /dev/null +++ b/pkgs/development/libraries/libyaml-cpp/default.nix @@ -0,0 +1,18 @@ +{stdenv, fetchurl, cmake, boostHeaders}: + +stdenv.mkDerivation { + name = "libyaml-cpp-0.5.1"; + + src = fetchurl { + url = http://yaml-cpp.googlecode.com/files/yaml-cpp-0.5.1.tar.gz; + sha256 = "01kg0h8ksp162kdhyzn67vnlxpj5zjbks84sh50pv61xni990z1y"; + }; + + buildInputs = [ cmake boostHeaders ]; + + meta = { + homepage = http://code.google.com/p/yaml-cpp/; + description = "A YAML parser and emitter for C++"; + license = "MIT"; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 68f780996fc..8d727a37260 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5092,6 +5092,9 @@ let libyaml = callPackage ../development/libraries/libyaml { }; + libyamlcpp = callPackage ../development/libraries/libyaml-cpp { }; + libyamlcpp03 = callPackage ../development/libraries/libyaml-cpp/0.3.x.nix { }; + libzip = callPackage ../development/libraries/libzip { }; libzrtpcpp = callPackage ../development/libraries/libzrtpcpp { }; @@ -5511,6 +5514,19 @@ let SDL_ttf = callPackage ../development/libraries/SDL_ttf { }; + SDL2 = callPackage ../development/libraries/SDL2 { + openglSupport = mesaSupported; + alsaSupport = true; + x11Support = true; + pulseaudioSupport = false; # better go through ALSA + }; + + SDL2_image = callPackage ../development/libraries/SDL2_image { }; + + SDL2_mixer = callPackage ../development/libraries/SDL2_mixer { }; + + SDL2_gfx = callPackage ../development/libraries/SDL2_gfx { }; + serd = callPackage ../development/libraries/serd {}; silgraphite = callPackage ../development/libraries/silgraphite {};