warsow: 1.03 -> 2.1.2

Fix build, split into engine and game to build engine on Hydra.
This commit is contained in:
Nikolay Amiantov 2018-03-13 01:00:49 +03:00
parent 2dfbef2764
commit 5ed883a40b
3 changed files with 74 additions and 47 deletions

View File

@ -1,52 +1,27 @@
{ stdenv, fetchurl, unzip, pkgconfig, zlib, curl, libjpeg, libpng, libvorbis
, libtheora, libXxf86dga, libXxf86vm, libXinerama, SDL, libGLU_combined, openal, freetype
, makeWrapper
}:
{ stdenv, fetchurl, warsow-engine, makeWrapper }:
stdenv.mkDerivation rec {
name = "warsow-${version}";
version = "1.03";
mversion = "1.02"; # sometimes only engine is updated
src1 = fetchurl {
url = "http://www.warsow.net:1337/~warsow/${version}/warsow_${version}_sdk.tar.gz";
sha256 = "0z6r5v30p8fxbszmkxssv5fnnjw7w5wfn7wfgbwvmy87ayi7mkcq";
version = "2.1.2";
src = fetchurl {
url = "http://sebastian.network/warsow/${name}.tar.gz";
sha256 = "07y2airw5qg3s1bf1c63a6snjj22riz0mqhk62jmfm9nrarhavrc";
};
src2 = fetchurl {
url = "http://www.warsow.net:1337/~warsow/${mversion}/warsow_${mversion}.tar.gz";
sha256 = "0ai5v1h5g9nq21ixz23v0qsj9dr7dbiz7l8r34mq4c3z6ili8zpy";
};
unpackPhase = ''
tar xf "$src1"
cd warsow_${version}_sdk
tar xf "$src2"
mkdir -p source/release/
mv warsow_${mversion}/basewsw source/release/
cd source
'';
patchPhase = ''
substituteInPlace snd_openal/snd_main.c --replace libopenal.so.1 ${openal}/lib/libopenal.so.1
'';
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ unzip zlib curl libjpeg libpng libvorbis libtheora
libXxf86dga libXxf86vm libXinerama SDL libGLU_combined openal makeWrapper
];
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
dest=$out/opt/warsow
cd release
mkdir -p $dest
mkdir -p $out/share/warsow
cp -r basewsw $out/share/warsow
ln -s ${warsow-engine}/lib/warsow $out/share/warsow/libs
mkdir -p $out/bin
cp -v {warsow,wsw_server,wswtv_server}* $dest
cp -rv basewsw libs $dest
# Since 1.03 some modules are _always_ downloaded from server, thus
makeWrapper $dest/warsow $out/bin/warsow \
--suffix-each LD_LIBRARY_PATH ':' "${freetype.out}/lib"
makeWrapper $dest/wsw_server $out/bin/wsw_server
makeWrapper $dest/wswtv_server $out/bin/wswtv_server
'';
postFixup = ''
p=$out/opt/warsow/warsow.*
cur_rpath=$(patchelf --print-rpath $p)
patchelf --set-rpath $cur_rpath:${libGLU_combined}/lib $p
for i in ${warsow-engine}/bin/*; do
makeWrapper "$i" "$out/bin/$(basename "$i")" --run "cd $out/share/warsow"
done
'';
meta = with stdenv.lib; {
description = "Multiplayer FPS game designed for competitive gaming";
longDescription = ''
@ -56,10 +31,8 @@ stdenv.mkDerivation rec {
and macOS.
'';
homepage = http://www.warsow.net;
# Engine is under GPLv2, everything else is under
license = licenses.unfreeRedistributable;
maintainers = with maintainers; [ astsmtl ];
platforms = platforms.linux;
broken = true; # Depends on a specific old libjpeg version
maintainers = with maintainers; [ astsmtl abbradar ];
platforms = warsow-engine.meta.platforms;
};
}

View File

@ -0,0 +1,52 @@
{ stdenv, lib, fetchurl, cmake, libogg, libvorbis, libtheora, curl, freetype
, libjpeg, libpng, SDL2, libGL, openal, zlib
}:
let
# The game loads all those via dlopen().
libs = lib.mapAttrs (name: x: lib.getLib x) {
inherit zlib curl libpng libjpeg libogg libvorbis libtheora freetype;
};
in stdenv.mkDerivation (libs // rec {
name = "warsow-engine-${version}";
version = "2.1.0";
src = fetchurl {
url = "http://sebastian.network/warsow/warsow_21_sdk.tar.gz";
sha256 = "0fj5k7qpf6far8i1xhqxlpfjch10zj26xpilhp95aq2yiz08pj4r";
};
nativeBuildInputs = [ cmake ];
buildInputs = [
libogg libvorbis libtheora curl freetype libjpeg SDL2 libGL openal zlib
libpng
];
patches = [ ./libpath.patch ];
postPatch = ''
cd source/source
substituteAllInPlace gameshared/q_arch.h
'';
cmakeFlags = [ "-DQFUSION_GAME=Warsow" ];
enableParallelBuilding = true;
installPhase = ''
mkdir -p $out/lib
cp -r libs $out/lib/warsow
for i in warsow.* wsw_server.* wswtv_server.*; do
install -Dm755 "$i" "$out/bin/''${i%.*}"
done
'';
meta = with stdenv.lib; {
description = "Multiplayer FPS game designed for competitive gaming (engine only)";
homepage = http://www.warsow.net;
license = licenses.gpl2;
maintainers = with maintainers; [ astsmtl abbradar ];
platforms = platforms.linux;
};
})

View File

@ -19259,6 +19259,8 @@ with pkgs;
warmux = callPackage ../games/warmux { };
warsow-engine = callPackage ../games/warsow/engine.nix { };
warsow = callPackage ../games/warsow { };
warzone2100 = libsForQt5.callPackage ../games/warzone2100 { };