summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--lib/maintainers.nix1
-rw-r--r--pkgs/games/assaultcube/assaultcube-next.patch11
-rw-r--r--pkgs/games/assaultcube/default.nix82
-rw-r--r--pkgs/games/assaultcube/launcher.sh20
-rw-r--r--pkgs/top-level/all-packages.nix2
5 files changed, 116 insertions, 0 deletions
diff --git a/lib/maintainers.nix b/lib/maintainers.nix
index 9ff2d53b466..d2c62ef9bb8 100644
--- a/lib/maintainers.nix
+++ b/lib/maintainers.nix
@@ -258,6 +258,7 @@
   gavin = "Gavin Rogers <gavin@praxeology.co.uk>";
   gebner = "Gabriel Ebner <gebner@gebner.org>";
   geistesk = "Alvar Penning <post@0x21.biz>";
+  genesis = "Ronan Bignaux <ronan@aimao.org>";
   georgewhewell = "George Whewell <georgerw@gmail.com>";
   gilligan = "Tobias Pflug <tobias.pflug@gmail.com>";
   giogadi = "Luis G. Torres <lgtorres42@gmail.com>";
diff --git a/pkgs/games/assaultcube/assaultcube-next.patch b/pkgs/games/assaultcube/assaultcube-next.patch
new file mode 100644
index 00000000000..92fc7996670
--- /dev/null
+++ b/pkgs/games/assaultcube/assaultcube-next.patch
@@ -0,0 +1,11 @@
+--- 1.1.0.4/source/src/Makefile
++++ 1.1.0.4/source/src/Makefile
+@@ -6,7 +6,7 @@
+ # found to have been caused by the g++ compiler in the past. This seems to have
+ # been fixed now by relaxing the optimization that g++ does, so although we'll
+ # continue using clang++ (just in case), you can use g++ if you prefer.
+-CXX=clang++
++#CXX=clang++
+
+ # Changing this to ACDEBUG=yes will compile a debug version of AssaultCube.
+ ACDEBUG=no
diff --git a/pkgs/games/assaultcube/default.nix b/pkgs/games/assaultcube/default.nix
new file mode 100644
index 00000000000..cef48978b6d
--- /dev/null
+++ b/pkgs/games/assaultcube/default.nix
@@ -0,0 +1,82 @@
+{ fetchFromGitHub, stdenv, makeDesktopItem, openal, pkgconfig, libogg,
+  libvorbis, SDL, SDL_image, makeWrapper, zlib,
+  client ? true, server ? true }:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+
+  # master branch has legacy (1.2.0.2) protocol 1201 and gcc 6 fix.
+  pname = "assaultcube";
+  version = "01052017";
+  name = "${pname}-${version}";
+
+  meta = {
+    description = "Fast and fun first-person-shooter based on the Cube fps";
+    homepage = http://assault.cubers.net;
+    maintainers = [ maintainers.genesis ];
+    platforms = platforms.linux; # should work on darwin with a little effort.
+    license = stdenv.lib.licenses.zlib;
+  };
+
+  src = fetchFromGitHub {
+    owner = "assaultcube";
+    repo  = "AC";
+    rev = "9f537b0876a39d7686e773040469fbb1417de18b";
+    sha256 = "0nvckn67mmfaa7x3j41xyxjllxqzfx1dxg8pnqsaak3kkzds34pl";
+  };
+
+  # ${branch} not accepted as a value ?
+  # TODO: write a functional BUNDLED_ENET option and restore it in deps.
+  patches = [ ./assaultcube-next.patch ];
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  # add optional for server only ?
+  buildInputs = [ makeWrapper openal SDL SDL_image libogg libvorbis zlib ];
+
+  #makeFlags = [ "CXX=g++" ];
+
+  targets = (optionalString server "server") + (optionalString client " client");
+  buildPhase = ''
+    make -C source/src ${targets}
+  '';
+
+  desktop = makeDesktopItem {
+    name = "AssaultCube";
+    desktopName = "AssaultCube";
+    comment = "A multiplayer, first-person shooter game, based on the CUBE engine. Fast, arcade gameplay.";
+    genericName = "First-person shooter";
+    categories = "Application;Game;ActionGame;Shooter";
+    icon = "assaultcube.png";
+    exec = "${pname}";
+  };
+
+  gamedatadir = "/share/games/${pname}";
+
+  installPhase = ''
+
+    bindir=$out/bin
+
+    mkdir -p $bindir $out/$gamedatadir
+
+    cp -r config packages $out/$gamedatadir
+
+    # install custom script
+    substituteAll ${./launcher.sh} $bindir/assaultcube
+    chmod +x $bindir/assaultcube
+
+    if (test -e source/src/ac_client) then
+      cp source/src/ac_client $bindir
+      mkdir -p $out/share/applications
+      cp ${desktop}/share/applications/* $out/share/applications
+      install -Dpm644 packages/misc/icon.png $out/share/icons/assaultcube.png
+      install -Dpm644 packages/misc/icon.png $out/share/pixmaps/assaultcube.png
+    fi
+
+    if (test -e source/src/ac_server) then
+      cp source/src/ac_server $bindir
+      ln -s $bindir/${pname} $bindir/${pname}-server
+    fi
+    '';
+}
diff --git a/pkgs/games/assaultcube/launcher.sh b/pkgs/games/assaultcube/launcher.sh
new file mode 100644
index 00000000000..331cb861f66
--- /dev/null
+++ b/pkgs/games/assaultcube/launcher.sh
@@ -0,0 +1,20 @@
+#!@shell@
+# original scripts are very awful
+
+CUBE_DIR=@out@@gamedatadir@
+
+case $(basename "$0") in
+  assaultcube-server)
+    CUBE_OPTIONS="-Cconfig/servercmdline.txt"
+    BINARYPATH=@out@/bin/ac_server
+    ;;
+  assaultcube)
+    CUBE_OPTIONS="--home=${HOME}/.assaultcube/v1.2next --init"
+    BINARYPATH=@out@/bin/ac_client
+    ;;
+  *) echo "$0" is not supported.
+     exit 1
+esac
+
+cd $CUBE_DIR
+exec "${BINARYPATH}" ${CUBE_OPTIONS} "$@"
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 21e2b0e1768..73f47828055 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -18195,6 +18195,8 @@ with pkgs;
     physfs = physfs_2;
   };
 
+  assaultcube = callPackage ../games/assaultcube { };
+
   astromenace = callPackage ../games/astromenace { };
 
   atanks = callPackage ../games/atanks {};