1{
2 stdenv,
3 lib,
4 replaceVars,
5 fetchurl,
6 cmake,
7 libogg,
8 libvorbis,
9 libtheora,
10 curl,
11 freetype,
12 libjpeg,
13 libpng,
14 SDL2,
15 libGL,
16 libX11,
17 openal,
18 zlib,
19}:
20
21stdenv.mkDerivation {
22 pname = "warsow-engine";
23 version = "2.1.0";
24
25 src = fetchurl {
26 url = "http://slice.sh/warsow/warsow_21_sdk.tar.gz";
27 sha256 = "0fj5k7qpf6far8i1xhqxlpfjch10zj26xpilhp95aq2yiz08pj4r";
28 };
29
30 patches = [
31 (replaceVars ./libpath.patch {
32 inherit
33 zlib
34 curl
35 libpng
36 libjpeg
37 libogg
38 libvorbis
39 libtheora
40 freetype
41 ;
42 })
43 ];
44
45 nativeBuildInputs = [ cmake ];
46
47 buildInputs = [
48 libogg
49 libvorbis
50 libtheora
51 curl
52 freetype
53 libjpeg
54 SDL2
55 libGL
56 libX11
57 openal
58 zlib
59 libpng
60 ];
61
62 # Workaround build failure on -fno-common toolchains:
63 # ld: CMakeFiles/wswtv_server.dir/__/unix/unix_time.c.o:(.bss+0x8): multiple definition of
64 # `c_pointcontents'; CMakeFiles/wswtv_server.dir/__/null/ascript_null.c.o:(.bss+0x8): first defined here
65 env.NIX_CFLAGS_COMPILE = "-fcommon";
66
67 cmakeFlags = [ "-DQFUSION_GAME=Warsow" ];
68
69 preConfigure = ''
70 cd source/source
71 '';
72
73 installPhase = ''
74 runHook preInstall
75
76 mkdir -p $out/lib
77 cp -r libs $out/lib/warsow
78 for i in warsow.* wsw_server.* wswtv_server.*; do
79 install -Dm755 "$i" "$out/bin/''${i%.*}"
80 done
81
82 runHook postInstall
83 '';
84
85 meta = with lib; {
86 description = "Multiplayer FPS game designed for competitive gaming (engine only)";
87 homepage = "http://www.warsow.net";
88 license = licenses.gpl2Plus;
89 maintainers = with maintainers; [
90 abbradar
91 ];
92 platforms = platforms.linux;
93 broken = stdenv.hostPlatform.isAarch64;
94 };
95}