mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
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.
This commit is contained in:
parent
89544ae658
commit
f3794366b0
12
meson.build
12
meson.build
@ -1708,9 +1708,19 @@ exe = executable('systemd-socket-activate', 'src/activate/activate.c',
|
|||||||
install : true)
|
install : true)
|
||||||
public_programs += [exe]
|
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',
|
exe = executable('systemctl', 'src/systemctl/systemctl.c',
|
||||||
include_directories : includes,
|
include_directories : includes,
|
||||||
link_with : [libshared],
|
link_with : systemctl_link_with,
|
||||||
dependencies : [threads,
|
dependencies : [threads,
|
||||||
libcap,
|
libcap,
|
||||||
libselinux,
|
libselinux,
|
||||||
|
@ -13,6 +13,8 @@ option('rootprefix', type : 'string',
|
|||||||
description : '''override the root prefix''')
|
description : '''override the root prefix''')
|
||||||
option('link-udev-shared', type : 'boolean',
|
option('link-udev-shared', type : 'boolean',
|
||||||
description : 'link systemd-udev and its helpers to libsystemd-shared.so')
|
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',
|
option('static-libsystemd', type : 'combo',
|
||||||
choices : ['false', 'true', 'pic', 'no-pic'],
|
choices : ['false', 'true', 'pic', 'no-pic'],
|
||||||
description : '''install a static library for libsystemd''')
|
description : '''install a static library for libsystemd''')
|
||||||
|
Loading…
Reference in New Issue
Block a user