chiark / gitweb /
build-sys: Add option to link systemctl statically
authorFelipe Sateler <fsateler@debian.org>
Tue, 22 May 2018 19:08:57 +0000 (15:08 -0400)
committerSven Eden <yamakuzure@gmx.net>
Fri, 24 Aug 2018 14:47:08 +0000 (16:47 +0200)
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.

meson.build
meson_options.txt

index 40f2e21b4baafbdd098eb0251cbe89e177d4124b..c226dfaed9c9b58646c40f5c47c3dfb3de74e7c1 100644 (file)
@@ -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,
index cf093a615d1eb930d19da55ac9c4b6ad989ae800..8e92488259d4281e66b76d8395e5b7ffbf49c94b 100644 (file)
@@ -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''')