Commit 575d4712 authored by Peter Korsgaard's avatar Peter Korsgaard
Browse files

systemd: fix build on uClibc



Patch based on similar patch in openembedded.

Signed-off-by: default avatarPeter Korsgaard <jacmet@sunsite.dk>
parent f4a5eed4
Loading
Loading
Loading
Loading
+40 −0
Original line number Diff line number Diff line
[PATCH] fix build with uClibc

Based on OE patch from Khem Raj:

http://cgit.openembedded.org/meta-openembedded/tree/meta-oe/recipes-core/systemd/systemd/paper-over-mkostemp.patch

But extended to also cover execvpe (OE carries a patch adding execvpe
support to uClibc).

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
---
 src/macro.h |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

Index: systemd-37/src/macro.h
===================================================================
--- systemd-37.orig/src/macro.h
+++ systemd-37/src/macro.h
@@ -27,6 +27,21 @@
 #include <sys/uio.h>
 #include <inttypes.h>
 
+#ifdef __UCLIBC__
+/* uclibc does not implement mkostemp GNU extension */
+#define mkostemp(x,y) mkstemp(x)
+/* uclibc does not implement execvpe GNU extension */
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include <unistd.h>
+static inline int execvpe(const char *file, char *const argv[],
+                          char *const envp[])
+{
+        environ = (char **)envp;
+        return execvp(file, argv);
+}
+#endif
 #define _printf_attr_(a,b) __attribute__ ((format (printf, a, b)))
 #define _sentinel_ __attribute__ ((sentinel))
 #define _noreturn_ __attribute__((noreturn))
+3 −0
Original line number Diff line number Diff line
@@ -41,6 +41,9 @@ else
	SYSTEMD_CONF_OPT += --disable-acl
endif

# mq_getattr needs -lrt
SYSTEMD_MAKE_OPT += LIBS=-lrt

define SYSTEMD_INSTALL_INIT_HOOK
	ln -fs ../bin/systemd $(TARGET_DIR)/sbin/init
	ln -fs ../bin/systemctl $(TARGET_DIR)/sbin/halt