various: check meson feature flag early

Prompted by https://github.com/systemd/systemd/pull/35110#discussion_r1835885340
This commit is contained in:
Mike Yuan
2024-11-12 19:30:38 +01:00
committed by Yu Watanabe
parent c892816ceb
commit e2f82f6151
20 changed files with 149 additions and 132 deletions

View File

@@ -1,17 +1,18 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('ENABLE_BINFMT') != 1
subdir_done()
endif
executables += [
libexec_template + {
'name' : 'systemd-binfmt',
'public' : true,
'conditions' : ['ENABLE_BINFMT'],
'sources' : files('binfmt.c'),
},
]
if conf.get('ENABLE_BINFMT') == 1
install_emptydir(binfmtdir)
if install_sysconfdir
install_emptydir(sysconfdir / 'binfmt.d')
endif
install_emptydir(binfmtdir)
if install_sysconfdir
install_emptydir(sysconfdir / 'binfmt.d')
endif

View File

@@ -1,5 +1,9 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('HAVE_LIBCRYPTSETUP') != 1
subdir_done()
endif
systemd_cryptenroll_sources = files(
'cryptenroll-list.c',
'cryptenroll-password.c',
@@ -24,7 +28,6 @@ executables += [
executable_template + {
'name' : 'systemd-cryptenroll',
'public' : true,
'conditions' : ['HAVE_LIBCRYPTSETUP'],
'sources' : systemd_cryptenroll_sources,
'dependencies' : [
libcryptsetup,

View File

@@ -1,5 +1,9 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('HAVE_LIBCRYPTSETUP') != 1
subdir_done()
endif
subdir('cryptsetup-tokens')
systemd_cryptsetup_sources = files(
@@ -15,7 +19,6 @@ executables += [
executable_template + {
'name' : 'systemd-cryptsetup',
'public' : true,
'conditions' : ['HAVE_LIBCRYPTSETUP'],
'sources' : systemd_cryptsetup_sources,
'dependencies' : [
libcryptsetup,
@@ -25,14 +28,11 @@ executables += [
},
generator_template + {
'name' : 'systemd-cryptsetup-generator',
'conditions' : ['HAVE_LIBCRYPTSETUP'],
'sources' : files('cryptsetup-generator.c'),
},
]
if conf.get('HAVE_LIBCRYPTSETUP') == 1
# symlink for backwards compatibility after rename
meson.add_install_script(sh, '-c',
ln_s.format(bindir / 'systemd-cryptsetup',
libexecdir / 'systemd-cryptsetup'))
endif
# symlink for backwards compatibility after rename
meson.add_install_script(sh, '-c',
ln_s.format(bindir / 'systemd-cryptsetup',
libexecdir / 'systemd-cryptsetup'))

View File

@@ -1,17 +1,18 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('HAVE_BLKID') != 1
subdir_done()
endif
executables += [
executable_template + {
'name' : 'systemd-dissect',
'public' : true,
'conditions' : ['HAVE_BLKID'],
'sources' : files('dissect.c'),
},
]
if conf.get('HAVE_BLKID') == 1
install_emptydir(sbindir)
meson.add_install_script(sh, '-c',
ln_s.format(bindir / 'systemd-dissect',
sbindir / 'mount.ddi'))
endif
install_emptydir(sbindir)
meson.add_install_script(sh, '-c',
ln_s.format(bindir / 'systemd-dissect',
sbindir / 'mount.ddi'))

View File

@@ -1,17 +1,18 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('ENABLE_ENVIRONMENT_D') != 1
subdir_done()
endif
executables += [
executable_template + {
'name' : '30-systemd-environment-d-generator',
'conditions' : ['ENABLE_ENVIRONMENT_D'],
'sources' : files('environment-d-generator.c'),
'install_dir' : userenvgeneratordir,
},
]
if conf.get('ENABLE_ENVIRONMENT_D') == 1
install_emptydir(environmentdir)
meson.add_install_script(sh, '-c',
ln_s.format(sysconfdir / 'environment',
environmentdir / '99-environment.conf'))
endif
install_emptydir(environmentdir)
meson.add_install_script(sh, '-c',
ln_s.format(sysconfdir / 'environment',
environmentdir / '99-environment.conf'))

View File

@@ -1,9 +1,12 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('ENABLE_HIBERNATE') != 1
subdir_done()
endif
executables += [
generator_template + {
'name' : 'systemd-hibernate-resume-generator',
'conditions' : ['ENABLE_HIBERNATE'],
'sources' : files(
'hibernate-resume-generator.c',
'hibernate-resume-config.c',
@@ -11,7 +14,6 @@ executables += [
},
libexec_template + {
'name' : 'systemd-hibernate-resume',
'conditions' : ['ENABLE_HIBERNATE'],
'sources' : files(
'hibernate-resume.c',
'hibernate-resume-config.c',

View File

@@ -1,5 +1,9 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('ENABLE_HOMED') != 1
subdir_done()
endif
systemd_homework_sources = files(
'home-util.c',
'homework-blob.c',
@@ -64,7 +68,6 @@ pam_systemd_home_sources = files(
executables += [
libexec_template + {
'name' : 'systemd-homework',
'conditions' : ['ENABLE_HOMED'],
'sources' : systemd_homework_sources,
'link_with' : [
libshared,
@@ -82,7 +85,6 @@ executables += [
libexec_template + {
'name' : 'systemd-homed',
'dbus' : true,
'conditions' : ['ENABLE_HOMED'],
'sources' : systemd_homed_sources,
'include_directories' : includes +
include_directories('.'),
@@ -96,7 +98,6 @@ executables += [
executable_template + {
'name' : 'homectl',
'public' : true,
'conditions' : ['ENABLE_HOMED'],
'sources' : homectl_sources,
'dependencies' : [
libcrypt,
@@ -108,7 +109,6 @@ executables += [
},
test_template + {
'sources' : files('test-homed-regression-31896.c'),
'conditions' : ['ENABLE_HOMED'],
'type' : 'manual',
},
]
@@ -116,10 +116,7 @@ executables += [
modules += [
pam_template + {
'name' : 'pam_systemd_home',
'conditions' : [
'ENABLE_HOMED',
'HAVE_PAM',
],
'conditions' : ['HAVE_PAM'],
'sources' : pam_systemd_home_sources,
'dependencies' : [
libcrypt,
@@ -131,20 +128,18 @@ modules += [
},
]
if conf.get('ENABLE_HOMED') == 1
install_data('org.freedesktop.home1.conf',
install_dir : dbuspolicydir)
install_data('org.freedesktop.home1.service',
install_dir : dbussystemservicedir)
install_data('org.freedesktop.home1.policy',
install_dir : polkitpolicydir)
install_data('org.freedesktop.home1.conf',
install_dir : dbuspolicydir)
install_data('org.freedesktop.home1.service',
install_dir : dbussystemservicedir)
install_data('org.freedesktop.home1.policy',
install_dir : polkitpolicydir)
if install_sysconfdir_samples
install_data('homed.conf',
install_dir : pkgconfigfiledir)
endif
meson.add_install_script(sh, '-c',
ln_s.format(bindir / 'homectl',
bindir / 'systemd-home-fallback-shell'))
if install_sysconfdir_samples
install_data('homed.conf',
install_dir : pkgconfigfiledir)
endif
meson.add_install_script(sh, '-c',
ln_s.format(bindir / 'homectl',
bindir / 'systemd-home-fallback-shell'))

View File

@@ -1,25 +1,25 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('ENABLE_HOSTNAMED') != 1
subdir_done()
endif
executables += [
libexec_template + {
'name' : 'systemd-hostnamed',
'dbus' : true,
'conditions' : ['ENABLE_HOSTNAMED'],
'sources' : files('hostnamed.c'),
},
executable_template + {
'name' : 'hostnamectl',
'public' : true,
'conditions' : ['ENABLE_HOSTNAMED'],
'sources' : files('hostnamectl.c'),
},
]
if conf.get('ENABLE_HOSTNAMED') == 1
install_data('org.freedesktop.hostname1.conf',
install_dir : dbuspolicydir)
install_data('org.freedesktop.hostname1.service',
install_dir : dbussystemservicedir)
install_data('org.freedesktop.hostname1.policy',
install_dir : polkitpolicydir)
endif
install_data('org.freedesktop.hostname1.conf',
install_dir : dbuspolicydir)
install_data('org.freedesktop.hostname1.service',
install_dir : dbussystemservicedir)
install_data('org.freedesktop.hostname1.policy',
install_dir : polkitpolicydir)

View File

@@ -1,9 +1,12 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('HAVE_LIBCRYPTSETUP') != 1
subdir_done()
endif
executables += [
libexec_template + {
'name' : 'systemd-integritysetup',
'conditions' : ['HAVE_LIBCRYPTSETUP'],
'sources' : files(
'integrity-util.c',
'integritysetup.c',
@@ -12,7 +15,6 @@ executables += [
},
generator_template + {
'name' : 'systemd-integritysetup-generator',
'conditions' : ['HAVE_LIBCRYPTSETUP'],
'sources' : files(
'integrity-util.c',
'integritysetup-generator.c',

View File

@@ -1,17 +1,18 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('HAVE_KMOD') != 1
subdir_done()
endif
executables += [
libexec_template + {
'name' : 'systemd-modules-load',
'conditions' : ['HAVE_KMOD'],
'sources' : files('modules-load.c'),
'dependencies' : libkmod_cflags,
},
]
if conf.get('HAVE_KMOD') == 1
install_emptydir(modulesloaddir)
if install_sysconfdir
install_emptydir(sysconfdir / 'modules-load.d')
endif
install_emptydir(modulesloaddir)
if install_sysconfdir
install_emptydir(sysconfdir / 'modules-load.d')
endif

View File

@@ -1,5 +1,9 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('ENABLE_MOUNTFSD') != 1
subdir_done()
endif
systemd_mountwork_sources = files(
'mountwork.c',
)
@@ -12,12 +16,10 @@ systemd_mountfsd_sources = files(
executables += [
libexec_template + {
'name' : 'systemd-mountfsd',
'conditions' : ['ENABLE_MOUNTFSD'],
'sources' : systemd_mountfsd_sources,
},
libexec_template + {
'name' : 'systemd-mountwork',
'conditions' : ['ENABLE_MOUNTFSD'],
'sources' : systemd_mountwork_sources,
},
]

View File

@@ -1,5 +1,9 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('ENABLE_NSRESOURCED') != 1
subdir_done()
endif
subdir('bpf/userns_restrict')
systemd_nsresourcework_sources = files(
@@ -24,7 +28,7 @@ if conf.get('HAVE_VMLINUX_H') == 1
executables += [
test_template + {
'sources' : files('test-userns-restrict.c', 'userns-restrict.c') + userns_restrict_skel_h,
'conditions' : ['ENABLE_NSRESOURCED', 'HAVE_VMLINUX_H'],
'conditions' : ['HAVE_VMLINUX_H'],
'include_directories' : [ includes, userns_restrict_include ],
},
]
@@ -33,14 +37,12 @@ endif
executables += [
libexec_template + {
'name' : 'systemd-nsresourcework',
'conditions' : ['ENABLE_NSRESOURCED'],
'sources' : systemd_nsresourcework_sources,
'dependencies' : threads,
'include_directories' : [ includes, userns_restrict_include ],
},
libexec_template + {
'name' : 'systemd-nsresourced',
'conditions' : ['ENABLE_NSRESOURCED'],
'sources' : systemd_nsresourced_sources,
'dependencies' : threads,
'include_directories' : [ includes, userns_restrict_include ],

View File

@@ -1,12 +1,12 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('HAVE_OPENSSL') != 1 or conf.get('HAVE_TPM2') != 1
subdir_done()
endif
executables += [
libexec_template + {
'name' : 'systemd-pcrlock',
'conditions' : [
'HAVE_OPENSSL',
'HAVE_TPM2'
],
'sources' : files(
'pcrlock.c',
'pcrlock-firmware.c',
@@ -19,18 +19,16 @@ executables += [
},
]
if conf.get('HAVE_OPENSSL') == 1 and conf.get('HAVE_TPM2') == 1
install_data('pcrlock.d/350-action-efi-application.pcrlock', install_dir : pcrlockdir)
install_data('pcrlock.d/400-secureboot-separator.pcrlock.d/300-0x00000000.pcrlock', install_dir : pcrlockdir / '400-secureboot-separator.pcrlock.d')
install_data('pcrlock.d/400-secureboot-separator.pcrlock.d/600-0xffffffff.pcrlock', install_dir : pcrlockdir / '400-secureboot-separator.pcrlock.d')
install_data('pcrlock.d/500-separator.pcrlock.d/300-0x00000000.pcrlock', install_dir : pcrlockdir / '500-separator.pcrlock.d')
install_data('pcrlock.d/500-separator.pcrlock.d/600-0xffffffff.pcrlock', install_dir : pcrlockdir / '500-separator.pcrlock.d')
install_data('pcrlock.d/700-action-efi-exit-boot-services.pcrlock.d/300-present.pcrlock', install_dir : pcrlockdir / '700-action-efi-exit-boot-services.pcrlock.d')
install_data('pcrlock.d/700-action-efi-exit-boot-services.pcrlock.d/600-absent.pcrlock', install_dir : pcrlockdir / '700-action-efi-exit-boot-services.pcrlock.d')
install_data('pcrlock.d/750-enter-initrd.pcrlock', install_dir : pcrlockdir)
install_data('pcrlock.d/800-leave-initrd.pcrlock', install_dir : pcrlockdir)
install_data('pcrlock.d/850-sysinit.pcrlock', install_dir : pcrlockdir)
install_data('pcrlock.d/900-ready.pcrlock', install_dir : pcrlockdir)
install_data('pcrlock.d/950-shutdown.pcrlock', install_dir : pcrlockdir)
install_data('pcrlock.d/990-final.pcrlock', install_dir : pcrlockdir)
endif
install_data('pcrlock.d/350-action-efi-application.pcrlock', install_dir : pcrlockdir)
install_data('pcrlock.d/400-secureboot-separator.pcrlock.d/300-0x00000000.pcrlock', install_dir : pcrlockdir / '400-secureboot-separator.pcrlock.d')
install_data('pcrlock.d/400-secureboot-separator.pcrlock.d/600-0xffffffff.pcrlock', install_dir : pcrlockdir / '400-secureboot-separator.pcrlock.d')
install_data('pcrlock.d/500-separator.pcrlock.d/300-0x00000000.pcrlock', install_dir : pcrlockdir / '500-separator.pcrlock.d')
install_data('pcrlock.d/500-separator.pcrlock.d/600-0xffffffff.pcrlock', install_dir : pcrlockdir / '500-separator.pcrlock.d')
install_data('pcrlock.d/700-action-efi-exit-boot-services.pcrlock.d/300-present.pcrlock', install_dir : pcrlockdir / '700-action-efi-exit-boot-services.pcrlock.d')
install_data('pcrlock.d/700-action-efi-exit-boot-services.pcrlock.d/600-absent.pcrlock', install_dir : pcrlockdir / '700-action-efi-exit-boot-services.pcrlock.d')
install_data('pcrlock.d/750-enter-initrd.pcrlock', install_dir : pcrlockdir)
install_data('pcrlock.d/800-leave-initrd.pcrlock', install_dir : pcrlockdir)
install_data('pcrlock.d/850-sysinit.pcrlock', install_dir : pcrlockdir)
install_data('pcrlock.d/900-ready.pcrlock', install_dir : pcrlockdir)
install_data('pcrlock.d/950-shutdown.pcrlock', install_dir : pcrlockdir)
install_data('pcrlock.d/990-final.pcrlock', install_dir : pcrlockdir)

View File

@@ -1,5 +1,9 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('ENABLE_PORTABLED') != 1
subdir_done()
endif
systemd_portabled_sources = files(
'portable.c',
'portabled-bus.c',
@@ -22,7 +26,6 @@ executables += [
libexec_template + {
'name' : 'systemd-portabled',
'dbus' : true,
'conditions' : ['ENABLE_PORTABLED'],
'sources' : systemd_portabled_sources,
'link_with' : portabled_link_with,
'dependencies' : [
@@ -33,23 +36,20 @@ executables += [
executable_template + {
'name' : 'portablectl',
'public' : true,
'conditions' : ['ENABLE_PORTABLED'],
'sources' : files('portablectl.c'),
'link_with' : portabled_link_with,
'dependencies' : threads,
},
]
if conf.get('ENABLE_PORTABLED') == 1
install_data('org.freedesktop.portable1.conf',
install_dir : dbuspolicydir)
install_data('org.freedesktop.portable1.service',
install_dir : dbussystemservicedir)
install_data('org.freedesktop.portable1.policy',
install_dir : polkitpolicydir)
install_data('org.freedesktop.portable1.conf',
install_dir : dbuspolicydir)
install_data('org.freedesktop.portable1.service',
install_dir : dbussystemservicedir)
install_data('org.freedesktop.portable1.policy',
install_dir : polkitpolicydir)
install_data('profile/default/service.conf', install_dir : profiledir / 'default')
install_data('profile/nonetwork/service.conf', install_dir : profiledir / 'nonetwork')
install_data('profile/strict/service.conf', install_dir : profiledir / 'strict')
install_data('profile/trusted/service.conf', install_dir : profiledir / 'trusted')
endif
install_data('profile/default/service.conf', install_dir : profiledir / 'default')
install_data('profile/nonetwork/service.conf', install_dir : profiledir / 'nonetwork')
install_data('profile/strict/service.conf', install_dir : profiledir / 'strict')
install_data('profile/trusted/service.conf', install_dir : profiledir / 'trusted')

View File

@@ -1,9 +1,12 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('ENABLE_PSTORE') != 1
subdir_done()
endif
executables += [
libexec_template + {
'name' : 'systemd-pstore',
'conditions' : ['ENABLE_PSTORE'],
'sources' : files('pstore.c'),
'dependencies' : [
libacl,
@@ -15,7 +18,7 @@ executables += [
},
]
if conf.get('ENABLE_PSTORE') == 1 and install_sysconfdir_samples
if install_sysconfdir_samples
install_data('pstore.conf',
install_dir : pkgconfigfiledir)
endif

View File

@@ -1,10 +1,13 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('ENABLE_REPART') != 1
subdir_done()
endif
executables += [
executable_template + {
'name' : 'systemd-repart',
'public' : true,
'conditions' : ['ENABLE_REPART'],
'sources' : files('repart.c'),
'link_with' : [
libshared,
@@ -20,7 +23,6 @@ executables += [
executable_template + {
'name' : 'systemd-repart.standalone',
'public' : have_standalone_binaries,
'conditions' : ['ENABLE_REPART'],
'sources' : files('repart.c'),
'c_args' : '-DSTANDALONE',
'link_with' : [
@@ -40,14 +42,12 @@ executables += [
},
]
if conf.get('ENABLE_REPART') == 1
install_data('definitions/confext.repart.d/10-root.conf', install_dir : repartdefinitionsdir / 'confext.repart.d')
install_data('definitions/confext.repart.d/20-root-verity.conf', install_dir : repartdefinitionsdir / 'confext.repart.d')
install_data('definitions/confext.repart.d/30-root-verity-sig.conf', install_dir : repartdefinitionsdir / 'confext.repart.d')
install_data('definitions/portable.repart.d/10-root.conf', install_dir : repartdefinitionsdir / 'portable.repart.d')
install_data('definitions/portable.repart.d/20-root-verity.conf', install_dir : repartdefinitionsdir / 'portable.repart.d')
install_data('definitions/portable.repart.d/30-root-verity-sig.conf', install_dir : repartdefinitionsdir / 'portable.repart.d')
install_data('definitions/sysext.repart.d/10-root.conf', install_dir : repartdefinitionsdir / 'sysext.repart.d')
install_data('definitions/sysext.repart.d/20-root-verity.conf', install_dir : repartdefinitionsdir / 'sysext.repart.d')
install_data('definitions/sysext.repart.d/30-root-verity-sig.conf', install_dir : repartdefinitionsdir / 'sysext.repart.d')
endif
install_data('definitions/confext.repart.d/10-root.conf', install_dir : repartdefinitionsdir / 'confext.repart.d')
install_data('definitions/confext.repart.d/20-root-verity.conf', install_dir : repartdefinitionsdir / 'confext.repart.d')
install_data('definitions/confext.repart.d/30-root-verity-sig.conf', install_dir : repartdefinitionsdir / 'confext.repart.d')
install_data('definitions/portable.repart.d/10-root.conf', install_dir : repartdefinitionsdir / 'portable.repart.d')
install_data('definitions/portable.repart.d/20-root-verity.conf', install_dir : repartdefinitionsdir / 'portable.repart.d')
install_data('definitions/portable.repart.d/30-root-verity-sig.conf', install_dir : repartdefinitionsdir / 'portable.repart.d')
install_data('definitions/sysext.repart.d/10-root.conf', install_dir : repartdefinitionsdir / 'sysext.repart.d')
install_data('definitions/sysext.repart.d/20-root-verity.conf', install_dir : repartdefinitionsdir / 'sysext.repart.d')
install_data('definitions/sysext.repart.d/30-root-verity-sig.conf', install_dir : repartdefinitionsdir / 'sysext.repart.d')

View File

@@ -1,16 +1,18 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('ENABLE_SYSUSERS') != 1
subdir_done()
endif
executables += [
executable_template + {
'name' : 'systemd-sysusers',
'public' : true,
'conditions' : ['ENABLE_SYSUSERS'],
'sources' : files('sysusers.c'),
},
executable_template + {
'name' : 'systemd-sysusers.standalone',
'public' : have_standalone_binaries,
'conditions' : ['ENABLE_SYSUSERS'],
'sources' : files('sysusers.c'),
'c_args' : '-DSTANDALONE',
'link_with' : [

View File

@@ -13,7 +13,6 @@ executables += [
libopenssl,
],
},
generator_template + {
'name' : 'systemd-tpm2-generator',
'sources' : files('tpm2-generator.c'),

View File

@@ -1,15 +1,17 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('HAVE_LIBCRYPTSETUP') != 1
subdir_done()
endif
executables += [
libexec_template + {
'name' : 'systemd-veritysetup',
'conditions' : ['HAVE_LIBCRYPTSETUP'],
'sources' : files('veritysetup.c'),
'dependencies' : libcryptsetup,
},
generator_template + {
'name' : 'systemd-veritysetup-generator',
'conditions' : ['HAVE_LIBCRYPTSETUP'],
'sources' : files('veritysetup-generator.c'),
},
]

View File

@@ -1,5 +1,9 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('ENABLE_VMSPAWN') != 1
subdir_done()
endif
libvmspawn_core_sources = files(
'vmspawn-settings.c',
'vmspawn-util.c',
@@ -7,6 +11,7 @@ libvmspawn_core_sources = files(
'vmspawn-mount.c',
'vmspawn-register.c',
)
libvmspawn_core = static_library(
'vmspawn-core',
libvmspawn_core_sources,
@@ -27,13 +32,11 @@ executables += [
executable_template + {
'name' : 'systemd-vmspawn',
'public' : true,
'conditions': ['ENABLE_VMSPAWN'],
'sources' : files('vmspawn.c'),
'link_with' : vmspawn_libs,
'dependencies' : [libblkid]
},
vmspawn_test_template + {
'conditions': ['ENABLE_VMSPAWN'],
'sources' : files('test-vmspawn-util.c'),
},
]