From fd74a13e85acdf2880696d8f8f9ebe62ed37b29c Mon Sep 17 00:00:00 2001 From: Robert Scheck Date: Sat, 8 Feb 2020 14:02:09 +0100 Subject: [PATCH] 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. --- meson.build | 14 ++++++++++++-- meson_options.txt | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index c8f6482e4a..fc216d22da 100644 --- a/meson.build +++ b/meson.build @@ -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 diff --git a/meson_options.txt b/meson_options.txt index 4f82479a9b..4988d41ff3 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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''')