libpeas2: fix cross compilation

This commit is contained in:
Colin
2024-09-29 13:49:46 +00:00
parent 8637e879e4
commit 7062afb2ff
+23 -6
View File
@@ -1,6 +1,8 @@
{ stdenv
, lib
, buildPackages
, fetchurl
, pkgsCross
, substituteAll
, pkg-config
, gi-docgen
@@ -15,6 +17,9 @@
, gnome
}:
let
luaEnv = lua5_1.withPackages (ps: with ps; [ lgi ]);
in
stdenv.mkDerivation rec {
pname = "libpeas";
version = "2.0.3";
@@ -51,8 +56,7 @@ stdenv.mkDerivation rec {
buildInputs = [
gjs
glib
lua5_1
lua5_1.pkgs.lgi
luaEnv
python3
python3.pkgs.pygobject3
spidermonkey_115
@@ -67,11 +71,22 @@ stdenv.mkDerivation rec {
"-Dgtk_doc=true"
];
# required for locating lua dependencies at build time (when cross compiling):
env.LUA_CPATH = "${luaEnv}/lib/lua/${luaEnv.luaversion}/?.so";
env.LUA_PATH = "${luaEnv}/share/lua/${luaEnv.luaversion}/?.lua";
strictDeps = true;
postPatch = ''
# Checks lua51 and lua5.1 executable but we have non of them.
substituteInPlace meson.build --replace \
"find_program('lua51', required: false)" \
"find_program('lua', required: false)"
# Checks lua51 and lua5.1 executable but we have none of them.
# Then it tries to invoke lua to check for LGI, which requires emulation for cross.
substituteInPlace meson.build \
--replace-fail \
"find_program('lua51', required: false)" \
"find_program('${lib.getExe' lua5_1 "lua"}', required: false)" \
--replace-fail \
"run_command(lua_prg, [" \
"run_command('${stdenv.hostPlatform.emulator buildPackages}', [lua_prg, "
'';
postFixup = ''
@@ -85,6 +100,8 @@ stdenv.mkDerivation rec {
packageName = "libpeas";
versionPolicy = "odd-unstable";
};
tests.cross = pkgsCross.aarch64-multiplatform.libpeas2;
};
meta = with lib; {