1 { stdenv, lib, fetchhg, cmake, pkg-config, makeWrapper, callPackage
2 , soundfont-fluid, SDL, libGL, glew, bzip2, zlib, libjpeg, fluidsynth, openssl, gtk2, python3, game-music-emu
7 suffix = lib.optionalString serverOnly "-server";
8 fmod = callPackage ./fmod.nix { };
9 sqlite = callPackage ./sqlite.nix { };
10 clientLibPath = lib.makeLibraryPath [ fluidsynth ];
12 in stdenv.mkDerivation rec {
13 pname = "zandronum${suffix}";
17 url = "https://hg.osdn.net/view/zandronum/zandronum-stable";
18 rev = "ZA_${version}";
19 sha256 = "16v5b6wfrmabs3ky6isbfhlrqdjrr1pvfxlxwk0im02kcpxxw9qw";
22 # zandronum tries to download sqlite now when running cmake, don't let it
24 # it also needs the current mercurial revision info embedded in gitinfo.h
25 # otherwise, the client will fail to connect to servers because the
26 # protocol version doesn't match.
28 patches = [ ./zan_configure_impurity.patch ./add_gitinfo.patch ./dont_update_gitinfo.patch ];
30 # I have no idea why would SDL and libjpeg be needed for the server part!
32 buildInputs = [ openssl bzip2 zlib SDL libjpeg sqlite game-music-emu ]
33 ++ lib.optionals (!serverOnly) [ libGL glew fmod fluidsynth gtk2 ];
35 nativeBuildInputs = [ cmake pkg-config makeWrapper python3 ];
38 ln -s ${sqlite}/* sqlite/
39 sed -ie 's| restrict| _restrict|g' dumb/include/dumb.h \
41 '' + lib.optionalString (!serverOnly) ''
43 -e "s@/usr/share/sounds/sf2/@${soundfont-fluid}/share/soundfonts/@g" \
44 -e "s@FluidR3_GM.sf2@FluidR3_GM2-2.sf2@g" \
45 src/sound/music_fluidsynth_mididevice.cpp
49 [ "-DFORCE_INTERNAL_GME=OFF" ]
51 then [ "-DSERVERONLY=ON" ]
52 else [ "-DFMOD_LIBRARY=${fmod}/lib/libfmodex.so" ]);
54 hardeningDisable = [ "format" ];
58 mkdir -p $out/lib/zandronum
59 cp zandronum${suffix} \
61 ${lib.optionalString (!serverOnly) "liboutput_sdl.so"} \
63 makeWrapper $out/lib/zandronum/zandronum${suffix} $out/bin/zandronum${suffix}
66 postFixup = lib.optionalString (!serverOnly) ''
67 patchelf --set-rpath $(patchelf --print-rpath $out/lib/zandronum/zandronum):$out/lib/zandronum:${clientLibPath} \
68 $out/lib/zandronum/zandronum
76 homepage = "https://zandronum.com/";
77 description = "Multiplayer oriented port, based off Skulltag, for Doom and Doom II by id Software";
78 maintainers = with maintainers; [ lassulus MP2E ];
79 license = licenses.unfreeRedistributable;
80 platforms = platforms.linux;