iwd: fix cross compilation

This derivation uses wrapPython to wrap some "test scripts" that are
shipped in the "test" output.

As these test scripts require gobject-introspection, which doesn't
cross-compile at all, let's only patch and ship them when not
cross-compiling.
This commit is contained in:
Florian Klink 2020-12-27 13:45:46 +01:00
parent 52261c4c27
commit d24918b70e

View File

@ -21,7 +21,8 @@ stdenv.mkDerivation rec {
sha256 = "0gzpdgfwzlqj2n3amf2zhi2hlpa412878yphgx79y6b5gn1y1lm2"; sha256 = "0gzpdgfwzlqj2n3amf2zhi2hlpa412878yphgx79y6b5gn1y1lm2";
}; };
outputs = [ "out" "man" "test" ]; outputs = [ "out" "man" ]
++ stdenv.lib.optional (stdenv.hostPlatform == stdenv.buildPlatform) "test";
nativeBuildInputs = [ nativeBuildInputs = [
autoreconfHook autoreconfHook
@ -38,7 +39,9 @@ stdenv.mkDerivation rec {
checkInputs = [ openssl ]; checkInputs = [ openssl ];
pythonPath = [ # wrapPython wraps the scripts in $test. They pull in gobject-introspection,
# which doesn't cross-compile.
pythonPath = stdenv.lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform) [
python3Packages.dbus-python python3Packages.dbus-python
python3Packages.pygobject3 python3Packages.pygobject3
]; ];
@ -61,11 +64,12 @@ stdenv.mkDerivation rec {
doCheck = true; doCheck = true;
postInstall = '' postInstall = ''
mkdir -p $test/bin
cp -a test/* $test/bin/
mkdir -p $out/share mkdir -p $out/share
cp -a doc $out/share/ cp -a doc $out/share/
cp -a README AUTHORS TODO $out/share/doc/ cp -a README AUTHORS TODO $out/share/doc/
'' + stdenv.lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
mkdir -p $test/bin
cp -a test/* $test/bin/
''; '';
preFixup = '' preFixup = ''