2023-11-16 04:20:00 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, fetchpatch, SDL, autoconf, automake, libtool, gtk2, m4, pkg-config, libGLU, libGL, makeWrapper }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2022-06-26 10:26:21 +00:00
|
|
|
pname = "smpeg";
|
|
|
|
version = "0.4.5";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "icculus";
|
|
|
|
repo = "smpeg";
|
|
|
|
rev = "release_${builtins.replaceStrings ["."] ["_"] version}";
|
|
|
|
sha256 = "sha256-nq/i7cFGpJXIuTwN/ScLMX7FN8NMdgdsRM9xOD3uycs=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
./format.patch
|
|
|
|
./gcc6.patch
|
|
|
|
./libx11.patch
|
2022-06-16 17:23:12 +00:00
|
|
|
./gtk.patch
|
2023-11-16 04:20:00 +00:00
|
|
|
# These patches remove use of the `register` storage class specifier,
|
|
|
|
# allowing smpeg to build with clang 16, which defaults to C++17.
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/icculus/smpeg/commit/cc114ba0dd8644c0d6205bbce2384781daeff44b.patch";
|
|
|
|
hash = "sha256-GxSD82j05pw0r2SxmPYAe/BXX4iUc+iHWhB9Ap4GzfA=";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/icculus/smpeg/commit/b369feca5bf99d6cff50d8eb316395ef48acf24f.patch";
|
|
|
|
hash = "sha256-U+a6dbc5cm249KlUcf4vi79yUiT4hgEvMv522K4PqUc=";
|
|
|
|
})
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace video/gdith.cpp \
|
|
|
|
--replace 'register int' 'int' \
|
|
|
|
--replace 'register Uint16' 'Uint16'
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ autoconf automake libtool m4 pkg-config makeWrapper ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
buildInputs = [ SDL ] ++ lib.optionals (!stdenv.isDarwin) [ gtk2 libGLU libGL ];
|
2022-06-26 10:26:21 +00:00
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
preConfigure = ''
|
|
|
|
touch NEWS AUTHORS ChangeLog
|
|
|
|
sh autogen.sh
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
sed -i -e 's,"SDL.h",<SDL/SDL.h>,' \
|
|
|
|
-e 's,"SDL_mutex.h",<SDL/SDL_mutex.h>,' \
|
|
|
|
-e 's,"SDL_audio.h",<SDL/SDL_audio.h>,' \
|
|
|
|
-e 's,"SDL_thread.h",<SDL/SDL_thread.h>,' \
|
|
|
|
-e 's,"SDL_types.h",<SDL/SDL_types.h>,' \
|
2022-10-21 18:38:19 +00:00
|
|
|
$dev/include/smpeg/*.h
|
|
|
|
|
|
|
|
moveToOutput bin/smpeg-config "$dev"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
wrapProgram $dev/bin/smpeg-config \
|
2021-02-05 17:12:51 +00:00
|
|
|
--prefix PATH ":" "${pkg-config}/bin" \
|
2022-06-16 17:23:12 +00:00
|
|
|
--prefix PKG_CONFIG_PATH ":" "${lib.getDev SDL}/lib/pkgconfig"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
NIX_LDFLAGS = "-lX11";
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = "http://icculus.org/smpeg/";
|
|
|
|
description = "MPEG decoding library";
|
2021-02-05 17:12:51 +00:00
|
|
|
license = lib.licenses.gpl2Plus;
|
|
|
|
platforms = lib.platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|