2018-02-05 16:06:49 +01:00
|
|
|
{ fetchFromGitHub, stdenv, makeDesktopItem, openal, pkgconfig, libogg,
|
2019-03-29 13:14:48 +01:00
|
|
|
libvorbis, SDL, SDL_image, makeWrapper, zlib, file,
|
2018-02-05 16:06:49 +01:00
|
|
|
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";
|
2019-03-29 13:14:48 +01:00
|
|
|
version = "unstable-2018-05-20";
|
2018-02-05 16:06:49 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "assaultcube";
|
|
|
|
repo = "AC";
|
2019-03-29 13:14:48 +01:00
|
|
|
rev = "f58ea22b46b5013a520520670434b3c235212371";
|
|
|
|
sha256 = "1vfn3d55vmmipdykrcfvgk6dddi9y95vlclsliirm7jdp20f15hd";
|
2018-02-05 16:06:49 +01:00
|
|
|
};
|
|
|
|
|
2019-03-29 13:14:48 +01:00
|
|
|
nativeBuildInputs = [ makeWrapper pkgconfig ];
|
2018-02-05 16:06:49 +01:00
|
|
|
|
2019-03-29 13:14:48 +01:00
|
|
|
buildInputs = [ file zlib ] ++ optionals client [ openal SDL SDL_image libogg libvorbis ];
|
2018-02-05 16:06:49 +01:00
|
|
|
|
|
|
|
targets = (optionalString server "server") + (optionalString client " client");
|
2019-09-09 01:38:31 +02:00
|
|
|
makeFlags = [ "-C source/src" "CXX=c++" targets ];
|
2018-02-05 16:06:49 +01:00
|
|
|
|
|
|
|
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";
|
2019-09-09 01:38:31 +02:00
|
|
|
exec = pname;
|
2018-02-05 16:06:49 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
gamedatadir = "/share/games/${pname}";
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
|
|
|
|
bindir=$out/bin
|
|
|
|
|
|
|
|
mkdir -p $bindir $out/$gamedatadir
|
|
|
|
|
|
|
|
cp -r config packages $out/$gamedatadir
|
|
|
|
|
|
|
|
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
|
2019-03-29 13:14:48 +01:00
|
|
|
|
|
|
|
makeWrapper $out/bin/ac_client $out/bin/${pname} \
|
|
|
|
--run "cd $out/$gamedatadir" --add-flags "--home=\$HOME/.assaultcube/v1.2next --init"
|
2018-02-05 16:06:49 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if (test -e source/src/ac_server) then
|
|
|
|
cp source/src/ac_server $bindir
|
2019-03-29 13:14:48 +01:00
|
|
|
makeWrapper $out/bin/ac_server $out/bin/${pname}-server \
|
|
|
|
--run "cd $out/$gamedatadir" --add-flags "-Cconfig/servercmdline.txt"
|
2018-02-05 16:06:49 +01:00
|
|
|
fi
|
|
|
|
'';
|
2019-03-29 13:14:48 +01:00
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
2018-02-05 16:06:49 +01:00
|
|
|
}
|