2021-01-17 02:04:36 +00:00
|
|
|
{ lib, stdenv, fetchurl, makeWrapper, pkg-config, nasm, makeDesktopItem
|
2021-06-10 03:57:09 +01:00
|
|
|
, alsa-lib, flac, gtk2, libvorbis, libvpx, libGLU, libGL
|
2021-09-11 22:31:31 +01:00
|
|
|
, SDL2, SDL2_mixer
|
|
|
|
, AGL, Cocoa, GLUT, OpenGL
|
|
|
|
}:
|
2009-05-14 14:48:45 +01:00
|
|
|
|
2015-04-30 11:50:27 +01:00
|
|
|
let
|
2019-04-03 14:15:50 +01: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-06-25 03:18:37 +01:00
|
|
|
categories = "Game;";
|
2019-04-03 14:15:50 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
wrapper = "eduke32-wrapper";
|
|
|
|
|
2021-06-22 22:44:58 +01:00
|
|
|
in stdenv.mkDerivation rec {
|
2019-08-13 22:52:01 +01:00
|
|
|
pname = "eduke32";
|
2021-09-11 22:33:51 +01:00
|
|
|
version = "20210910";
|
|
|
|
rev = "9603";
|
|
|
|
revExtra = "6c289cce4";
|
2014-11-06 00:44:33 +00:00
|
|
|
|
2011-07-25 11:48:07 +01:00
|
|
|
src = fetchurl {
|
2021-09-11 22:33:51 +01:00
|
|
|
url = "https://dukeworld.com/eduke32/synthesis/${version}-${rev}-${revExtra}/eduke32_src_${version}-${rev}-${revExtra}.tar.xz";
|
|
|
|
sha256 = "sha256-/NQMsmT9z2N3KWBrP8hlGngQKJUgSP+vrNoFqJscRCk=";
|
2009-05-14 14:48:45 +01:00
|
|
|
};
|
2014-11-06 00:44:33 +00:00
|
|
|
|
2021-09-11 22:31:31 +01:00
|
|
|
buildInputs = [
|
|
|
|
flac
|
|
|
|
libvorbis
|
|
|
|
libvpx
|
|
|
|
SDL2
|
|
|
|
SDL2_mixer
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
alsa-lib
|
|
|
|
gtk2
|
|
|
|
libGL
|
|
|
|
libGLU
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
AGL
|
|
|
|
Cocoa
|
|
|
|
GLUT
|
|
|
|
OpenGL
|
|
|
|
];
|
2019-04-03 14:15:50 +01:00
|
|
|
|
2021-01-17 02:04:36 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper pkg-config ]
|
2021-01-15 04:31:39 +00:00
|
|
|
++ lib.optional (stdenv.hostPlatform.system == "i686-linux") nasm;
|
2014-11-06 00:44:33 +00:00
|
|
|
|
2021-09-11 22:31:31 +01:00
|
|
|
postPatch = lib.optionalString stdenv.isLinux ''
|
2019-04-03 14:15:50 +01:00
|
|
|
substituteInPlace source/build/src/glbuild.cpp \
|
2019-11-10 16:44:34 +00:00
|
|
|
--replace libGLU.so ${libGLU}/lib/libGLU.so
|
2019-04-03 14:15:50 +01:00
|
|
|
|
|
|
|
for f in glad.c glad_wgl.c ; do
|
|
|
|
substituteInPlace source/glad/src/$f \
|
2019-11-10 16:44:34 +00:00
|
|
|
--replace libGL.so ${libGL}/lib/libGL.so
|
2019-04-03 14:15:50 +01:00
|
|
|
done
|
2015-04-30 11:50:27 +01:00
|
|
|
'';
|
|
|
|
|
2019-10-30 01:29:30 +00:00
|
|
|
NIX_CFLAGS_COMPILE = "-I${SDL2.dev}/include/SDL2 -I${SDL2_mixer}/include/SDL2";
|
2015-04-30 11:50:27 +01:00
|
|
|
|
2015-11-26 17:44:44 +00:00
|
|
|
makeFlags = [
|
|
|
|
"SDLCONFIG=${SDL2}/bin/sdl2-config"
|
2021-09-11 22:31:31 +01:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
# broken, see: https://github.com/NixOS/nixpkgs/issues/19098
|
|
|
|
"LTO=0"
|
2015-11-26 17:44:44 +00:00
|
|
|
];
|
2014-11-06 00:44:33 +00:00
|
|
|
|
2019-04-03 14:15:50 +01:00
|
|
|
enableParallelBuilding = true;
|
2010-02-11 13:34:28 +00:00
|
|
|
|
2009-05-14 14:48:45 +01:00
|
|
|
installPhase = ''
|
2019-04-03 14:15:50 +01:00
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
install -Dm755 -t $out/bin eduke32 mapster32
|
2021-09-11 22:31:31 +01:00
|
|
|
'' + lib.optionalString stdenv.isLinux ''
|
2019-04-03 14:15:50 +01:00
|
|
|
makeWrapper $out/bin/eduke32 $out/bin/${wrapper} \
|
|
|
|
--set-default EDUKE32_DATA_DIR /var/lib/games/eduke32 \
|
|
|
|
--add-flags '-g "$EDUKE32_DATA_DIR/DUKE3D.GRP"'
|
|
|
|
|
2015-04-30 11:50:27 +01:00
|
|
|
cp -rv ${desktopItem}/share $out
|
2019-04-03 14:15:50 +01:00
|
|
|
substituteInPlace $out/share/applications/eduke32.desktop \
|
|
|
|
--subst-var out
|
2021-09-11 22:31:31 +01:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
|
|
|
mkdir -p $out/Applications/EDuke32.app/Contents/MacOS
|
|
|
|
mkdir -p $out/Applications/Mapster32.app/Contents/MacOS
|
|
|
|
|
|
|
|
cp -r platform/Apple/bundles/EDuke32.app/* $out/Applications/EDuke32.app/
|
|
|
|
cp -r platform/Apple/bundles/Mapster32.app/* $out/Applications/Mapster32.app/
|
2019-04-03 14:15:50 +01:00
|
|
|
|
2021-09-11 22:31:31 +01:00
|
|
|
ln -sf $out/bin/eduke32 $out/Applications/EDuke32.app/Contents/MacOS/eduke32
|
|
|
|
ln -sf $out/bin/mapster32 $out/Applications/Mapster32.app/Contents/MacOS/mapster32
|
|
|
|
'' + ''
|
2019-04-03 14:15:50 +01:00
|
|
|
runHook postInstall
|
2009-05-14 14:48:45 +01:00
|
|
|
'';
|
2014-11-06 00:44:33 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2010-02-11 13:34:28 +00:00
|
|
|
description = "Enhanched port of Duke Nukem 3D for various platforms";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "http://eduke32.com";
|
2019-04-03 14:15:50 +01:00
|
|
|
license = licenses.gpl2Plus;
|
2021-09-11 22:31:31 +01:00
|
|
|
maintainers = with maintainers; [ mikroskeem sander ];
|
2019-04-03 14:15:50 +01:00
|
|
|
platforms = platforms.all;
|
2010-02-11 13:34:28 +00:00
|
|
|
};
|
2009-05-14 14:48:45 +01:00
|
|
|
}
|