Skip to content

Instantly share code, notes, and snippets.

@fusion809
Created December 3, 2018 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fusion809/e7e91345c9eb2f101f281edcba08cf6c to your computer and use it in GitHub Desktop.
Save fusion809/e7e91345c9eb2f101f281edcba08cf6c to your computer and use it in GitHub Desktop.
{ stdenv, fetchFromGitHub, mono, makeWrapper, lua
, SDL2, freetype, openal, systemd, pkgconfig,
dotnetPackages, gnome3, curl, unzip, which, python
}:
let
engine = fetchFromGitHub {
owner = "RAunplugged";
repo = "uRA" ;
rev = "unplugged-cd82382";
sha256 = "1pgi3zaq9fwwdq6yh19bwxscslqgabjxkvl9bcn1a5agy49x2r59";
};
in
stdenv.mkDerivation rec {
name = "openra-ura-${version}";
version = "407";
commit = "2f7f784127dc7a94cd934089954193d126971d60";
meta = with stdenv.lib; {
description = "Re-imaginging of the original Command & Conquer Red Alert game";
homepage = "http://redalertunplugged.com/";
maintainers = [ maintainers.fusion809 ];
license = licenses.gpl3;
platforms = platforms.linux;
};
src = fetchFromGitHub {
owner = "RAunplugged";
repo = "uRA";
rev = "${commit}";
sha256 = "0hhwzc3fkh0kb9w6zzmq5sqzn5hhx8qxnz6464ds5djk5cglnphz";
extraPostFetch = ''
cp -a ${engine} engine
sed -i 's,curl,curl --insecure,g' $out/engine/thirdparty/{fetch-thirdparty-deps,noget}.sh
$out/engine/thirdparty/fetch-thirdparty-deps.sh
substituteInPlace engine/thirdparty/configure-native-deps.sh --replace "locations=\"" "locations=\"${lua}/lib "
'';
};
patches = [ ./Makefile.patch ];
dontStrip = true;
buildInputs = (with dotnetPackages;
[ NUnit3 NewtonsoftJson MonoNat FuzzyLogicLibrary SmartIrc4net SharpZipLib MaxMindGeoIP2 MaxMindDb SharpFont StyleCopMSBuild StyleCopPlusMSBuild RestSharp NUnitConsole OpenNAT ])
++ [ curl unzip lua gnome3.zenity ];
nativeBuildInputs = [ curl unzip mono makeWrapper lua pkgconfig ];
postPatch = ''
mkdir Support
sed -i \
-e 's/^VERSION.*/VERSION = ${version}/g' \
Makefile
'';
preConfigure = ''
makeFlags="prefix=$out"
make version
'';
buildFlags = [ "DEBUG=false" "build" ];
doCheck = true;
#TODO: check
checkTarget = "check";
installTargets = [ "install" "install-linux-icons" "install-linux-desktop" "install-linux-appdata" "install-linux-mime" "install-man-page" ];
postInstall = with stdenv.lib; let
runtime = makeLibraryPath [ SDL2 freetype openal systemd lua ];
binaries= makeBinPath [ which mono gnome3.zenity python ];
in ''
mkdir -p $out{lib/openra-ura/mods,bin,share/pixmaps,share/doc/packages/openra-ra,share/applications,share/appdata}
cp -r engine/{glsl,lua,AUTHORS,COPYING,Eluant.dll*,FuzzyLogicLibrary.dll,GeoLite2-Country.mmdb.gz,'global mix database.dat',ICSharpCode.SharpZipLib.dll,launch-dedicated.sh,launch-game.sh,MaxMind.Db.dll,OpenAL-CS.dll,OpenAL-CS.dll.config,Open.Nat.dll,OpenRA.Game.exe,OpenRA.Platforms.Default.dll,OpenRA.Server.exe,OpenRA.Utility.exe,rix0rrr.BeaconLib.dll,SDL2-CS.dll,SDL2-CS.dll.config,SharpFont.dll,SharpFont.dll.config,VERSION} $out/lib/openra-ura
cp -r mods/ura $out/lib/openra-ura/mods
cp -r engine/mods/{common,modcontent} $out/lib/openra-ura/mods
cp -r README.md $out/share/doc/packages/openra-ura/README.md
install -Dm644 ${./openra-ura.desktop} $out/share/applications/openra-ura.desktop
install -Dm755 ${./openra-ura} $out/bin/openra-ura
mkdir $out/share/icons/hicolor/{16x16,32x32,48x48,64x64,128x128,256x256}/apps -p
mv packaging/linux/mod_16x16.png "$out/share/icons/hicolor/16x16/apps/openra-ura.png"
mv packaging/linux/mod_32x32.png "$out/share/icons/hicolor/32x32/apps/openra-ura.png"
mv packaging/linux/mod_48x48.png "$out/share/icons/hicolor/48x48/apps/openra-ura.png"
mv packaging/linux/mod_64x64.png "$out/share/icons/hicolor/64x64/apps/openra-ura.png"
mv packaging/linux/mod_128x128.png "$out/share/icons/hicolor/128x128/apps/openra-ura.png"
mv packaging/linux/mod_256x256.png "$out/share/icons/hicolor/256x256/apps/openra-ura.png"
rm $out/lib/openra-ura/*.sh
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment