blob: 519b7c2ac2475fb8c803b01ceb830b599364ade9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
{ stdenv, fetchurl, flac, gtk2, libvorbis, libvpx, makeDesktopItem, mesa, nasm
, pkgconfig, SDL2, SDL2_mixer }:
let
year = "2015";
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";
sha256 = "1nlq5jbglg00c1z1vsyl627fh0mqfxvk5qyxav5vzla2b4svik2v";
};
buildInputs = [ flac gtk2 libvorbis libvpx mesa SDL2 SDL2_mixer ]
++ stdenv.lib.optional (stdenv.system == "i686-linux") nasm;
nativeBuildInputs = [ pkgconfig ];
postPatch = ''
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 {
name = "eduke32";
exec = "eduke32-wrapper";
comment = "Duke Nukem 3D port";
desktopName = "Enhanced Duke Nukem 3D";
genericName = "Duke Nukem 3D port";
categories = "Application;Game;";
};
installPhase = ''
# Make wrapper script
cat > eduke32-wrapper <<EOF
#!/bin/sh
if [ "$EDUKE32_DATA_DIR" = "" ]; then
EDUKE32_DATA_DIR=/var/lib/games/eduke32
fi
if [ "$EDUKE32_GRP_FILE" = "" ]; then
EDUKE32_GRP_FILE=\$EDUKE32_DATA_DIR/DUKE3D.GRP
fi
cd \$EDUKE32_DATA_DIR
exec $out/bin/eduke32 -g \$EDUKE32_GRP_FILE
EOF
# Install binaries
mkdir -p $out/bin
install -Dm755 eduke32{,-wrapper} mapster32 $out/bin
# Install desktop item
cp -rv ${desktopItem}/share $out
'';
meta = with stdenv.lib; {
description = "Enhanched port of Duke Nukem 3D for various platforms";
license = licenses.gpl2Plus;
homepage = http://eduke32.com;
maintainers = with maintainers; [ nckx sander ];
platforms = with platforms; linux;
};
}
|