2018-04-11 18:37:40 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, buildEnv, cmake, makeWrapper
|
|
|
|
, SDL2, libGL
|
|
|
|
, oggSupport ? true, libogg, libvorbis
|
|
|
|
, openalSupport ? true, openal
|
|
|
|
, zipSupport ? true, zlib
|
2019-04-23 02:53:17 +00:00
|
|
|
, Cocoa, OpenAL
|
2018-04-11 18:37:40 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
mkFlag = b: if b then "ON" else "OFF";
|
|
|
|
|
|
|
|
games = import ./games.nix { inherit stdenv lib fetchFromGitHub cmake; };
|
|
|
|
|
|
|
|
wrapper = import ./wrapper.nix { inherit stdenv lib buildEnv makeWrapper yquake2; };
|
|
|
|
|
|
|
|
yquake2 = stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "yquake2";
|
2018-12-08 23:12:59 +00:00
|
|
|
version = "7.30";
|
2018-04-11 18:37:40 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "yquake2";
|
|
|
|
repo = "yquake2";
|
|
|
|
rev = "QUAKE2_${builtins.replaceStrings ["."] ["_"] version}";
|
2018-12-08 23:12:59 +00:00
|
|
|
sha256 = "0xfr620k1hns70dckv6k0kc72jbiwyghcys904jpriv5x94lnrlc";
|
2018-04-11 18:37:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
|
|
|
|
buildInputs = [ SDL2 libGL ]
|
2019-04-23 02:53:17 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [ Cocoa OpenAL ]
|
2018-04-11 18:37:40 +00:00
|
|
|
++ lib.optionals oggSupport [ libogg libvorbis ]
|
|
|
|
++ lib.optional openalSupport openal
|
|
|
|
++ lib.optional zipSupport zlib;
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DCMAKE_BUILD_TYPE=Release"
|
|
|
|
"-DOGG_SUPPORT=${mkFlag oggSupport}"
|
|
|
|
"-DOPENAL_SUPPORT=${mkFlag openalSupport}"
|
|
|
|
"-DZIP_SUPPORT=${mkFlag zipSupport}"
|
|
|
|
"-DSYSTEMWIDE_SUPPORT=ON"
|
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
# Since we can't expand $out in `cmakeFlags`
|
|
|
|
cmakeFlags="$cmakeFlags -DSYSTEMDIR=$out/share/games/quake2"
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
# Yamagi Quake II expects all binaries (executables and libs) to be in the
|
|
|
|
# same directory.
|
|
|
|
mkdir -p $out/bin $out/lib/yquake2 $out/share/games/quake2
|
|
|
|
cp -r release/* $out/lib/yquake2
|
|
|
|
ln -s $out/lib/yquake2/quake2 $out/bin/yquake2
|
|
|
|
ln -s $out/lib/yquake2/q2ded $out/bin/yq2ded
|
|
|
|
cp $src/stuff/yq2.cfg $out/share/games/quake2
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Yamagi Quake II client";
|
|
|
|
homepage = "https://www.yamagi.org/quake2/";
|
|
|
|
license = licenses.gpl2;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ tadfisher ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2019-08-13 21:52:01 +00:00
|
|
|
in {
|
2018-04-11 18:37:40 +00:00
|
|
|
inherit yquake2;
|
|
|
|
|
|
|
|
yquake2-ctf = wrapper {
|
|
|
|
games = [ games.ctf ];
|
|
|
|
name = "yquake2-ctf";
|
|
|
|
inherit (games.ctf) description;
|
|
|
|
};
|
|
|
|
|
|
|
|
yquake2-ground-zero = wrapper {
|
|
|
|
games = [ games.ground-zero ];
|
|
|
|
name = "yquake2-ground-zero";
|
|
|
|
inherit (games.ground-zero) description;
|
|
|
|
};
|
|
|
|
|
|
|
|
yquake2-the-reckoning = wrapper {
|
|
|
|
games = [ games.the-reckoning ];
|
|
|
|
name = "yquake2-the-reckoning";
|
|
|
|
inherit (games.the-reckoning) description;
|
|
|
|
};
|
|
|
|
|
|
|
|
yquake2-all-games = wrapper {
|
|
|
|
games = lib.attrValues games;
|
|
|
|
name = "yquake2-all-games";
|
|
|
|
description = "Yamagi Quake II with all add-on games";
|
|
|
|
};
|
|
|
|
}
|