2015-12-12 20:29:39 +03:00
|
|
|
{ stdenv, lib, fetchhg, cmake, pkgconfig, makeWrapper
|
|
|
|
, SDL, mesa, bzip2, zlib, fmod, libjpeg, fluidsynth, openssl, sqlite-amalgamation
|
|
|
|
, serverOnly ? false
|
|
|
|
}:
|
|
|
|
|
|
|
|
let suffix = lib.optionalString serverOnly "-server";
|
|
|
|
|
|
|
|
# FIXME: drop binary package when upstream fixes their protocol versioning
|
|
|
|
in stdenv.mkDerivation {
|
|
|
|
name = "zandronum${suffix}-2.1.2";
|
2015-06-12 14:29:47 +03:00
|
|
|
|
|
|
|
src = fetchhg {
|
2015-06-29 18:14:15 +03:00
|
|
|
url = "https://bitbucket.org/Torr_Samaho/zandronum-stable";
|
2015-08-18 03:56:14 +03:00
|
|
|
rev = "a3663b0061d5";
|
|
|
|
sha256 = "0qwsnbwhcldwrirfk6hpiklmcj3a7dzh6pn36nizci6pcza07p56";
|
2015-06-12 14:29:47 +03:00
|
|
|
};
|
|
|
|
|
2015-12-12 20:29:39 +03:00
|
|
|
# I have no idea why would SDL and libjpeg be needed for the server part!
|
|
|
|
# But they are.
|
|
|
|
buildInputs = [ openssl bzip2 zlib SDL libjpeg ]
|
|
|
|
++ lib.optionals (!serverOnly) [ mesa fmod fluidsynth ];
|
2015-06-12 14:29:47 +03:00
|
|
|
|
2015-12-12 20:29:39 +03:00
|
|
|
nativeBuildInputs = [ cmake pkgconfig makeWrapper ];
|
2015-06-12 14:29:47 +03:00
|
|
|
|
|
|
|
preConfigure = ''
|
2015-12-12 20:29:39 +03:00
|
|
|
ln -s ${sqlite-amalgamation}/* sqlite/
|
2016-07-06 01:17:27 +03:00
|
|
|
sed -ie 's| restrict| _restrict|g' dumb/include/dumb.h \
|
|
|
|
dumb/src/it/*.c
|
2015-06-12 14:29:47 +03:00
|
|
|
'';
|
|
|
|
|
2015-12-12 20:29:39 +03:00
|
|
|
cmakeFlags =
|
|
|
|
lib.optional (!serverOnly) "-DFMOD_LIBRARY=${fmod}/lib/libfmodex.so"
|
|
|
|
++ lib.optional serverOnly "-DSERVERONLY=ON"
|
|
|
|
;
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
2015-06-12 14:29:47 +03:00
|
|
|
|
2016-02-26 20:38:15 +03:00
|
|
|
hardeningDisable = [ "format" ];
|
2016-02-24 18:40:14 +03:00
|
|
|
|
2015-06-12 14:29:47 +03:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
2015-12-12 20:29:39 +03:00
|
|
|
mkdir -p $out/share/zandronum
|
|
|
|
cp zandronum${suffix} \
|
|
|
|
zandronum.pk3 \
|
|
|
|
skulltag_actors.pk3 \
|
|
|
|
${lib.optionalString (!serverOnly) "liboutput_sdl.so"} \
|
|
|
|
$out/share/zandronum
|
|
|
|
|
|
|
|
# For some reason, while symlinks work for binary version, they don't for source one.
|
|
|
|
makeWrapper $out/share/zandronum/zandronum${suffix} $out/bin/zandronum${suffix}
|
|
|
|
'';
|
2015-06-12 14:29:47 +03:00
|
|
|
|
2015-12-12 20:29:39 +03:00
|
|
|
postFixup = lib.optionalString (!serverOnly) ''
|
|
|
|
patchelf --set-rpath $(patchelf --print-rpath $out/share/zandronum/zandronum):$out/share/zandronum \
|
|
|
|
$out/share/zandronum/zandronum
|
2015-06-12 14:29:47 +03:00
|
|
|
'';
|
|
|
|
|
2015-12-12 20:29:39 +03:00
|
|
|
meta = with stdenv.lib; {
|
2015-06-12 14:29:47 +03:00
|
|
|
homepage = http://zandronum.com/;
|
2016-02-27 20:24:00 +03:00
|
|
|
description = "Multiplayer oriented port, based off Skulltag, for Doom and Doom II by id Software";
|
2016-02-10 16:59:36 +03:00
|
|
|
maintainers = with maintainers; [ lassulus ];
|
2016-07-11 04:04:01 +03:00
|
|
|
license = stdenv.lib.licenses.unfree;
|
2015-12-12 20:29:39 +03:00
|
|
|
platforms = platforms.linux;
|
2015-06-12 14:29:47 +03:00
|
|
|
};
|
|
|
|
}
|