All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jérémy Rosen" <jeremy.rosen@smile.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 1/9] new recipe : host-systemd
Date: Mon, 11 Nov 2019 18:24:35 +0100	[thread overview]
Message-ID: <20191111172443.6874-2-jeremy.rosen@smile.fr> (raw)
In-Reply-To: <20191111172443.6874-1-jeremy.rosen@smile.fr>

Add the infrastructure to build the host version of systemd
* disable all optional features, they can be re-added when needed
* systemd has creative way of dealing with cross compile
  we build a "normal" host systemd, but install it in $HOST_DIR
  we use systemctl --root to correctly act on TARGET_DIR
* we need to adjust RPATH using patchelf because meson can't do it
  correctly by itsel

Signed-off-by: J?r?my Rosen <jeremy.rosen@smile.fr>
---
 package/systemd/systemd.mk | 93 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 93 insertions(+)

diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
index 92490eb86b..d1db60b5ef 100644
--- a/package/systemd/systemd.mk
+++ b/package/systemd/systemd.mk
@@ -551,3 +551,96 @@ SYSTEMD_CONF_ENV = $(HOST_UTF8_LOCALE_ENV)
 SYSTEMD_NINJA_ENV = $(HOST_UTF8_LOCALE_ENV)
 
 $(eval $(meson-package))
+
+#
+# Host-systemd configuration
+#
+#Options tweaked for buildroot
+HOST_SYSTEMD_CONF_OPTS= \
+	-Dsplit-bin=true \
+	-Dsplit-usr=false \
+	--prefix=/usr \
+	--libdir=lib \
+	--sysconfdir=/etc \
+	--localstatedir=/var
+
+#disable everything else
+HOST_SYSTEMD_CONF_OPTS+= \
+	-Dutmp=false \
+	-Dhibernate=false \
+	-Dldconfig=false \
+	-Dresolve=false \
+	-Defi=false \
+	-Dtpm=false \
+	-Denvironment-d=false \
+	-Dbinfmt=false \
+	-Dcoredump=false \
+	-Dpstore=false \
+	-Dlogind=false \
+	-Dhostnamed=false \
+	-Dlocaled=false \
+	-Dmachined=false \
+	-Dportabled=false \
+	-Dnetworkd=false \
+	-Dtimedated=false \
+	-Dtimesyncd=false \
+	-Dremote=false \
+	-Dcreate-log-dirs=false \
+	-Dnss-myhostname=false \
+	-Dnss-mymachines=false \
+	-Dnss-resolve=false \
+	-Dnss-systemd=false \
+	-Dfirstboot=false \
+	-Drandomseed=false \
+	-Dbacklight=false \
+	-Dvconsole=false \
+	-Dquotacheck=false \
+	-Dsysusers=false \
+	-Dtmpfiles=false \
+	-Dimportd=false \
+	-Dhwdb=false \
+	-Drfkill=false \
+	-Dman=false \
+	-Dhtml=false \
+	-Dsmack=false \
+	-Dpolkit=false \
+	-Dblkid=false \
+	-Didn=false \
+	-Dadm-group=false \
+	-Dwheel-group=false \
+	-Dzlib=false \
+	-Dgshadow=false \
+	-Dima=false \
+	-Dtests=false \
+	-Dglib=false \
+	-Dacl=false \
+	-Dsysvinit-path=''
+
+HOST_SYSTEMD_DEPENDENCIES = \
+	host-util-linux \
+	host-patchelf \
+	host-libcap \
+	host-gperf
+
+# Fix RPATH After installation
+# * systemd provides a install_rpath instruction to meson because the binaries need to link with
+#   libsystemd which is not in a standard path
+# * meson can only replace the RPATH, not append to it
+# * the original rpatch is thus lost.
+# * the original path had been tweaked by buildroot vial LD_FLAGS to add $(HOST_DIR)/lib
+# * thus re-tweak rpath after the installation for all binaries that need it
+#buildroot detects incorrect RPATH, so adding new binaries should be safe (it won't compile
+#unless properly integrated).
+HOST_SYSTEMD_HOST_TOOLS = \
+	systemd-analyze  systemd-mount systemctl
+
+define HOST_SYSTEMD_FIX_RPATH
+	$(foreach f,$(HOST_SYSTEMD_HOST_TOOLS), \
+		$(HOST_DIR)/bin/patchelf --set-rpath $(HOST_DIR)/lib:$(HOST_DIR)/lib/systemd $(HOST_DIR)/bin/$(f)
+	)
+endef
+
+HOST_SYSTEMD_POST_INSTALL_HOOKS +=  HOST_SYSTEMD_FIX_RPATH
+HOST_SYSTEMD_NINJA_ENV = DESTDIR=$(HOST_DIR)
+
+$(eval $(host-meson-package))
-- 
2.24.0.rc1

  reply	other threads:[~2019-11-11 17:24 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-11 17:24 [Buildroot] [PATCH v2 0/9] use host-systemd to enable units Jérémy Rosen
2019-11-11 17:24 ` Jérémy Rosen [this message]
2019-12-05 11:01   ` [Buildroot] [PATCH v2 1/9] new recipe : host-systemd Yann E. MORIN
2019-11-11 17:24 ` [Buildroot] [PATCH v2 2/9] use host-systemctl preset all to enable units Jérémy Rosen
2019-12-05 11:33   ` Yann E. MORIN
2019-12-05 13:07   ` Yann E. MORIN
2019-12-07 11:39     ` Jérémy ROSEN
2019-12-07 11:40       ` Jérémy ROSEN
2019-12-07 16:42       ` Yann E. MORIN
2019-11-11 17:24 ` [Buildroot] [PATCH v2 3/9] fix tty handling Jérémy Rosen
2019-12-05 11:25   ` Yann E. MORIN
2019-11-11 17:24 ` [Buildroot] [PATCH v2 4/9] fix trivial packages with buildroot-provided services Jérémy Rosen
2019-12-05 11:35   ` Yann E. MORIN
2019-11-11 17:24 ` [Buildroot] [PATCH v2 5/9] fix trivial cases, upstream-provided services Jérémy Rosen
2019-12-05 11:36   ` Yann E. MORIN
2019-11-11 17:24 ` [Buildroot] [PATCH v2 6/9] package/connman: adapt to preset-all Jérémy Rosen
2019-12-05 12:57   ` Yann E. MORIN
2019-12-07 12:19     ` Jérémy ROSEN
2019-11-11 17:24 ` [Buildroot] [PATCH v2 7/9] package/linuxptp " Jérémy Rosen
2019-12-05 12:59   ` Yann E. MORIN
2019-11-11 17:24 ` [Buildroot] [PATCH v2 8/9] package/network-manager: " Jérémy Rosen
2019-12-05 13:01   ` Yann E. MORIN
2019-12-05 22:29     ` Arnout Vandecappelle
2019-12-07 13:28       ` Jérémy ROSEN
2019-11-11 17:24 ` [Buildroot] [PATCH v2 9/9] package/wpa_supplicant: adapt for preset-all Jérémy Rosen
2019-12-05 13:04   ` Yann E. MORIN
2019-12-07 13:31     ` Jérémy ROSEN
2019-11-19  9:58 ` [Buildroot] [PATCH v2 0/9] use host-systemd to enable units Jérémy ROSEN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191111172443.6874-2-jeremy.rosen@smile.fr \
    --to=jeremy.rosen@smile.fr \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.