From: Felipe Sateler Date: Tue, 22 May 2018 19:08:57 +0000 (-0400) Subject: build-sys: Add option to link systemctl statically X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=81f6f7b349ab6573efcb0ef5c5994b0e7e8c8d10;p=elogind.git build-sys: Add option to link systemctl statically Systemctl is special because it is required for many tasks that may need to be performed when the system is not fully configured and/or partially broken: 1. Installing/Uninstalling services during OS installs and upgrades 2. Shutting down the system Therefore reduce the number of dependencies that systemctl pulls in, by not linking to systemd-shared. This brings a bit of resilience to systemctl (and its aliases shutdown, reboot, etc), by linking against less external libraries. Because this extra resilience comes at a cost of approximately 580 KB extra space, this is done behind a meson build option. --- diff --git a/meson.build b/meson.build index 40f2e21b4..c226dfaed 100644 --- a/meson.build +++ b/meson.build @@ -1926,6 +1926,7 @@ executable('elogind-user-runtime-dir', executable('elogind-user-runtime-dir', executable('elogind-user-runtime-dir', executable('elogind-user-runtime-dir', +executable('elogind-user-runtime-dir', executable('elogind-user-runtime-dir', user_runtime_dir_sources, include_directories : includes, @@ -1986,9 +1987,19 @@ endif # install : true) # public_programs += [exe] # +# +# if get_option('link-systemctl-shared') +# systemctl_link_with = [libshared] +# else +# systemctl_link_with = [libsystemd_static, +# libshared_static, +# libjournal_client, +# libbasic_gcrypt] +# endif +# # exe = executable('systemctl', 'src/systemctl/systemctl.c', # include_directories : includes, -# link_with : [libshared], +# link_with : systemctl_link_with, # dependencies : [threads, # libcap, # libselinux, diff --git a/meson_options.txt b/meson_options.txt index cf093a615..8e9248825 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -14,6 +14,8 @@ option('rootprefix', type : 'string', #if 0 /// UNNEEDED by elogind # option('link-udev-shared', type : 'boolean', # description : 'link systemd-udev and its helpers to libsystemd-shared.so') +# option('link-systemctl-shared', type: 'boolean', +# description : 'link systemctl against libsystemd-shared.so') # option('static-libsystemd', type : 'combo', # choices : ['false', 'true', 'pic', 'no-pic'], # description : '''install a static library for libsystemd''')