lol
1/* The reusable code, and package attributes, between OpenRA engine packages (engine.nix)
2 and out-of-tree mod packages (mod.nix).
3*/
4{ lib, makeSetupHook, curl, unzip, dos2unix, pkg-config, makeWrapper
5, lua, mono, dotnetPackages, python
6, libGL, freetype, openal, SDL2
7, zenity
8}:
9
10with lib;
11
12let
13 path = makeBinPath ([ mono python ] ++ optional (zenity != null) zenity);
14 rpath = makeLibraryPath [ lua freetype openal SDL2 ];
15 mkdirp = makeSetupHook { } ./mkdirp.sh;
16
17in {
18 patchEngine = dir: version: ''
19 sed -i \
20 -e 's/^VERSION.*/VERSION = ${version}/g' \
21 -e '/fetch-geoip-db/d' \
22 -e '/GeoLite2-Country.mmdb.gz/d' \
23 ${dir}/Makefile
24
25 sed -i 's|locations=.*|locations=${lua}/lib|' ${dir}/thirdparty/configure-native-deps.sh
26 '';
27
28 wrapLaunchGame = openraSuffix: ''
29 # Setting TERM=xterm fixes an issue with terminfo in mono: System.Exception: Magic number is wrong: 542
30 # https://github.com/mono/mono/issues/6752#issuecomment-365212655
31 wrapProgram $out/lib/openra${openraSuffix}/launch-game.sh \
32 --prefix PATH : "${path}" \
33 --prefix LD_LIBRARY_PATH : "${rpath}" \
34 --set TERM xterm
35
36 makeWrapper $out/lib/openra${openraSuffix}/launch-game.sh $(mkdirp $out/bin)/openra${openraSuffix} \
37 --run "cd $out/lib/openra${openraSuffix}"
38 '';
39
40 packageAttrs = {
41 buildInputs = with dotnetPackages; [
42 FuzzyLogicLibrary
43 MaxMindDb
44 MaxMindGeoIP2
45 MonoNat
46 NewtonsoftJson
47 NUnit3
48 NUnitConsole
49 OpenNAT
50 RestSharp
51 SharpFont
52 SharpZipLib
53 SmartIrc4net
54 StyleCopMSBuild
55 StyleCopPlusMSBuild
56 ] ++ [
57 libGL
58 ];
59
60 # TODO: Test if this is correct.
61 nativeBuildInputs = [
62 curl
63 unzip
64 dos2unix
65 pkg-config
66 makeWrapper
67 mkdirp
68 mono
69 python
70 ];
71
72 makeFlags = [ "prefix=$(out)" ];
73
74 doCheck = true;
75
76 dontStrip = true;
77
78 meta = {
79 maintainers = with maintainers; [ fusion809 msteen rardiol ];
80 license = licenses.gpl3;
81 platforms = platforms.linux;
82 };
83 };
84}