2016-12-17 13:31:45 +01:00
|
|
|
{ stdenv, lib, fetchhg, cmake, pkgconfig, makeWrapper, callPackage
|
2018-03-05 15:32:10 +01:00
|
|
|
, soundfont-fluid, SDL, libGL, glew, bzip2, zlib, libjpeg, fluidsynth, openssl, gtk2, python3, libgme
|
2015-12-12 18:29:39 +01:00
|
|
|
, serverOnly ? false
|
|
|
|
}:
|
|
|
|
|
2016-12-17 13:31:45 +01:00
|
|
|
let
|
|
|
|
suffix = lib.optionalString serverOnly "-server";
|
|
|
|
fmod = callPackage ./fmod.nix { };
|
2017-09-15 20:23:26 +02:00
|
|
|
sqlite = callPackage ./sqlite.nix { };
|
2018-03-05 15:32:10 +01:00
|
|
|
clientLibPath = lib.makeLibraryPath [ fluidsynth ];
|
2015-12-12 18:29:39 +01:00
|
|
|
|
|
|
|
in stdenv.mkDerivation {
|
2017-09-15 20:23:26 +02:00
|
|
|
name = "zandronum${suffix}-3.0";
|
2015-06-12 13:29:47 +02:00
|
|
|
|
|
|
|
src = fetchhg {
|
2015-06-29 17:14:15 +02:00
|
|
|
url = "https://bitbucket.org/Torr_Samaho/zandronum-stable";
|
2017-09-15 20:23:26 +02:00
|
|
|
rev = "dd3c3b57023f";
|
|
|
|
sha256 = "1f8pd8d2zjwdp6v9anp9yrkdbfhd2mp7svmnna0jiqgxjw6wkyls";
|
2015-06-12 13:29:47 +02:00
|
|
|
};
|
|
|
|
|
2017-09-15 20:23:26 +02:00
|
|
|
# zandronum tries to download sqlite now when running cmake, don't let it
|
|
|
|
|
|
|
|
# it also needs the current mercurial revision info embedded in gitinfo.h
|
|
|
|
# otherwise, the client will fail to connect to servers because the
|
|
|
|
# protocol version doesn't match.
|
|
|
|
|
|
|
|
patches = [ ./zan_configure_impurity.patch ./add_gitinfo.patch ./dont_update_gitinfo.patch ];
|
|
|
|
|
2015-12-12 18:29:39 +01:00
|
|
|
# I have no idea why would SDL and libjpeg be needed for the server part!
|
|
|
|
# But they are.
|
2018-03-05 15:32:10 +01:00
|
|
|
buildInputs = [ openssl bzip2 zlib SDL libjpeg sqlite libgme ]
|
|
|
|
++ lib.optionals (!serverOnly) [ libGL glew fmod fluidsynth gtk2 ];
|
2015-06-12 13:29:47 +02:00
|
|
|
|
2017-09-15 20:23:26 +02:00
|
|
|
nativeBuildInputs = [ cmake pkgconfig makeWrapper python3 ];
|
2015-06-12 13:29:47 +02:00
|
|
|
|
|
|
|
preConfigure = ''
|
2017-09-15 20:23:26 +02:00
|
|
|
ln -s ${sqlite}/* sqlite/
|
2016-07-06 00:17:27 +02:00
|
|
|
sed -ie 's| restrict| _restrict|g' dumb/include/dumb.h \
|
|
|
|
dumb/src/it/*.c
|
2017-09-16 08:08:47 +02:00
|
|
|
'' + lib.optionalString (!serverOnly) ''
|
2016-12-17 13:31:45 +01:00
|
|
|
sed -i \
|
|
|
|
-e "s@/usr/share/sounds/sf2/@${soundfont-fluid}/share/soundfonts/@g" \
|
|
|
|
-e "s@FluidR3_GM.sf2@FluidR3_GM2-2.sf2@g" \
|
|
|
|
src/sound/music_fluidsynth_mididevice.cpp
|
2015-06-12 13:29:47 +02:00
|
|
|
'';
|
|
|
|
|
2015-12-12 18:29:39 +01:00
|
|
|
cmakeFlags =
|
2018-03-05 15:32:10 +01:00
|
|
|
[ "-DFORCE_INTERNAL_GME=OFF" ]
|
|
|
|
++ (if serverOnly
|
|
|
|
then [ "-DSERVERONLY=ON" ]
|
|
|
|
else [ "-DFMOD_LIBRARY=${fmod}/lib/libfmodex.so" ]);
|
2015-12-12 18:29:39 +01:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
2015-06-12 13:29:47 +02:00
|
|
|
|
2016-02-26 18:38:15 +01:00
|
|
|
hardeningDisable = [ "format" ];
|
2016-02-24 16:40:14 +01:00
|
|
|
|
2015-06-12 13:29:47 +02:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
2016-12-17 13:31:45 +01:00
|
|
|
mkdir -p $out/lib/zandronum
|
2015-12-12 18:29:39 +01:00
|
|
|
cp zandronum${suffix} \
|
2016-12-17 13:31:45 +01:00
|
|
|
*.pk3 \
|
2015-12-12 18:29:39 +01:00
|
|
|
${lib.optionalString (!serverOnly) "liboutput_sdl.so"} \
|
2016-12-17 13:31:45 +01:00
|
|
|
$out/lib/zandronum
|
2018-03-05 15:32:10 +01:00
|
|
|
makeWrapper $out/lib/zandronum/zandronum${suffix} $out/bin/zandronum${suffix}
|
|
|
|
'';
|
2015-06-12 13:29:47 +02:00
|
|
|
|
2015-12-12 18:29:39 +01:00
|
|
|
postFixup = lib.optionalString (!serverOnly) ''
|
2018-03-05 15:32:10 +01:00
|
|
|
patchelf --set-rpath $(patchelf --print-rpath $out/lib/zandronum/zandronum):$out/lib/zandronum:${clientLibPath} \
|
2016-12-17 13:31:45 +01:00
|
|
|
$out/lib/zandronum/zandronum
|
2015-06-12 13:29:47 +02:00
|
|
|
'';
|
|
|
|
|
2018-03-05 15:32:10 +01:00
|
|
|
passthru = {
|
|
|
|
inherit fmod sqlite;
|
|
|
|
};
|
|
|
|
|
2015-12-12 18:29:39 +01:00
|
|
|
meta = with stdenv.lib; {
|
2015-06-12 13:29:47 +02:00
|
|
|
homepage = http://zandronum.com/;
|
2016-02-27 18:24:00 +01:00
|
|
|
description = "Multiplayer oriented port, based off Skulltag, for Doom and Doom II by id Software";
|
2017-09-16 08:08:47 +02:00
|
|
|
maintainers = with maintainers; [ lassulus MP2E ];
|
2016-12-17 13:31:45 +01:00
|
|
|
license = licenses.unfreeRedistributable;
|
2015-12-12 18:29:39 +01:00
|
|
|
platforms = platforms.linux;
|
2015-06-12 13:29:47 +02:00
|
|
|
};
|
|
|
|
}
|