All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/systemd: link host systemd utilities statically
@ 2024-09-10 19:36 James Hilliard
  2024-09-11 16:44 ` Yann E. MORIN
  0 siblings, 1 reply; 4+ messages in thread
From: James Hilliard @ 2024-09-10 19:36 UTC (permalink / raw)
  To: buildroot; +Cc: James Hilliard, Norbert Lange, Sen Hastings, Yann E . MORIN

This makes it less likely that we will run into missing library
errors when running host systemd utilities and lets us remove the
HOST_SYSTEMD_FIX_RPATH hack.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
 .../fakeroot_tmpfiles.sh                      |  2 +-
 .../skeleton-init-systemd.mk                  |  2 +-
 package/systemd/systemd.mk                    | 30 +++++++------------
 3 files changed, 13 insertions(+), 21 deletions(-)

diff --git a/package/skeleton-init-systemd/fakeroot_tmpfiles.sh b/package/skeleton-init-systemd/fakeroot_tmpfiles.sh
index 9498638f0b..5381750500 100755
--- a/package/skeleton-init-systemd/fakeroot_tmpfiles.sh
+++ b/package/skeleton-init-systemd/fakeroot_tmpfiles.sh
@@ -25,7 +25,7 @@
 # [1] - https://github.com/systemd/systemd/pull/16187
 
 [ -n "${HOST_SYSTEMD_TMPFILES-}" ] ||
-    HOST_SYSTEMD_TMPFILES=systemd-tmpfiles
+    HOST_SYSTEMD_TMPFILES=systemd-tmpfiles.standalone
 
 [ -n "${1-}" -a -d "${1-}"/usr/lib/tmpfiles.d ] ||
     { echo 1>&2 "$0: need ROOTFS argument"; exit 1; }
diff --git a/package/skeleton-init-systemd/skeleton-init-systemd.mk b/package/skeleton-init-systemd/skeleton-init-systemd.mk
index b312fe33e4..cd51ce209a 100644
--- a/package/skeleton-init-systemd/skeleton-init-systemd.mk
+++ b/package/skeleton-init-systemd/skeleton-init-systemd.mk
@@ -80,7 +80,7 @@ endif  # BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW
 
 ifeq ($(BR2_INIT_SYSTEMD_POPULATE_TMPFILES),y)
 define SKELETON_INIT_SYSTEMD_CREATE_TMPFILES_HOOK
-	HOST_SYSTEMD_TMPFILES=$(HOST_DIR)/bin/systemd-tmpfiles \
+	HOST_SYSTEMD_TMPFILES=$(HOST_DIR)/bin/systemd-tmpfiles.standalone \
 		$(SKELETON_INIT_SYSTEMD_PKGDIR)/fakeroot_tmpfiles.sh $(TARGET_DIR)
 endef
 SKELETON_INIT_SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SKELETON_INIT_SYSTEMD_CREATE_TMPFILES_HOOK
diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
index 5dca8681bc..9a18d91533 100644
--- a/package/systemd/systemd.mk
+++ b/package/systemd/systemd.mk
@@ -899,6 +899,17 @@ endef
 # We need a very minimal host variant, so we disable as much as possible.
 HOST_SYSTEMD_CONF_OPTS = \
 	-Dsplit-bin=true \
+	-Dlink-udev-shared=false \
+	-Dlink-executor-shared=false \
+	-Dlink-systemctl-shared=false \
+	-Dlink-networkd-shared=false \
+	-Dlink-timesyncd-shared=false \
+	-Dlink-journalctl-shared=false \
+	-Dlink-boot-shared=false \
+	-Dlink-portabled-shared=false \
+	-Dstatic-libsystemd=true \
+	-Dstatic-libudev=true \
+	-Dstandalone-binaries=true \
 	--prefix=/usr \
 	--libdir=lib \
 	--sysconfdir=/etc \
@@ -1022,24 +1033,5 @@ HOST_SYSTEMD_DEPENDENCIES = \
 
 HOST_SYSTEMD_NINJA_ENV = DESTDIR=$(HOST_DIR)
 
-# 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 rpath is thus lost.
-# * the original path had been tweaked by buildroot via LDFLAGS to add
-#   $(HOST_DIR)/lib
-# * thus re-tweak rpath after the installation for all binaries that need it
-HOST_SYSTEMD_HOST_TOOLS = busctl journalctl systemctl systemd-* udevadm
-
-define HOST_SYSTEMD_FIX_RPATH
-	for f in $(addprefix $(HOST_DIR)/bin/,$(HOST_SYSTEMD_HOST_TOOLS)); do \
-		[ -e $$f ] || continue; \
-		$(HOST_DIR)/bin/patchelf --set-rpath $(HOST_DIR)/lib:$(HOST_DIR)/lib/systemd $${f} \
-		|| exit 1; \
-	done
-endef
-HOST_SYSTEMD_POST_INSTALL_HOOKS += HOST_SYSTEMD_FIX_RPATH
-
 $(eval $(meson-package))
 $(eval $(host-meson-package))
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-09-11 19:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-10 19:36 [Buildroot] [PATCH 1/1] package/systemd: link host systemd utilities statically James Hilliard
2024-09-11 16:44 ` Yann E. MORIN
2024-09-11 17:07   ` James Hilliard
2024-09-11 19:14     ` Yann E. MORIN

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.