nixpkgs/pkgs/games/zandronum/default.nix

72 lines
2.3 KiB
Nix
Raw Normal View History

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