1 { lib, stdenv, fetchFromGitHub, fetchpatch, SDL, autoconf, automake, libtool, gtk2, m4, pkg-config, libGLU, libGL, makeWrapper }:
3 stdenv.mkDerivation rec {
7 src = fetchFromGitHub {
10 rev = "release_${builtins.replaceStrings ["."] ["_"] version}";
11 sha256 = "sha256-nq/i7cFGpJXIuTwN/ScLMX7FN8NMdgdsRM9xOD3uycs=";
19 # These patches remove use of the `register` storage class specifier,
20 # allowing smpeg to build with clang 16, which defaults to C++17.
22 url = "https://github.com/icculus/smpeg/commit/cc114ba0dd8644c0d6205bbce2384781daeff44b.patch";
23 hash = "sha256-GxSD82j05pw0r2SxmPYAe/BXX4iUc+iHWhB9Ap4GzfA=";
26 url = "https://github.com/icculus/smpeg/commit/b369feca5bf99d6cff50d8eb316395ef48acf24f.patch";
27 hash = "sha256-U+a6dbc5cm249KlUcf4vi79yUiT4hgEvMv522K4PqUc=";
32 substituteInPlace video/gdith.cpp \
33 --replace 'register int' 'int' \
34 --replace 'register Uint16' 'Uint16'
37 enableParallelBuilding = true;
39 nativeBuildInputs = [ autoconf automake libtool m4 pkg-config makeWrapper ];
41 buildInputs = [ SDL ] ++ lib.optionals (!stdenv.isDarwin) [ gtk2 libGLU libGL ];
43 outputs = [ "out" "dev" ];
46 touch NEWS AUTHORS ChangeLog
51 sed -i -e 's,"SDL.h",<SDL/SDL.h>,' \
52 -e 's,"SDL_mutex.h",<SDL/SDL_mutex.h>,' \
53 -e 's,"SDL_audio.h",<SDL/SDL_audio.h>,' \
54 -e 's,"SDL_thread.h",<SDL/SDL_thread.h>,' \
55 -e 's,"SDL_types.h",<SDL/SDL_types.h>,' \
56 $dev/include/smpeg/*.h
58 moveToOutput bin/smpeg-config "$dev"
60 wrapProgram $dev/bin/smpeg-config \
61 --prefix PATH ":" "${pkg-config}/bin" \
62 --prefix PKG_CONFIG_PATH ":" "${lib.getDev SDL}/lib/pkgconfig"
65 NIX_LDFLAGS = "-lX11";
68 homepage = "http://icculus.org/smpeg/";
69 description = "MPEG decoding library";
70 license = lib.licenses.gpl2Plus;
71 platforms = lib.platforms.unix;