nixpkgs/pkgs/games/quake2/yquake2/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

105 lines
3 KiB
Nix
Raw Normal View History

2024-02-03 18:13:52 +01:00
{ stdenv, lib, fetchFromGitHub, buildEnv, makeWrapper, copyDesktopItems, makeDesktopItem
2020-05-31 09:54:45 +02:00
, SDL2, libGL, curl
2018-04-11 20:37:40 +02:00
, openalSupport ? true, openal
2019-04-23 04:53:17 +02:00
, Cocoa, OpenAL
2018-04-11 20:37:40 +02:00
}:
let
mkFlag = b: if b then "yes" else "no";
2018-04-11 20:37:40 +02:00
games = import ./games.nix { inherit stdenv lib fetchFromGitHub; };
2018-04-11 20:37:40 +02:00
2024-02-03 18:13:52 +01:00
wrapper = import ./wrapper.nix { inherit stdenv lib buildEnv makeWrapper yquake2 copyDesktopItems makeDesktopItem; };
2018-04-11 20:37:40 +02:00
yquake2 = stdenv.mkDerivation rec {
pname = "yquake2";
2024-07-27 14:20:54 +02:00
version = "8.40";
2018-04-11 20:37:40 +02:00
src = fetchFromGitHub {
owner = "yquake2";
repo = "yquake2";
rev = "QUAKE2_${builtins.replaceStrings ["."] ["_"] version}";
2024-07-27 14:20:54 +02:00
sha256 = "sha256-licz659DFS56/5P/hmPSE0YuVPTp1r4yrzS7FIg4Okc=";
2018-04-11 20:37:40 +02:00
};
2021-10-20 00:31:13 +02:00
postPatch = ''
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-10-20 00:31:13 +02:00
'';
2020-05-31 09:54:45 +02:00
buildInputs = [ SDL2 libGL curl ]
2019-04-23 04:53:17 +02:00
++ lib.optionals stdenv.isDarwin [ Cocoa OpenAL ]
++ lib.optional openalSupport openal;
makeFlags = [
"WITH_OPENAL=${mkFlag openalSupport}"
"WITH_SYSTEMWIDE=yes"
"WITH_SYSTEMDIR=$\{out}/share/games/quake2"
2018-04-11 20:37:40 +02:00
];
2024-02-03 18:13:52 +01:00
nativeBuildInputs = [ copyDesktopItems ];
enableParallelBuilding = true;
2018-04-11 20:37:40 +02:00
installPhase = ''
2024-02-03 18:13:52 +01:00
runHook preInstall
2018-04-11 20:37:40 +02:00
# 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/baseq2
2018-04-11 20:37:40 +02: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
cp $src/stuff/yq2.cfg $out/share/games/quake2/baseq2
2024-02-03 18:13:52 +01:00
install -Dm644 stuff/icon/Quake2.png $out/share/pixmaps/yamagi-quake2.png;
runHook postInstall
2018-04-11 20:37:40 +02:00
'';
2024-02-03 18:13:52 +01:00
desktopItems = [ (makeDesktopItem {
name = "yquake2";
exec = "yquake2";
icon = "yamagi-quake2";
desktopName = "yquake2";
comment = "Yamagi Quake II client";
categories = [ "Game" "Shooter" ];
})];
meta = with lib; {
2018-04-11 20:37:40 +02:00
description = "Yamagi Quake II client";
homepage = "https://www.yamagi.org/quake2/";
2024-07-03 11:37:36 +02:00
license = licenses.gpl2Plus;
2018-04-11 20:37:40 +02:00
platforms = platforms.unix;
maintainers = with maintainers; [ tadfisher ];
};
};
2019-08-13 23:52:01 +02:00
in {
2018-04-11 20:37:40 +02: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";
};
}