All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/systemd: use statically linked host tools
@ 2022-07-27 22:10 James Hilliard
  2022-07-28  8:33 ` Norbert Lange
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: James Hilliard @ 2022-07-27 22:10 UTC (permalink / raw)
  To: buildroot; +Cc: James Hilliard, Norbert Lange, Sen Hastings, Yann E . MORIN

This lets us remove the HOST_SYSTEMD_FIX_RPATH hack.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
 ...nalctl-allow-statically-linked-build.patch | 68 +++++++++++++++++++
 package/systemd/systemd.mk                    | 28 +++-----
 2 files changed, 76 insertions(+), 20 deletions(-)
 create mode 100644 package/systemd/0002-journalctl-allow-statically-linked-build.patch

diff --git a/package/systemd/0002-journalctl-allow-statically-linked-build.patch b/package/systemd/0002-journalctl-allow-statically-linked-build.patch
new file mode 100644
index 0000000000..98ffb72cca
--- /dev/null
+++ b/package/systemd/0002-journalctl-allow-statically-linked-build.patch
@@ -0,0 +1,68 @@
+From d2dadbdc5618776e07e98baf8795cc8adebf05a1 Mon Sep 17 00:00:00 2001
+From: James Hilliard <james.hilliard1@gmail.com>
+Date: Wed, 27 Jul 2022 15:28:09 -0600
+Subject: [PATCH] journalctl: allow statically linked build
+
+The journalctl tool may be needed on cross compilation hosts in order
+to run --update-catalog against a target rootfs.
+
+To avoid reliability issues caused by shared linking allow journalctl
+to be linked statically.
+
+Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
+[Upstream status:
+https://github.com/systemd/systemd/pull/24140]
+---
+ meson.build       | 11 ++++++++++-
+ meson_options.txt |  2 ++
+ 2 files changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index 692ee1ed4d..8cce19dce6 100644
+--- a/meson.build
++++ b/meson.build
+@@ -2263,11 +2263,19 @@ public_programs += executable(
+         install_rpath : rootpkglibdir,
+         install : true)
+ 
++if get_option('link-journalctl-shared')
++        journalctl_link_with = [libshared]
++else
++        journalctl_link_with = [libsystemd_static,
++                                libshared_static,
++                                libbasic_gcrypt]
++endif
++
+ public_programs += executable(
+         'journalctl',
+         journalctl_sources,
+         include_directories : includes,
+-        link_with : [libshared],
++        link_with : [journalctl_link_with],
+         dependencies : [threads,
+                         libdl,
+                         libxz,
+@@ -4357,6 +4365,7 @@ foreach tuple : [
+         ['link-systemctl-shared', get_option('link-systemctl-shared')],
+         ['link-networkd-shared',  get_option('link-networkd-shared')],
+         ['link-timesyncd-shared', get_option('link-timesyncd-shared')],
++        ['link-journalctl-shared',get_option('link-journalctl-shared')],
+         ['link-boot-shared',      get_option('link-boot-shared')],
+         ['first-boot-full-preset'],
+         ['fexecve'],
+diff --git a/meson_options.txt b/meson_options.txt
+index 628ca1d797..d8c0c581c2 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -25,6 +25,8 @@ option('link-networkd-shared', type: 'boolean',
+        description : 'link systemd-networkd and its helpers to libsystemd-shared.so')
+ option('link-timesyncd-shared', type: 'boolean',
+        description : 'link systemd-timesyncd and its helpers to libsystemd-shared.so')
++option('link-journalctl-shared', type: 'boolean',
++       description : 'link journalctl against libsystemd-shared.so')
+ option('link-boot-shared', type: 'boolean',
+        description : 'link bootctl and systemd-bless-boot against libsystemd-shared.so')
+ option('first-boot-full-preset', type: 'boolean', value: false,
+-- 
+2.34.1
+
diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
index 47aaddf849..13348f9358 100644
--- a/package/systemd/systemd.mk
+++ b/package/systemd/systemd.mk
@@ -738,7 +738,7 @@ endef
 SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SYSTEMD_RM_CATALOG_UPDATE_SERVICE
 
 define SYSTEMD_CREATE_TMPFILES_HOOK
-	HOST_SYSTEMD_TMPFILES=$(HOST_DIR)/bin/systemd-tmpfiles \
+	HOST_SYSTEMD_TMPFILES=$(HOST_DIR)/bin/systemd-tmpfiles.standalone \
 		$(SYSTEMD_PKGDIR)/fakeroot_tmpfiles.sh $(TARGET_DIR)
 endef
 SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SYSTEMD_CREATE_TMPFILES_HOOK
@@ -781,6 +781,13 @@ HOST_SYSTEMD_CONF_OPTS = \
 	--libdir=lib \
 	--sysconfdir=/etc \
 	--localstatedir=/var \
+	-Dlink-udev-shared=false \
+	-Dlink-systemctl-shared=false \
+	-Dlink-networkd-shared=false \
+	-Dlink-timesyncd-shared=false \
+	-Dlink-journalctl-shared=false \
+	-Dlink-boot-shared=false \
+	-Dstandalone-binaries=true \
 	-Dmode=release \
 	-Dutmp=false \
 	-Dhibernate=false \
@@ -854,24 +861,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] 6+ messages in thread

end of thread, other threads:[~2022-08-29 15:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-27 22:10 [Buildroot] [PATCH 1/1] package/systemd: use statically linked host tools James Hilliard
2022-07-28  8:33 ` Norbert Lange
2022-07-28  9:01   ` James Hilliard
2022-07-30 19:04     ` Norbert Lange
2022-07-30 10:22 ` Yann E. MORIN
2022-08-29 15:37 ` 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.