summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2018-04-15 20:20:52 +0100
committerGitHub <noreply@github.com>2018-04-15 20:20:52 +0100
commit59cf37fd6f697d0126e4a4b78979008d8d864bf4 (patch)
treeabc4b9b25ff49940387a57b237a977c935ae4af0 /pkgs
parent00e2a4bde9797c97d9e878f97324dce6845d742a (diff)
parent29b1894598e0f39875ce441c54ac1d6bf3d4adbb (diff)
downloadnixpkgs-59cf37fd6f697d0126e4a4b78979008d8d864bf4.tar
nixpkgs-59cf37fd6f697d0126e4a4b78979008d8d864bf4.tar.gz
nixpkgs-59cf37fd6f697d0126e4a4b78979008d8d864bf4.tar.bz2
nixpkgs-59cf37fd6f697d0126e4a4b78979008d8d864bf4.tar.lz
nixpkgs-59cf37fd6f697d0126e4a4b78979008d8d864bf4.tar.xz
nixpkgs-59cf37fd6f697d0126e4a4b78979008d8d864bf4.tar.zst
nixpkgs-59cf37fd6f697d0126e4a4b78979008d8d864bf4.zip
Merge pull request #38864 from tadfisher/yquake2
yquake2: init at 7.20
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/games/quake2/yquake2/default.nix93
-rw-r--r--pkgs/games/quake2/yquake2/games.nix59
-rw-r--r--pkgs/games/quake2/yquake2/wrapper.nix31
-rw-r--r--pkgs/top-level/all-packages.nix7
4 files changed, 190 insertions, 0 deletions
diff --git a/pkgs/games/quake2/yquake2/default.nix b/pkgs/games/quake2/yquake2/default.nix
new file mode 100644
index 00000000000..bee7d7703ab
--- /dev/null
+++ b/pkgs/games/quake2/yquake2/default.nix
@@ -0,0 +1,93 @@
+{ stdenv, lib, fetchFromGitHub, buildEnv, cmake, makeWrapper
+, SDL2, libGL
+, oggSupport ? true, libogg, libvorbis
+, openalSupport ? true, openal
+, zipSupport ? true, zlib
+}:
+
+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 {
+    name = "yquake2-${version}";
+    version = "7.20";
+
+    src = fetchFromGitHub {
+      owner = "yquake2";
+      repo = "yquake2";
+      rev = "QUAKE2_${builtins.replaceStrings ["."] ["_"] version}";
+      sha256 = "1yrmn8vajab3zd0fni029s6wrvv2ljn1kyhaiw02wm1dc5yyzb2g";
+    };
+
+    enableParallelBuilding = true;
+
+    nativeBuildInputs = [ cmake ];
+
+    buildInputs = [ SDL2 libGL ]
+      ++ 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 ];
+    };
+  };
+
+in rec {
+  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";
+  };
+}
diff --git a/pkgs/games/quake2/yquake2/games.nix b/pkgs/games/quake2/yquake2/games.nix
new file mode 100644
index 00000000000..059fb26eb9b
--- /dev/null
+++ b/pkgs/games/quake2/yquake2/games.nix
@@ -0,0 +1,59 @@
+{ stdenv, lib, fetchFromGitHub, cmake }:
+
+let
+  games = {
+    ctf = {
+      id = "ctf";
+      version = "1.05";
+      description = "'Capture The Flag' for Yamagi Quake II";
+      sha256 = "15ihspyshls645ig0gq6bwdzvghyyysqk60g6ad3n4idb2ms52md";
+    };
+
+    ground-zero = {
+      id = "rogue";
+      version = "2.04";
+      description = "'Ground Zero' for Yamagi Quake II";
+      sha256 = "0x1maaycrxv7d3xvvk1ih2zymhvcd3jnab7g3by8qh6g5y33is5l";
+    };
+
+    the-reckoning = {
+      id = "xatrix";
+      version = "2.05";
+      description = "'The Reckoning' for Yamagi Quake II";
+      sha256 = "0gf2ryhgz8nw1mb1arlbriihjsx09fa0wmkgcayc8ijignfi1qkh";
+    };
+  };
+
+  toDrv = title: data: stdenv.mkDerivation rec {
+    inherit (data) id version description sha256;
+    inherit title;
+
+    name = "yquake2-${title}-${version}";
+
+    src = fetchFromGitHub {
+      inherit sha256;
+      owner = "yquake2";
+      repo = data.id;
+      rev = "${lib.toUpper id}_${builtins.replaceStrings ["."] ["_"] version}";
+    };
+
+    enableParallelBuilding = true;
+
+    nativeBuildInputs = [ cmake ];
+
+    installPhase = ''
+      mkdir -p $out/lib/yquake2/${id}
+      cp Release/* $out/lib/yquake2/${id}
+    '';
+
+    meta = with stdenv.lib; {
+      inherit (data) description;
+      homepage = "https://www.yamagi.org/quake2/";
+      license = licenses.unfree;
+      platforms = platforms.unix;
+      maintainers = with maintainers; [ tadfisher ];
+    };
+  };
+
+in
+  lib.mapAttrs toDrv games
diff --git a/pkgs/games/quake2/yquake2/wrapper.nix b/pkgs/games/quake2/yquake2/wrapper.nix
new file mode 100644
index 00000000000..8cd1044456a
--- /dev/null
+++ b/pkgs/games/quake2/yquake2/wrapper.nix
@@ -0,0 +1,31 @@
+{ stdenv, lib, buildEnv, makeWrapper, yquake2 }:
+
+{ games
+, name
+, description
+}:
+
+let
+  env = buildEnv {
+    name = "${name}-env";
+    paths = [ yquake2 ] ++ games;
+  };
+
+in stdenv.mkDerivation {
+  inherit name;
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  buildCommand = ''
+    mkdir -p $out/bin
+  '' + lib.concatMapStringsSep "\n" (game: ''
+    makeWrapper ${env}/bin/yquake2 $out/bin/yquake2-${game.title} \
+      --add-flags "+set game ${game.id}"
+    makeWrapper ${env}/bin/yq2ded $out/bin/yq2ded-${game.title} \
+      --add-flags "+set game ${game.id}"
+  '') games;
+
+  meta = {
+    inherit description;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index b8015166929..a4853ff5692 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -19507,6 +19507,13 @@ with pkgs;
 
   xsokoban = callPackage ../games/xsokoban { };
 
+  inherit (callPackage ../games/quake2/yquake2 { })
+    yquake2
+    yquake2-ctf
+    yquake2-ground-zero
+    yquake2-the-reckoning
+    yquake2-all-games;
+
   zandronum = callPackage ../games/zandronum { };
 
   zandronum-server = zandronum.override {