2022-04-27 09:35:20 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, buildEnv, makeWrapper
|
2020-06-02 18:00:15 +00:00
|
|
|
, SDL2, libGL, curl
|
2020-04-24 23:36:52 +00:00
|
|
|
, openalSupport ? true, openal
|
|
|
|
, Cocoa, OpenAL
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2022-04-27 09:35:20 +00:00
|
|
|
mkFlag = b: if b then "yes" else "no";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
games = import ./games.nix { inherit stdenv lib fetchFromGitHub; };
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
wrapper = import ./wrapper.nix { inherit stdenv lib buildEnv makeWrapper yquake2; };
|
|
|
|
|
|
|
|
yquake2 = stdenv.mkDerivation rec {
|
|
|
|
pname = "yquake2";
|
2022-04-27 09:35:20 +00:00
|
|
|
version = "8.01";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "yquake2";
|
|
|
|
repo = "yquake2";
|
|
|
|
rev = "QUAKE2_${builtins.replaceStrings ["."] ["_"] version}";
|
2022-04-27 09:35:20 +00:00
|
|
|
sha256 = "1dll5lx4bnls5w5f2zwjhwpcpxa97rjn6ymb2v3vrjm19jbd16yd";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
postPatch = ''
|
2022-04-27 09:35:20 +00:00
|
|
|
substituteInPlace src/client/curl/qcurl.c \
|
|
|
|
--replace "\"libcurl.so.3\", \"libcurl.so.4\"" "\"${curl.out}/lib/libcurl.so\", \"libcurl.so.3\", \"libcurl.so.4\""
|
|
|
|
'' + lib.optionalString (openalSupport && !stdenv.isDarwin) ''
|
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace "\"libopenal.so.1\"" "\"${openal}/lib/libopenal.so.1\""
|
2021-12-06 16:07:01 +00:00
|
|
|
'';
|
|
|
|
|
2020-06-02 18:00:15 +00:00
|
|
|
buildInputs = [ SDL2 libGL curl ]
|
2020-04-24 23:36:52 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [ Cocoa OpenAL ]
|
2022-04-27 09:35:20 +00:00
|
|
|
++ lib.optional openalSupport openal;
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"WITH_OPENAL=${mkFlag openalSupport}"
|
|
|
|
"WITH_SYSTEMWIDE=yes"
|
|
|
|
"WITH_SYSTEMDIR=$\{out}/share/games/quake2"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
enableParallelBuilding = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
# Yamagi Quake II expects all binaries (executables and libs) to be in the
|
|
|
|
# same directory.
|
2022-04-27 09:35:20 +00:00
|
|
|
mkdir -p $out/bin $out/lib/yquake2 $out/share/games/quake2/baseq2
|
2020-04-24 23:36:52 +00:00
|
|
|
cp -r release/* $out/lib/yquake2
|
|
|
|
ln -s $out/lib/yquake2/quake2 $out/bin/yquake2
|
|
|
|
ln -s $out/lib/yquake2/q2ded $out/bin/yq2ded
|
2022-04-27 09:35:20 +00:00
|
|
|
cp $src/stuff/yq2.cfg $out/share/games/quake2/baseq2
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Yamagi Quake II client";
|
|
|
|
homepage = "https://www.yamagi.org/quake2/";
|
|
|
|
license = licenses.gpl2;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ tadfisher ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
in {
|
|
|
|
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";
|
|
|
|
};
|
|
|
|
}
|