2020-04-24 23:36:52 +00:00
|
|
|
/* The reusable code, and package attributes, between OpenRA engine packages (engine.nix)
|
|
|
|
and out-of-tree mod packages (mod.nix).
|
|
|
|
*/
|
2021-02-05 17:12:51 +00:00
|
|
|
{ lib, makeSetupHook, curl, unzip, dos2unix, pkg-config, makeWrapper
|
2023-07-15 17:15:38 +00:00
|
|
|
, lua, mono, python3
|
2020-04-24 23:36:52 +00:00
|
|
|
, libGL, freetype, openal, SDL2
|
2024-07-27 06:49:29 +00:00
|
|
|
# It is not necessary to run the game, but it is nicer to be given an error dialog in the case of failure,
|
|
|
|
# rather than having to look to the logs why it is not starting.
|
2020-04-24 23:36:52 +00:00
|
|
|
, zenity
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2024-04-21 15:54:59 +00:00
|
|
|
inherit (lib)
|
|
|
|
licenses
|
|
|
|
maintainers
|
|
|
|
makeBinPath
|
|
|
|
makeLibraryPath
|
|
|
|
optional
|
|
|
|
platforms
|
|
|
|
;
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
path = makeBinPath ([ mono python3 ] ++ optional (zenity != null) zenity);
|
2020-04-24 23:36:52 +00:00
|
|
|
rpath = makeLibraryPath [ lua freetype openal SDL2 ];
|
2023-02-02 18:25:31 +00:00
|
|
|
mkdirp = makeSetupHook {
|
|
|
|
name = "openra-mkdirp-hook";
|
|
|
|
} ./mkdirp.sh;
|
2020-04-24 23:36:52 +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
|
|
|
|
'';
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
wrapLaunchGame = openraSuffix: binaryName: ''
|
2020-04-24 23:36:52 +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
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
makeWrapper $out/lib/openra${openraSuffix}/launch-game.sh $(mkdirp $out/bin)/${binaryName} \
|
2022-04-27 09:35:20 +00:00
|
|
|
--chdir "$out/lib/openra${openraSuffix}"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
packageAttrs = {
|
2023-07-15 17:15:38 +00:00
|
|
|
buildInputs = [ libGL ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# TODO: Test if this is correct.
|
|
|
|
nativeBuildInputs = [
|
|
|
|
curl
|
|
|
|
unzip
|
|
|
|
dos2unix
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
makeWrapper
|
|
|
|
mkdirp
|
|
|
|
mono
|
2022-09-30 11:47:45 +00:00
|
|
|
python3
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
makeFlags = [ "prefix=$(out)" ];
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
dontStrip = true;
|
|
|
|
|
|
|
|
meta = {
|
2023-08-10 07:59:29 +00:00
|
|
|
maintainers = with maintainers; [ fusion809 msteen ];
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.gpl3;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|