From 7964702007ae1ae1180dc9ff12f97a9b7651c8ab Mon Sep 17 00:00:00 2001 From: Robert Scheck Date: Sun, 12 Dec 2021 01:27:03 +0100 Subject: [PATCH] boot, meson: allow statically linked build Build option "link-boot-shared" to build a statically linked bootctl and systemd-bless-boot by using -Dlink-boot-shared=false on systems with full systemd stack except bootctl and systemd-bless-boot, such as CentOS/RHEL 9. --- meson.build | 13 ++++++++++--- meson_options.txt | 3 +++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index d64a3be619..94bc49ed63 100644 --- a/meson.build +++ b/meson.build @@ -2281,11 +2281,17 @@ if conf.get('HAVE_PAM') == 1 endif if conf.get('HAVE_BLKID') == 1 and conf.get('HAVE_GNU_EFI') == 1 + if get_option('link-boot-shared') + boot_link_with = [libshared] + else + boot_link_with = [libsystemd_static, libshared_static] + endif + public_programs += executable( 'bootctl', 'src/boot/bootctl.c', include_directories : includes, - link_with : [libshared], + link_with : [boot_link_with], dependencies : [libblkid], install_rpath : rootlibexecdir, install : true) @@ -2294,7 +2300,7 @@ if conf.get('HAVE_BLKID') == 1 and conf.get('HAVE_GNU_EFI') == 1 'systemd-bless-boot', 'src/boot/bless-boot.c', include_directories : includes, - link_with : [libshared], + link_with : [boot_link_with], dependencies : [libblkid], install_rpath : rootlibexecdir, install : true, @@ -2304,7 +2310,7 @@ if conf.get('HAVE_BLKID') == 1 and conf.get('HAVE_GNU_EFI') == 1 'systemd-bless-boot-generator', 'src/boot/bless-boot-generator.c', include_directories : includes, - link_with : [libshared], + link_with : [boot_link_with], install_rpath : rootlibexecdir, install : true, install_dir : systemgeneratordir) @@ -4042,6 +4048,7 @@ foreach tuple : [ ['link-systemctl-shared', get_option('link-systemctl-shared')], ['link-networkd-shared', get_option('link-networkd-shared')], ['link-timesyncd-shared', get_option('link-timesyncd-shared')], + ['link-boot-shared', get_option('link-boot-shared')], ['fexecve'], ['standalone-binaries', get_option('standalone-binaries')], ] diff --git a/meson_options.txt b/meson_options.txt index 4d406b3e50..401f0933d7 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -23,6 +23,9 @@ 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('link-boot-shared', type: 'boolean', + description : 'link bootctl and systemd-bless-boot against libsystemd-shared.so') + option('static-libsystemd', type : 'combo', choices : ['false', 'true', 'pic', 'no-pic'], description : '''install a static library for libsystemd''')