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.
This commit is contained in:
James Hilliard 2022-07-27 15:28:09 -06:00 committed by Yu Watanabe
parent 219fa78b5f
commit 0a0d489968
2 changed files with 30 additions and 19 deletions

View file

@ -2263,11 +2263,19 @@ public_programs += executable(
install_rpath : rootpkglibdir, install_rpath : rootpkglibdir,
install : true) 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( public_programs += executable(
'journalctl', 'journalctl',
journalctl_sources, journalctl_sources,
include_directories : includes, include_directories : includes,
link_with : [libshared], link_with : [journalctl_link_with],
dependencies : [threads, dependencies : [threads,
libdl, libdl,
libxz, libxz,
@ -4288,7 +4296,7 @@ foreach tuple : [
# components # components
['backlight'], ['backlight'],
['binfmt'], ['binfmt'],
['bpf-framework', conf.get('BPF_FRAMEWORK') == 1], ['bpf-framework', conf.get('BPF_FRAMEWORK') == 1],
['coredump'], ['coredump'],
['environment.d'], ['environment.d'],
['efi'], ['efi'],
@ -4318,7 +4326,7 @@ foreach tuple : [
['resolve'], ['resolve'],
['rfkill'], ['rfkill'],
['sysext'], ['sysext'],
['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1], ['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1],
['sysupdate'], ['sysupdate'],
['sysusers'], ['sysusers'],
['timedated'], ['timedated'],
@ -4332,36 +4340,37 @@ foreach tuple : [
['idn'], ['idn'],
['polkit'], ['polkit'],
['nscd'], ['nscd'],
['legacy-pkla', install_polkit_pkla], ['legacy-pkla', install_polkit_pkla],
['kmod'], ['kmod'],
['dbus'], ['dbus'],
['glib'], ['glib'],
['tpm'], ['tpm'],
['man pages', want_man], ['man pages', want_man],
['html pages', want_html], ['html pages', want_html],
['man page indices', want_man and have_lxml], ['man page indices', want_man and have_lxml],
['SysV compat'], ['SysV compat'],
['compat-mutable-uid-boundaries'], ['compat-mutable-uid-boundaries'],
['utmp'], ['utmp'],
['ldconfig'], ['ldconfig'],
['adm group', get_option('adm-group')], ['adm group', get_option('adm-group')],
['wheel group', get_option('wheel-group')], ['wheel group', get_option('wheel-group')],
['gshadow'], ['gshadow'],
['debug hashmap'], ['debug hashmap'],
['debug mmap cache'], ['debug mmap cache'],
['debug siphash'], ['debug siphash'],
['valgrind', conf.get('VALGRIND') == 1], ['valgrind', conf.get('VALGRIND') == 1],
['trace logging', conf.get('LOG_TRACE') == 1], ['trace logging', conf.get('LOG_TRACE') == 1],
['install tests', install_tests], ['install tests', install_tests],
['link-udev-shared', get_option('link-udev-shared')], ['link-udev-shared', get_option('link-udev-shared')],
['link-systemctl-shared', get_option('link-systemctl-shared')], ['link-systemctl-shared', get_option('link-systemctl-shared')],
['link-networkd-shared', get_option('link-networkd-shared')], ['link-networkd-shared', get_option('link-networkd-shared')],
['link-timesyncd-shared', get_option('link-timesyncd-shared')], ['link-timesyncd-shared', get_option('link-timesyncd-shared')],
['link-boot-shared', get_option('link-boot-shared')], ['link-journalctl-shared', get_option('link-journalctl-shared')],
['link-boot-shared', get_option('link-boot-shared')],
['first-boot-full-preset'], ['first-boot-full-preset'],
['fexecve'], ['fexecve'],
['standalone-binaries', get_option('standalone-binaries')], ['standalone-binaries', get_option('standalone-binaries')],
['coverage', get_option('b_coverage')], ['coverage', get_option('b_coverage')],
] ]
if tuple.length() >= 2 if tuple.length() >= 2

View file

@ -25,6 +25,8 @@ option('link-networkd-shared', type: 'boolean',
description : 'link systemd-networkd and its helpers to libsystemd-shared.so') description : 'link systemd-networkd and its helpers to libsystemd-shared.so')
option('link-timesyncd-shared', type: 'boolean', option('link-timesyncd-shared', type: 'boolean',
description : 'link systemd-timesyncd and its helpers to libsystemd-shared.so') 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', option('link-boot-shared', type: 'boolean',
description : 'link bootctl and systemd-bless-boot against libsystemd-shared.so') description : 'link bootctl and systemd-bless-boot against libsystemd-shared.so')
option('first-boot-full-preset', type: 'boolean', value: false, option('first-boot-full-preset', type: 'boolean', value: false,