lol
1{ stdenv, fetchurl
2, # required for both
3 unzip, libjpeg, zlib, libvorbis, curl
4, # glx
5 libX11, mesa, libXpm, libXext, libXxf86vm, alsaLib
6, # sdl
7 SDL
8}:
9
10stdenv.mkDerivation rec {
11 name = "xonotic-0.8.0";
12
13 src = fetchurl {
14 url = "http://dl.xonotic.org/${name}.zip";
15 sha256 = "0w336750sq8nwqljlcj3znk4iaj3nvn6id144d7j72vsh84ci1qa";
16 };
17
18 buildInputs = [
19 # required for both
20 unzip libjpeg
21 # glx
22 libX11 mesa libXpm libXext libXxf86vm alsaLib
23 # sdl
24 SDL
25 ];
26
27 sourceRoot = "Xonotic/source/darkplaces";
28
29 #patchPhase = ''
30 # substituteInPlace glquake.h \
31 # --replace 'typedef char GLchar;' '/*typedef char GLchar;*/'
32 #'';
33
34 NIX_LDFLAGS = ''
35 -rpath ${zlib}/lib
36 -rpath ${libvorbis}/lib
37 -rpath ${curl}/lib
38 '';
39
40 buildPhase = ''
41 DP_FS_BASEDIR="$out/share/xonotic"
42 make DP_FS_BASEDIR=$DP_FS_BASEDIR cl-release
43 make DP_FS_BASEDIR=$DP_FS_BASEDIR sdl-release
44 make DP_FS_BASEDIR=$DP_FS_BASEDIR sv-release
45 '';
46
47 installPhase = ''
48 mkdir -p "$out/bin"
49 cp darkplaces-dedicated "$out/bin/xonotic-dedicated"
50 cp darkplaces-sdl "$out/bin/xonotic-sdl"
51 cp darkplaces-glx "$out/bin/xonotic-glx"
52 cd ../..
53 mkdir -p "$out/share/xonotic"
54 mv data "$out/share/xonotic"
55
56 # default to sdl
57 ln -s "$out/bin/xonotic-sdl" "$out/bin/xonotic"
58 '';
59
60 dontPatchELF = true;
61
62 meta = {
63 description = "A free fast-paced first-person shooter";
64 longDescription = ''
65 Xonotic is a free, fast-paced first-person shooter that works on
66 Windows, OS X and Linux. The project is geared towards providing
67 addictive arena shooter gameplay which is all spawned and driven
68 by the community itself. Xonotic is a direct successor of the
69 Nexuiz project with years of development between them, and it
70 aims to become the best possible open-source FPS of its kind.
71 '';
72 homepage = http://www.xonotic.org;
73 license = stdenv.lib.licenses.gpl2Plus;
74 maintainers = with stdenv.lib.maintainers; [ astsmtl ];
75 platforms = stdenv.lib.platforms.linux;
76 hydraPlatforms = [];
77 };
78}