nixpkgs/pkgs/games/openra/default.nix

80 lines
2.6 KiB
Nix
Raw Normal View History

{ stdenv, fetchFromGitHub, mono, makeWrapper, lua
2016-04-11 02:46:40 +00:00
, SDL2, freetype, openal, systemd, pkgconfig,
dotnetPackages, gnome3, curl, unzip, which, python
}:
stdenv.mkDerivation rec {
2018-12-23 21:33:56 +00:00
pname = "openra";
version = "20181215";
meta = with stdenv.lib; {
description = "Real Time Strategy game engine recreating the C&C titles";
homepage = "http://www.openra.net/";
2016-05-01 01:35:39 +00:00
maintainers = [ maintainers.rardiol ];
license = licenses.gpl3;
platforms = platforms.linux;
};
src = fetchFromGitHub {
owner = "OpenRA";
repo = "OpenRA";
rev = "release-${version}";
2018-12-23 21:33:56 +00:00
sha256 = "0p0izykjnz7pz02g2khp7msqa00jhjsrzk9y0g29dirmdv75qa4r";
extraPostFetch = ''
sed -i 's,curl,curl --insecure,g' $out/thirdparty/{fetch-thirdparty-deps,noget}.sh
$out/thirdparty/fetch-thirdparty-deps.sh
'';
};
dontStrip = true;
buildInputs = (with dotnetPackages;
[ NUnit3 NewtonsoftJson MonoNat FuzzyLogicLibrary SmartIrc4net SharpZipLib MaxMindGeoIP2 MaxMindDb SharpFont StyleCopMSBuild StyleCopPlusMSBuild RestSharp NUnitConsole OpenNAT ])
2016-10-29 05:33:34 +00:00
++ [ curl unzip lua gnome3.zenity ];
nativeBuildInputs = [ curl unzip mono makeWrapper lua pkgconfig ];
postPatch = ''
2016-05-08 21:41:05 +00:00
mkdir Support
sed -i \
-e 's/^VERSION.*/VERSION = release-${version}/g' \
-e '/GeoLite2-Country.mmdb.gz/d' \
-e '/fetch-geoip-db.sh/d' \
Makefile
2016-04-11 02:46:40 +00:00
substituteInPlace thirdparty/configure-native-deps.sh --replace "locations=\"" "locations=\"${lua}/lib "
'';
preConfigure = ''
makeFlags="prefix=$out"
make version
'';
2016-05-08 21:41:05 +00:00
buildFlags = [ "DEBUG=false" "default" "man-page" ];
2016-04-11 02:46:40 +00:00
2016-05-08 21:41:16 +00:00
doCheck = true;
#TODO: check
checkTarget = "nunit test";
2016-05-08 21:41:05 +00:00
installTargets = [ "install" "install-linux-icons" "install-linux-desktop" "install-linux-appdata" "install-linux-mime" "install-man-page" ];
2016-04-11 02:46:40 +00:00
postInstall = with stdenv.lib; let
2014-07-24 13:53:34 +00:00
runtime = makeLibraryPath [ SDL2 freetype openal systemd lua ];
binaries= makeBinPath [ which mono gnome3.zenity python ];
in ''
2014-07-24 13:53:34 +00:00
wrapProgram $out/lib/openra/launch-game.sh \
--prefix PATH : "${binaries}" \
2018-10-10 17:01:29 +00:00
--prefix LD_LIBRARY_PATH : "${runtime}" \
--set TERM "xterm"
2016-04-11 02:46:40 +00:00
2014-07-24 13:53:34 +00:00
mkdir -p $out/bin
makeWrapper $out/lib/openra/launch-game.sh $out/bin/openra --run "cd $out/lib/openra"
printf "#!/bin/sh\nexec $out/bin/openra Game.Mod=ra" > $out/bin/openra-ra
chmod +x $out/bin/openra-ra
printf "#!/bin/sh\nexec $out/bin/openra Game.Mod=cnc" > $out/bin/openra-cnc
chmod +x $out/bin/openra-cnc
printf "#!/bin/sh\nexec $out/bin/openra Game.Mod=d2k" > $out/bin/openra-d2k
chmod +x $out/bin/openra-d2k
'';
}