diff --git a/pkgs/development/libraries/smpeg2/default.nix b/pkgs/development/libraries/smpeg2/default.nix new file mode 100644 index 000000000000..10386a7b33e4 --- /dev/null +++ b/pkgs/development/libraries/smpeg2/default.nix @@ -0,0 +1,43 @@ +{ stdenv, fetchsvn, autoconf, automake, libtool, m4, pkgconfig, makeWrapper, SDL2 }: + +stdenv.mkDerivation rec { + name = "smpeg2-svn${version}"; + version = "412"; + + src = fetchsvn { + url = svn://svn.icculus.org/smpeg/trunk; + rev = version; + sha256 = "1irf2d8f150j8cx8lbb0pz1rijap536crsz0mw871xrh6wd2fd96"; + }; + + patches = [ + ./gcc6.patch + ./sdl2.patch + ]; + + nativeBuildInputs = [ autoconf automake pkgconfig makeWrapper ]; + + buildInputs = [ SDL2 ]; + + preConfigure = '' + sh autogen.sh + ''; + + postInstall = '' + sed -e 's,#include "\(SDL.*.h\)",#include ,' -i $out/include/smpeg2/*.h + + wrapProgram $out/bin/smpeg2-config \ + --prefix PATH ":" "${pkgconfig}/bin" \ + --prefix PKG_CONFIG_PATH ":" "${SDL2.dev}/lib/pkgconfig" + ''; + + enableParallelBuilding = true; + + meta = with stdenv.lib; { + homepage = http://icculus.org/smpeg/; + description = "SDL2 MPEG Player Library"; + license = licenses.lgpl2; + platforms = platforms.linux; + maintainers = with maintainers; [ orivej ]; + }; +} diff --git a/pkgs/development/libraries/smpeg2/gcc6.patch b/pkgs/development/libraries/smpeg2/gcc6.patch new file mode 100644 index 000000000000..165feb4428c2 --- /dev/null +++ b/pkgs/development/libraries/smpeg2/gcc6.patch @@ -0,0 +1,33 @@ +--- a/audio/hufftable.cpp ++++ b/audio/hufftable.cpp +@@ -9,6 +9,7 @@ + #include "config.h" + #endif + ++#include + #include "MPEGaudio.h" + + static const unsigned int +@@ -550,11 +551,11 @@ htd33[ 31][2]={{ 16, 1},{ 8, 1},{ 4, + + const HUFFMANCODETABLE MPEGaudio::ht[HTN]= + { +- { 0, 0-1, 0-1, 0, 0, htd33}, ++ { 0, UINT_MAX, UINT_MAX, 0, 0, htd33}, + { 1, 2-1, 2-1, 0, 7,htd01}, + { 2, 3-1, 3-1, 0, 17,htd02}, + { 3, 3-1, 3-1, 0, 17,htd03}, +- { 4, 0-1, 0-1, 0, 0, htd33}, ++ { 4, UINT_MAX, UINT_MAX, 0, 0, htd33}, + { 5, 4-1, 4-1, 0, 31,htd05}, + { 6, 4-1, 4-1, 0, 31,htd06}, + { 7, 6-1, 6-1, 0, 71,htd07}, +@@ -564,7 +565,7 @@ const HUFFMANCODETABLE MPEGaudio::ht[HTN + {11, 8-1, 8-1, 0,127,htd11}, + {12, 8-1, 8-1, 0,127,htd12}, + {13,16-1,16-1, 0,511,htd13}, +- {14, 0-1, 0-1, 0, 0, htd33}, ++ {14, UINT_MAX, UINT_MAX, 0, 0, htd33}, + {15,16-1,16-1, 0,511,htd15}, + {16,16-1,16-1, 1,511,htd16}, + {17,16-1,16-1, 2,511,htd16}, diff --git a/pkgs/development/libraries/smpeg2/sdl2.patch b/pkgs/development/libraries/smpeg2/sdl2.patch new file mode 100644 index 000000000000..63bc352976ec --- /dev/null +++ b/pkgs/development/libraries/smpeg2/sdl2.patch @@ -0,0 +1,22 @@ +diff --git a/smpeg2-config.in b/smpeg2-config.in +index 5cce954..0e61939 100644 +--- a/smpeg2-config.in ++++ b/smpeg2-config.in +@@ -42,7 +42,7 @@ while test $# -gt 0; do + if test @includedir@ != /usr/include ; then + includes=-I@includedir@ + fi +- echo $includes -I@includedir@/smpeg2 `@SDL_CONFIG@ --cflags` ++ echo $includes -I@includedir@/smpeg2 `@SDL2_CONFIG@ --cflags` + ;; + --libs) + if [ "`uname`" = "SunOS" ]; then +@@ -50,7 +50,7 @@ while test $# -gt 0; do + else + libdirs="-L@libdir@ @SMPEG_RLD_FLAGS@" + fi +- echo $libdirs -lsmpeg2 `@SDL_CONFIG@ --libs` ++ echo $libdirs -lsmpeg2 `@SDL2_CONFIG@ --libs` + ;; + *) + echo "${usage}" 1>&2 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ca8b5690dfe6..49b32f30e132 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10299,6 +10299,8 @@ with pkgs; smpeg = callPackage ../development/libraries/smpeg { }; + smpeg2 = callPackage ../development/libraries/smpeg2 { }; + snack = callPackage ../development/libraries/snack { # optional };