nixpkgs/pkgs/games/eduke32/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

124 lines
3.1 KiB
Nix
Raw Normal View History

2023-10-01 18:23:59 +00:00
{ lib
, stdenv
, fetchurl
, makeWrapper
, pkg-config
, nasm
, makeDesktopItem
, alsa-lib
, flac
, gtk2
, libvorbis
, libvpx
, libGLU
, libGL
, SDL2
, SDL2_mixer
, AGL
, Cocoa
, GLUT
, OpenGL
}:
2015-04-30 10:50:27 +00:00
let
desktopItem = makeDesktopItem {
name = "eduke32";
exec = "@out@/bin/${wrapper}";
comment = "Duke Nukem 3D port";
desktopName = "Enhanced Duke Nukem 3D";
genericName = "Duke Nukem 3D port";
categories = [ "Game" ];
};
wrapper = "eduke32-wrapper";
2021-06-22 21:44:58 +00:00
in stdenv.mkDerivation rec {
2019-08-13 21:52:01 +00:00
pname = "eduke32";
2023-10-01 18:23:59 +00:00
version = "20230926";
rev = "10459";
revExtra = "8feaf6c25";
src = fetchurl {
2021-09-11 21:33:51 +00:00
url = "https://dukeworld.com/eduke32/synthesis/${version}-${rev}-${revExtra}/eduke32_src_${version}-${rev}-${revExtra}.tar.xz";
2023-10-01 18:23:59 +00:00
hash = "sha256-GQOpDQm2FeaOMyYu9L5zhrM6XFvZAHMAwn1tSK7RCB8=";
};
buildInputs = [
flac
libvorbis
libvpx
SDL2
SDL2_mixer
] ++ lib.optionals stdenv.isLinux [
alsa-lib
gtk2
libGL
libGLU
] ++ lib.optionals stdenv.isDarwin [
AGL
Cocoa
GLUT
OpenGL
];
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;
2023-01-06 16:34:06 +00:00
postPatch = ''
2023-10-01 18:23:59 +00:00
substituteInPlace source/imgui/src/imgui_impl_sdl2.cpp \
2023-01-06 16:34:06 +00:00
--replace '#include <SDL.h>' '#include <SDL2/SDL.h>' \
--replace '#include <SDL_syswm.h>' '#include <SDL2/SDL_syswm.h>' \
--replace '#include <SDL_vulkan.h>' '#include <SDL2/SDL_vulkan.h>'
'' + lib.optionalString stdenv.isLinux ''
substituteInPlace source/build/src/glbuild.cpp \
2019-11-10 16:44:34 +00:00
--replace libGLU.so ${libGLU}/lib/libGLU.so
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
done
2015-04-30 10:50:27 +00:00
'';
makeFlags = [
"SDLCONFIG=${SDL2}/bin/sdl2-config"
] ++ lib.optionals stdenv.isDarwin [
# broken, see: https://github.com/NixOS/nixpkgs/issues/19098
"LTO=0"
];
enableParallelBuilding = true;
installPhase = ''
runHook preInstall
install -Dm755 -t $out/bin eduke32 mapster32
'' + lib.optionalString stdenv.isLinux ''
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 10:50:27 +00:00
cp -rv ${desktopItem}/share $out
substituteInPlace $out/share/applications/eduke32.desktop \
--subst-var out
'' + 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/
ln -sf $out/bin/eduke32 $out/Applications/EDuke32.app/Contents/MacOS/eduke32
ln -sf $out/bin/mapster32 $out/Applications/Mapster32.app/Contents/MacOS/mapster32
'' + ''
runHook postInstall
'';
meta = with lib; {
description = "Enhanched port of Duke Nukem 3D for various platforms";
homepage = "http://eduke32.com";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ mikroskeem sander ];
platforms = platforms.all;
};
}