nixpkgs/pkgs/games/eduke32/default.nix

77 lines
2.1 KiB
Nix
Raw Normal View History

{ stdenv, fetchurl, flac, gtk2, libvorbis, libvpx, makeDesktopItem, libGLU_combined, nasm
2015-04-30 10:50:27 +00:00
, pkgconfig, SDL2, SDL2_mixer }:
2015-04-30 10:50:27 +00:00
let
year = "2015";
2015-04-30 10:50:27 +00:00
date = "20150420";
rev = "5160";
in stdenv.mkDerivation rec {
name = "eduke32-${version}";
version = "${date}-${rev}";
src = fetchurl {
url = "http://dukeworld.duke4.net/eduke32/synthesis/old/${year}/${version}/eduke32_src_${version}.tar.xz";
2015-04-30 10:50:27 +00:00
sha256 = "1nlq5jbglg00c1z1vsyl627fh0mqfxvk5qyxav5vzla2b4svik2v";
};
buildInputs = [ flac gtk2 libvorbis libvpx libGLU_combined SDL2 SDL2_mixer ]
++ stdenv.lib.optional (stdenv.system == "i686-linux") nasm;
nativeBuildInputs = [ pkgconfig ];
2015-04-30 10:50:27 +00:00
postPatch = ''
substituteInPlace build/src/glbuild.c \
--replace libGL.so ${libGLU_combined}/lib/libGL.so \
--replace libGLU.so ${libGLU_combined}/lib/libGLU.so
2015-04-30 10:50:27 +00:00
'';
2017-01-12 13:50:38 +00:00
NIX_CFLAGS_COMPILE = "-I${SDL2.dev}/include/SDL2 -I${SDL2_mixer}/include/SDL2";
2015-04-30 10:50:27 +00:00
NIX_LDFLAGS = "-L${SDL2}/lib";
makeFlags = [
"LINKED_GTK=1"
"SDLCONFIG=${SDL2}/bin/sdl2-config"
"VC_REV=${rev}"
];
desktopItem = makeDesktopItem {
name = "eduke32";
exec = "eduke32-wrapper";
comment = "Duke Nukem 3D port";
2015-04-30 10:50:27 +00:00
desktopName = "Enhanced Duke Nukem 3D";
genericName = "Duke Nukem 3D port";
categories = "Application;Game;";
};
installPhase = ''
# Make wrapper script
2015-04-30 10:50:27 +00:00
cat > eduke32-wrapper <<EOF
#!/bin/sh
2015-04-30 10:50:27 +00:00
if [ "$EDUKE32_DATA_DIR" = "" ]; then
EDUKE32_DATA_DIR=/var/lib/games/eduke32
fi
2015-04-30 10:50:27 +00:00
if [ "$EDUKE32_GRP_FILE" = "" ]; then
EDUKE32_GRP_FILE=\$EDUKE32_DATA_DIR/DUKE3D.GRP
fi
cd \$EDUKE32_DATA_DIR
2015-04-30 10:50:27 +00:00
exec $out/bin/eduke32 -g \$EDUKE32_GRP_FILE
EOF
2015-04-30 10:50:27 +00:00
# Install binaries
mkdir -p $out/bin
install -Dm755 eduke32{,-wrapper} mapster32 $out/bin
# Install desktop item
2015-04-30 10:50:27 +00:00
cp -rv ${desktopItem}/share $out
'';
2015-04-30 10:50:27 +00:00
meta = with stdenv.lib; {
description = "Enhanched port of Duke Nukem 3D for various platforms";
license = licenses.gpl2Plus;
homepage = http://eduke32.com;
maintainers = with maintainers; [ sander ];
platforms = with platforms; linux;
};
}