timesync, meson: allow statically linked build

Build option "link-timesyncd-shared" to build a statically linked
systemd-timesyncd by using

  -Dlink-udev-shared=false -Dlink-timesyncd-shared=false

on systems with full systemd stack except systemd-timesyncd, such
as RHEL/CentOS 8.
This commit is contained in:
Robert Scheck 2020-02-08 14:02:09 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent dd0395b565
commit fd74a13e85
2 changed files with 14 additions and 2 deletions

View File

@ -2292,10 +2292,19 @@ if conf.get('ENABLE_TIMEDATECTL') == 1
endif
if conf.get('ENABLE_TIMESYNCD') == 1
if get_option('link-timesyncd-shared')
timesyncd_link_with = [libshared]
else
timesyncd_link_with = [libsystemd_static,
libshared_static,
libjournal_client,
libbasic_gcrypt]
endif
executable('systemd-timesyncd',
systemd_timesyncd_sources,
include_directories : includes,
link_with : [libshared],
link_with : [timesyncd_link_with],
dependencies : [threads,
libm],
install_rpath : rootlibexecdir,
@ -2305,7 +2314,7 @@ if conf.get('ENABLE_TIMESYNCD') == 1
executable('systemd-time-wait-sync',
'src/time-wait-sync/time-wait-sync.c',
include_directories : includes,
link_with : [libshared],
link_with : [timesyncd_link_with],
install_rpath : rootlibexecdir,
install : true,
install_dir : rootlibexecdir)
@ -3469,6 +3478,7 @@ foreach tuple : [
['link-udev-shared', get_option('link-udev-shared')],
['link-systemctl-shared', get_option('link-systemctl-shared')],
['link-networkd-shared', get_option('link-networkd-shared')],
['link-timesyncd-shared', get_option('link-timesyncd-shared')],
]
if tuple.length() >= 2

View File

@ -18,6 +18,8 @@ option('link-systemctl-shared', type: 'boolean',
description : 'link systemctl against libsystemd-shared.so')
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('static-libsystemd', type : 'combo',
choices : ['false', 'true', 'pic', 'no-pic'],
description : '''install a static library for libsystemd''')