eduke32 20130303-3542 -> 20150420-5160

This commit is contained in:
Tobias Geerinckx-Rice 2015-04-30 12:50:27 +02:00
parent 3b611e3a0a
commit dc5c8ce819

View File

@ -1,68 +1,70 @@
{stdenv, fetchurl, SDL, SDL_mixer, libvorbis, mesa, gtk, pkgconfig, nasm, libvpx, flac, makeDesktopItem}: { stdenv, fetchurl, flac, gtk, libvorbis, libvpx, makeDesktopItem, mesa, nasm
, pkgconfig, SDL2, SDL2_mixer }:
stdenv.mkDerivation rec { let
name = "eduke32-20130303-3542"; date = "20150420";
rev = "5160";
version = "${date}-${rev}";
in stdenv.mkDerivation rec {
name = "eduke32-${version}";
src = fetchurl { src = fetchurl {
url = http://dukeworld.duke4.net/eduke32/synthesis/20130303-3542/eduke32_src_20130303-3542.tar.bz2; url = "http://dukeworld.duke4.net/eduke32/synthesis/${version}/eduke32_src_${version}.tar.xz";
sha256 = "0v1q2bkmpnac5l9x97nnlhrrb95518vmhxx48zv3ncvmpafl1mqc"; sha256 = "1nlq5jbglg00c1z1vsyl627fh0mqfxvk5qyxav5vzla2b4svik2v";
}; };
buildInputs = [ SDL SDL_mixer libvorbis mesa gtk pkgconfig libvpx flac ] buildInputs = [ flac gtk libvorbis libvpx mesa pkgconfig SDL2 SDL2_mixer ]
++ stdenv.lib.optional (stdenv.system == "i686-linux") nasm; ++ stdenv.lib.optional (stdenv.system == "i686-linux") nasm;
NIX_CFLAGS_COMPILE = "-I${SDL}/include/SDL"; postPatch = ''
NIX_LDFLAGS = "-L${SDL}/lib -lgcc_s"; substituteInPlace build/src/glbuild.c \
--replace libGL.so ${mesa}/lib/libGL.so \
--replace libGLU.so ${mesa}/lib/libGLU.so
'';
NIX_CFLAGS_COMPILE = "-I${SDL2}/include/SDL";
NIX_LDFLAGS = "-L${SDL2}/lib";
makeFlags = "LINKED_GTK=1 SDLCONFIG=${SDL2}/bin/sdl2-config VC_REV=${rev}";
desktopItem = makeDesktopItem { desktopItem = makeDesktopItem {
name = "eduke32"; name = "eduke32";
exec = "eduke32-wrapper"; exec = "eduke32-wrapper";
comment = "Duke Nukem 3D port"; comment = "Duke Nukem 3D port";
desktopName = "EDuke32"; desktopName = "Enhanced Duke Nukem 3D";
genericName = "Duke Nukem 3D port"; genericName = "Duke Nukem 3D port";
categories = "Application;Game;"; categories = "Application;Game;";
}; };
preConfigure = ''
sed -i -e "s|/usr/bin/sdl-config|${SDL}/bin/sdl-config|" build/Makefile.shared
'';
buildPhase = ''
make OPTLEVEL=0 USE_LIBPNG=0
'';
installPhase = '' installPhase = ''
# Install binaries
mkdir -p $out/bin
cp eduke32 mapster32 $out/bin
# Make wrapper script # Make wrapper script
cat > $out/bin/eduke32-wrapper <<EOF cat > eduke32-wrapper <<EOF
#!/bin/sh #!/bin/sh
if [ "$EDUKE32_DATA_DIR" = "" ] if [ "$EDUKE32_DATA_DIR" = "" ]; then
then
EDUKE32_DATA_DIR=/var/lib/games/eduke32 EDUKE32_DATA_DIR=/var/lib/games/eduke32
fi fi
if [ "$EDUKE32_GRP_FILE" = "" ] if [ "$EDUKE32_GRP_FILE" = "" ]; then
then
EDUKE32_GRP_FILE=\$EDUKE32_DATA_DIR/DUKE3D.GRP EDUKE32_GRP_FILE=\$EDUKE32_DATA_DIR/DUKE3D.GRP
fi fi
cd \$EDUKE32_DATA_DIR cd \$EDUKE32_DATA_DIR
eduke32 -g \$EDUKE32_GRP_FILE exec $out/bin/eduke32 -g \$EDUKE32_GRP_FILE
EOF EOF
chmod 755 $out/bin/eduke32-wrapper
# Install binaries
mkdir -p $out/bin
install -Dm755 eduke32{,-wrapper} mapster32 $out/bin
# Install desktop item # Install desktop item
mkdir -p $out/share/applications cp -rv ${desktopItem}/share $out
cp ${desktopItem}/share/applications/* $out/share/applications
''; '';
meta = { meta = with stdenv.lib; {
inherit version;
description = "Enhanched port of Duke Nukem 3D for various platforms"; description = "Enhanched port of Duke Nukem 3D for various platforms";
license = stdenv.lib.licenses.gpl2Plus; license = with licenses; gpl2Plus;
homepage = http://eduke32.com; homepage = http://eduke32.com;
maintainers = [ stdenv.lib.maintainers.sander ]; maintainers = with maintainers; [ nckx sander ];
}; };
} }