nixpkgs/pkgs/games/openra_2019/common.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

77 lines
1.9 KiB
Nix
Raw Normal View History

2019-01-02 00:05:51 +00:00
/* The reusable code, and package attributes, between OpenRA engine packages (engine.nix)
and out-of-tree mod packages (mod.nix).
*/
{ lib, makeSetupHook, curl, unzip, dos2unix, pkg-config, makeWrapper
, lua, mono, python3
, libGL, freetype, openal, SDL2
2019-01-02 00:05:51 +00:00
, zenity
}:
let
inherit (lib)
licenses
maintainers
makeBinPath
makeLibraryPath
optional
platforms
;
2022-09-23 15:35:09 +00:00
path = makeBinPath ([ mono python3 ] ++ optional (zenity != null) zenity);
rpath = makeLibraryPath [ lua freetype openal SDL2 ];
2023-01-18 16:29:22 +00:00
mkdirp = makeSetupHook {
name = "openra-mkdirp-hook";
} ./mkdirp.sh;
2019-01-02 00:05:51 +00:00
in {
patchEngine = dir: version: ''
sed -i \
-e 's/^VERSION.*/VERSION = ${version}/g' \
-e '/fetch-geoip-db/d' \
-e '/GeoLite2-Country.mmdb.gz/d' \
${dir}/Makefile
sed -i 's|locations=.*|locations=${lua}/lib|' ${dir}/thirdparty/configure-native-deps.sh
'';
wrapLaunchGame = openraSuffix: binaryName: ''
2019-01-02 00:05:51 +00:00
# Setting TERM=xterm fixes an issue with terminfo in mono: System.Exception: Magic number is wrong: 542
# https://github.com/mono/mono/issues/6752#issuecomment-365212655
wrapProgram $out/lib/openra${openraSuffix}/launch-game.sh \
--prefix PATH : "${path}" \
--prefix LD_LIBRARY_PATH : "${rpath}" \
--set TERM xterm
makeWrapper $out/lib/openra${openraSuffix}/launch-game.sh $(mkdirp $out/bin)/${binaryName} \
--chdir "$out/lib/openra${openraSuffix}"
2019-01-02 00:05:51 +00:00
'';
packageAttrs = {
buildInputs = [ libGL ];
2019-01-02 00:05:51 +00:00
# TODO: Test if this is correct.
nativeBuildInputs = [
curl
unzip
dos2unix
pkg-config
2019-01-02 00:05:51 +00:00
makeWrapper
mkdirp
mono
2022-09-23 15:35:09 +00:00
python3
2019-01-02 00:05:51 +00:00
];
makeFlags = [ "prefix=$(out)" ];
2019-01-02 00:05:51 +00:00
doCheck = true;
dontStrip = true;
meta = {
2023-08-09 17:34:01 +00:00
maintainers = with maintainers; [ fusion809 msteen ];
2019-01-02 00:05:51 +00:00
license = licenses.gpl3;
platforms = platforms.linux;
};
};
}