2020-04-24 23:36:52 +00:00
|
|
|
{ stdenv, fetchurl, makeWrapper, pkgconfig, nasm, makeDesktopItem
|
2020-11-21 19:51:51 +00:00
|
|
|
, alsaLib, flac, gtk2, libvorbis, libvpx, libGLU, libGL
|
2020-04-24 23:36:52 +00:00
|
|
|
, SDL2, SDL2_mixer }:
|
|
|
|
|
|
|
|
let
|
2020-11-21 19:51:51 +00:00
|
|
|
version = "20200907";
|
2020-11-30 08:33:03 +00:00
|
|
|
rev = "9257";
|
2020-11-21 19:51:51 +00:00
|
|
|
revExtra = "93f62bbad";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
desktopItem = makeDesktopItem {
|
|
|
|
name = "eduke32";
|
|
|
|
exec = "@out@/bin/${wrapper}";
|
|
|
|
comment = "Duke Nukem 3D port";
|
|
|
|
desktopName = "Enhanced Duke Nukem 3D";
|
|
|
|
genericName = "Duke Nukem 3D port";
|
2020-07-18 16:06:22 +00:00
|
|
|
categories = "Game;";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
wrapper = "eduke32-wrapper";
|
|
|
|
|
|
|
|
in stdenv.mkDerivation {
|
|
|
|
pname = "eduke32";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = fetchurl {
|
2020-11-30 08:33:03 +00:00
|
|
|
url = "http://dukeworld.duke4.net/eduke32/synthesis/latest/eduke32_src_${version}-${rev}-${revExtra}.tar.xz";
|
2020-11-21 19:51:51 +00:00
|
|
|
sha256 = "972630059be61ef9564a241b84ef2ee4f69fc85c19ee36ce46052ff2f1ce3bf9";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-11-21 19:51:51 +00:00
|
|
|
buildInputs = [ alsaLib flac gtk2 libvorbis libvpx libGL libGLU SDL2 SDL2_mixer ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper pkgconfig ]
|
|
|
|
++ stdenv.lib.optional (stdenv.hostPlatform.system == "i686-linux") nasm;
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace source/build/src/glbuild.cpp \
|
|
|
|
--replace libGLU.so ${libGLU}/lib/libGLU.so
|
|
|
|
|
|
|
|
for f in glad.c glad_wgl.c ; do
|
|
|
|
substituteInPlace source/glad/src/$f \
|
|
|
|
--replace libGL.so ${libGL}/lib/libGL.so
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
NIX_CFLAGS_COMPILE = "-I${SDL2.dev}/include/SDL2 -I${SDL2_mixer}/include/SDL2";
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"SDLCONFIG=${SDL2}/bin/sdl2-config"
|
|
|
|
];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
install -Dm755 -t $out/bin eduke32 mapster32
|
|
|
|
|
|
|
|
makeWrapper $out/bin/eduke32 $out/bin/${wrapper} \
|
|
|
|
--set-default EDUKE32_DATA_DIR /var/lib/games/eduke32 \
|
|
|
|
--add-flags '-g "$EDUKE32_DATA_DIR/DUKE3D.GRP"'
|
|
|
|
|
|
|
|
cp -rv ${desktopItem}/share $out
|
|
|
|
substituteInPlace $out/share/applications/eduke32.desktop \
|
|
|
|
--subst-var out
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Enhanched port of Duke Nukem 3D for various platforms";
|
|
|
|
homepage = "http://eduke32.com";
|
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
maintainers = with maintainers; [ sander ];
|
|
|
|
# Darwin is untested (supported by upstream)
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|