blob: 90843e5abe651bcb7f0741a8bb2b47613a7e5fd4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
/*
The package definition for an OpenRA engine.
It shares code with `mod.nix` by what is defined in `common.nix`.
Similar to `mod.nix` it is a generic package definition,
in order to make it easy to define multiple variants of the OpenRA engine.
For each mod provided by the engine, a wrapper script is created,
matching the naming convention used by `mod.nix`.
This package could be seen as providing a set of in-tree mods,
while the `mod.nix` packages provide a single out-of-tree mod.
*/
{
lib,
stdenv,
packageAttrs,
patchEngine,
wrapLaunchGame,
engine,
}:
let
version = "${engine.name}-${engine.version}";
in
stdenv.mkDerivation (
{
pname = "openra_2019";
inherit version;
src = engine.src;
postPatch = patchEngine "." version;
configurePhase = ''
runHook preConfigure
make version VERSION=${lib.escapeShellArg version}
runHook postConfigure
'';
buildFlags = [
"DEBUG=false"
"default"
"man-page"
];
checkTarget = "nunit test";
installTargets = [
"install"
"install-linux-icons"
"install-linux-desktop"
"install-linux-appdata"
"install-linux-mime"
"install-man-page"
];
postInstall = ''
${wrapLaunchGame "" "openra"}
${lib.concatStrings (
map (mod: ''
makeWrapper $out/bin/openra $out/bin/openra-${mod} --add-flags Game.Mod=${mod}
'') engine.mods
)}
'';
meta = packageAttrs.meta // engine.meta;
}
// removeAttrs packageAttrs [ "meta" ]
)
|