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