summary refs log tree commit diff
path: root/pkgs/games/assaultcube
diff options
context:
space:
mode:
authorBignaux Ronan <ronan@aimao.org>2019-03-29 13:14:48 +0100
committerBignaux Ronan <ronan@aimao.org>2019-03-29 15:22:46 +0100
commit0a38c2794d5f6e3ae3c86c988de0c80e352bff16 (patch)
tree745f7d7db00dfabc584f04066dc2bf5fa999e322 /pkgs/games/assaultcube
parent5eb3edc8fb71267be2bbf64a951af3d93b8647e5 (diff)
downloadnixpkgs-0a38c2794d5f6e3ae3c86c988de0c80e352bff16.tar
nixpkgs-0a38c2794d5f6e3ae3c86c988de0c80e352bff16.tar.gz
nixpkgs-0a38c2794d5f6e3ae3c86c988de0c80e352bff16.tar.bz2
nixpkgs-0a38c2794d5f6e3ae3c86c988de0c80e352bff16.tar.lz
nixpkgs-0a38c2794d5f6e3ae3c86c988de0c80e352bff16.tar.xz
nixpkgs-0a38c2794d5f6e3ae3c86c988de0c80e352bff16.tar.zst
nixpkgs-0a38c2794d5f6e3ae3c86c988de0c80e352bff16.zip
assaultcube: unstable-2017-05-01 -> unstable-2018-05-20
Diffstat (limited to 'pkgs/games/assaultcube')
-rw-r--r--pkgs/games/assaultcube/assaultcube-next.patch11
-rw-r--r--pkgs/games/assaultcube/default.nix49
-rw-r--r--pkgs/games/assaultcube/launcher.sh20
3 files changed, 20 insertions, 60 deletions
diff --git a/pkgs/games/assaultcube/assaultcube-next.patch b/pkgs/games/assaultcube/assaultcube-next.patch
deleted file mode 100644
index 92fc7996670..00000000000
--- a/pkgs/games/assaultcube/assaultcube-next.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- 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
index 71e885a04d3..593622c3008 100644
--- a/pkgs/games/assaultcube/default.nix
+++ b/pkgs/games/assaultcube/default.nix
@@ -1,5 +1,5 @@
 { fetchFromGitHub, stdenv, makeDesktopItem, openal, pkgconfig, libogg,
-  libvorbis, SDL, SDL_image, makeWrapper, zlib,
+  libvorbis, SDL, SDL_image, makeWrapper, zlib, file,
   client ? true, server ? true }:
 
 with stdenv.lib;
@@ -8,38 +8,21 @@ stdenv.mkDerivation rec {
 
   # master branch has legacy (1.2.0.2) protocol 1201 and gcc 6 fix.
   pname = "assaultcube";
-  version = "unstable-2017-05-01";
-
-  meta = {
-    description = "Fast and fun first-person-shooter based on the Cube fps";
-    homepage = https://assault.cubers.net;
-    maintainers = [ maintainers.genesis ];
-    platforms = platforms.linux; # should work on darwin with a little effort.
-    license = stdenv.lib.licenses.zlib;
-  };
+  version = "unstable-2018-05-20";
 
   src = fetchFromGitHub {
     owner = "assaultcube";
     repo  = "AC";
-    rev = "9f537b0876a39d7686e773040469fbb1417de18b";
-    sha256 = "0nvckn67mmfaa7x3j41xyxjllxqzfx1dxg8pnqsaak3kkzds34pl";
+    rev = "f58ea22b46b5013a520520670434b3c235212371";
+    sha256 = "1vfn3d55vmmipdykrcfvgk6dddi9y95vlclsliirm7jdp20f15hd";
   };
 
-  # ${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 ];
+  nativeBuildInputs = [ makeWrapper pkgconfig ];
 
-  #makeFlags = [ "CXX=g++" ];
+  buildInputs = [ file zlib ] ++ optionals client [ openal SDL SDL_image libogg libvorbis ];
 
   targets = (optionalString server "server") + (optionalString client " client");
-  buildPhase = ''
-    make -C source/src ${targets}
-  '';
+  makeFlags = [ "-C source/src" "CXX=c++" "${targets}" ];
 
   desktop = makeDesktopItem {
     name = "AssaultCube";
@@ -61,21 +44,29 @@ stdenv.mkDerivation rec {
 
     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
+      
+      makeWrapper $out/bin/ac_client $out/bin/${pname} \
+        --run "cd $out/$gamedatadir" --add-flags "--home=\$HOME/.assaultcube/v1.2next --init"
     fi
 
     if (test -e source/src/ac_server) then
       cp source/src/ac_server $bindir
-      ln -s $bindir/${pname} $bindir/${pname}-server
+      makeWrapper $out/bin/ac_server $out/bin/${pname}-server \
+        --run "cd $out/$gamedatadir" --add-flags "-Cconfig/servercmdline.txt"
     fi
     '';
+
+  meta = {
+    description = "Fast and fun first-person-shooter based on the Cube fps";
+    homepage = https://assault.cubers.net;
+    maintainers = [ maintainers.genesis ];
+    platforms = platforms.linux; # should work on darwin with a little effort.
+    license = stdenv.lib.licenses.zlib;
+  };
 }
diff --git a/pkgs/games/assaultcube/launcher.sh b/pkgs/games/assaultcube/launcher.sh
deleted file mode 100644
index 331cb861f66..00000000000
--- a/pkgs/games/assaultcube/launcher.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!@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} "$@"