[systemd-devel] [PATCH] Allow cross-compilation.

Thierry Reding thierry.reding at avionic-design.de
Tue Nov 23 00:15:43 PST 2010


When cross-compiling systemd, the introspection XML files fail to be
generated because the systemd host binary is not executable. This patch
works around this by looking for the systemd binary in the path of the
build host and run that instead of the host binary created during the
build process.

A typical setup may be to build systemd once for the build host and then
make sure the resulting binary is in the path when cross-compiling
systemd for the host.
---
 Makefile.am  |    2 +-
 configure.ac |    7 +++++++
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 4330db0..81814e5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1119,7 +1119,7 @@ CLEANFILES += \
 endif
 
 org.freedesktop.systemd1.%.xml: systemd
-	$(AM_V_GEN)SYSTEMD_SKIP_API_MOUNTS=1 ./systemd --introspect=${@:.xml=} > $@
+	$(AM_V_GEN)SYSTEMD_SKIP_API_MOUNTS=1 $(SYSTEMD) --introspect=${@:.xml=} > $@
 
 CLEANFILES += \
 	$(dbusinterface_DATA)
diff --git a/configure.ac b/configure.ac
index 247806d..a85ba9a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -397,6 +397,13 @@ else
         SYSTEM_SYSV_COMPAT="no"
 fi
 
+if test "x$cross_compiling" = "xyes"; then
+        AC_CHECK_PROG(SYSTEMD, systemd, systemd, ./systemd)
+else
+        SYSTEMD=./systemd
+        AC_SUBST(SYSTEMD)
+fi
+
 AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora)
 AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
 AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)



More information about the systemd-devel mailing list