diff --git a/meson.build b/meson.build index 4b68ccfeddf..36453bfcd1e 100644 --- a/meson.build +++ b/meson.build @@ -2377,6 +2377,13 @@ subdir('src/busctl') subdir('src/coredump') subdir('src/cryptenroll') subdir('src/cryptsetup') +subdir('src/debug-generator') +subdir('src/dissect') +subdir('src/environment-d-generator') +subdir('src/fstab-generator') +subdir('src/getty-generator') +subdir('src/gpt-auto-generator') +subdir('src/hibernate-resume') subdir('src/home') subdir('src/hostname') subdir('src/import') @@ -2397,13 +2404,16 @@ subdir('src/portable') subdir('src/pstore') subdir('src/resolve') subdir('src/rpm') +subdir('src/run-generator') subdir('src/shutdown') +subdir('src/socket-activate') subdir('src/sysext') subdir('src/systemctl') subdir('src/sysupdate') subdir('src/timedate') subdir('src/timesync') subdir('src/tmpfiles') +subdir('src/user-sessions') subdir('src/userdb') subdir('src/xdg-autostart-generator') @@ -2533,120 +2543,15 @@ endforeach ############################################################ -exe = executable( - 'systemd-analyze', - systemd_analyze_sources, - include_directories : core_includes, - link_with : [libcore, - libshared], - dependencies : [libseccomp, - userspace], - install_rpath : pkglibdir, - install : conf.get('ENABLE_ANALYZE') == 1) -if conf.get('ENABLE_ANALYZE') == 1 - public_programs += exe -endif - if want_tests != 'false' + exe = executables_by_name.get('systemd-analyze') test('test-compare-versions', test_compare_versions_sh, args : exe.full_path()) endif -executable( - 'systemd-journald', - systemd_journald_sources, - include_directories : includes, - link_with : [libjournal_core, - libshared], - dependencies : [liblz4, - libselinux, - libxz, - libzstd, - threads, - userspace], - install_rpath : pkglibdir, - install : true, - install_dir : libexecdir) - -public_programs += executable( - 'systemd-cat', - systemd_cat_sources, - include_directories : includes, - link_with : [libjournal_core, - libshared], - dependencies : [threads, - userspace], - install_rpath : pkglibdir, - install : true) - -if get_option('link-journalctl-shared') - journalctl_link_with = [libshared] -else - journalctl_link_with = [libsystemd_static, - libshared_static, - libbasic_gcrypt] -endif - -public_programs += executable( - 'journalctl', - journalctl_sources, - include_directories : includes, - link_with : [journalctl_link_with], - dependencies : [libdl, - liblz4, - libxz, - libzstd, - threads, - userspace], - install_rpath : pkglibdir, - install : true) - -executable( - 'systemd-getty-generator', - 'src/getty-generator/getty-generator.c', - include_directories : includes, - link_with : [libshared], - dependencies : userspace, - install_rpath : pkglibdir, - install : true, - install_dir : systemgeneratordir) - -executable( - 'systemd-debug-generator', - 'src/debug-generator/debug-generator.c', - include_directories : includes, - link_with : [libshared], - dependencies : userspace, - install_rpath : pkglibdir, - install : true, - install_dir : systemgeneratordir) - -executable( - 'systemd-run-generator', - 'src/run-generator/run-generator.c', - include_directories : includes, - link_with : [libshared], - dependencies : userspace, - install_rpath : pkglibdir, - install : true, - install_dir : systemgeneratordir) - -exe = executable( - 'systemd-fstab-generator', - 'src/fstab-generator/fstab-generator.c', - include_directories : includes, - link_with : [libshared], - dependencies : userspace, - install_rpath : pkglibdir, - install : true, - install_dir : systemgeneratordir) - -meson.add_install_script(meson_make_symlink, - systemgeneratordir / 'systemd-fstab-generator', - libexecdir / 'systemd-sysroot-fstab-check') - if want_tests != 'false' + exe = executables_by_name.get('systemd-fstab-generator') test('test-fstab-generator', test_fstab_generator_sh, # https://github.com/mesonbuild/meson/issues/2681 @@ -2655,289 +2560,16 @@ if want_tests != 'false' depends : exe) endif -if conf.get('ENABLE_ENVIRONMENT_D') == 1 - executable( - '30-systemd-environment-d-generator', - 'src/environment-d-generator/environment-d-generator.c', - include_directories : includes, - link_with : [libshared], - dependencies : userspace, - install_rpath : pkglibdir, - install : true, - install_dir : userenvgeneratordir) - - meson.add_install_script(meson_make_symlink, - sysconfdir / 'environment', - environmentdir / '99-environment.conf') -endif - -if conf.get('ENABLE_HIBERNATE') == 1 - executable( - 'systemd-hibernate-resume-generator', - 'src/hibernate-resume/hibernate-resume-generator.c', - include_directories : includes, - link_with : [libshared], - dependencies : userspace, - install_rpath : pkglibdir, - install : true, - install_dir : systemgeneratordir) - - executable( - 'systemd-hibernate-resume', - 'src/hibernate-resume/hibernate-resume.c', - include_directories : includes, - link_with : [libshared], - dependencies : userspace, - install_rpath : pkglibdir, - install : true, - install_dir : libexecdir) -endif - -if conf.get('HAVE_BLKID') == 1 - executable( - 'systemd-gpt-auto-generator', - 'src/gpt-auto-generator/gpt-auto-generator.c', - include_directories : includes, - link_with : [libshared], - dependencies : [libblkid, - userspace], - install_rpath : pkglibdir, - install : true, - install_dir : systemgeneratordir) - - public_programs += executable( - 'systemd-dissect', - 'src/dissect/dissect.c', - include_directories : includes, - link_with : [libshared], - dependencies : [userspace], - install_rpath : pkglibdir, - install : true) - - meson.add_install_script(meson_make_symlink, - bindir / 'systemd-dissect', - sbindir / 'mount.ddi') -endif - -if conf.get('ENABLE_RESOLVE') == 1 - dbus_programs += executable( - 'systemd-resolved', - systemd_resolved_sources, - include_directories : resolve_includes, - link_with : [libshared, - libbasic_gcrypt, - libsystemd_resolve_core], - dependencies : [systemd_resolved_dependencies, - userspace], - install_rpath : pkglibdir, - install : true, - install_dir : libexecdir) - - public_programs += executable( - 'resolvectl', - resolvectl_sources, - include_directories : includes, - link_with : [libshared, - libbasic_gcrypt, - libsystemd_resolve_core], - dependencies : [lib_openssl_or_gcrypt, - libidn, - libm, - threads, - userspace], - install_rpath : pkglibdir, - install : true) - - meson.add_install_script(meson_make_symlink, - bindir / 'resolvectl', - sbindir / 'resolvconf') - - meson.add_install_script(meson_make_symlink, - bindir / 'resolvectl', - bindir / 'systemd-resolve') -endif - -if conf.get('ENABLE_LOGIND') == 1 - dbus_programs += executable( - 'systemd-logind', - systemd_logind_sources, - include_directories : includes, - link_with : [liblogind_core, - libshared], - dependencies : [libacl, - threads, - userspace], - install_rpath : pkglibdir, - install : true, - install_dir : libexecdir) - - public_programs += executable( - 'loginctl', - loginctl_sources, - include_directories : includes, - link_with : [libshared], - dependencies : [liblz4, - libxz, - libzstd, - threads, - userspace], - install_rpath : pkglibdir, - install : true) - - public_programs += executable( - 'systemd-inhibit', - 'src/login/inhibit.c', - include_directories : includes, - link_with : [libshared], - dependencies : [userspace], - install_rpath : pkglibdir, - install : true) - - if conf.get('HAVE_PAM') == 1 - version_script_arg = project_source_root / pam_systemd_sym - pam_systemd = shared_library( - 'pam_systemd', - pam_systemd_c, - name_prefix : '', - include_directories : includes, - link_args : ['-shared', - '-Wl,--version-script=' + version_script_arg], - link_with : [libsystemd_static, - libshared_static], - dependencies : [libpam_misc, - libpam, - threads, - userspace], - link_depends : pam_systemd_sym, - install : true, - install_tag : 'pam', - install_dir : pamlibdir) - - if want_tests != 'false' - test('dlopen-pam_systemd', - test_dlopen, - # path to dlopen must include a slash - args : pam_systemd.full_path(), - depends : pam_systemd) - endif - endif - - executable( - 'systemd-user-runtime-dir', - user_runtime_dir_sources, - include_directories : includes, - link_with : [libshared], - dependencies : userspace, - install_rpath : pkglibdir, - install : true, - install_dir : libexecdir) -endif - -if conf.get('HAVE_PAM') == 1 - executable( - 'systemd-user-sessions', - 'src/user-sessions/user-sessions.c', - include_directories : includes, - link_with : [libshared], - dependencies : userspace, - install_rpath : pkglibdir, - install : true, - install_dir : libexecdir) -endif - if conf.get('HAVE_BLKID') == 1 and conf.get('ENABLE_BOOTLOADER') == 1 - if get_option('link-boot-shared') - boot_link_with = [libshared] - else - boot_link_with = [libsystemd_static, libshared_static] - endif - - exe = executable( - 'bootctl', - bootctl_sources, - include_directories : includes, - link_with : [boot_link_with], - dependencies : [libblkid, - userspace], - install_rpath : pkglibdir, - install : true) - public_programs += exe - if want_tests != 'false' + exe = executables_by_name.get('bootctl') test('test-bootctl-json', test_bootctl_json_sh, args : exe.full_path(), depends : exe) endif - - public_programs += executable( - 'systemd-bless-boot', - 'src/boot/bless-boot.c', - include_directories : includes, - link_with : [boot_link_with], - dependencies : [libblkid, - userspace], - install_rpath : pkglibdir, - install : true, - install_dir : libexecdir) - - executable( - 'systemd-bless-boot-generator', - 'src/boot/bless-boot-generator.c', - include_directories : includes, - link_with : [boot_link_with], - dependencies : userspace, - install_rpath : pkglibdir, - install : true, - install_dir : systemgeneratordir) - - if conf.get('HAVE_OPENSSL') == 1 and conf.get('HAVE_TPM2') == 1 - executable( - 'systemd-measure', - 'src/boot/measure.c', - include_directories : includes, - link_with : [libshared], - dependencies : [libopenssl, - userspace], - install_rpath : pkglibdir, - install : true, - install_dir : libexecdir) - executable( - 'systemd-pcrphase', - 'src/boot/pcrphase.c', - include_directories : includes, - link_with : [libshared], - dependencies : [libblkid, - libopenssl, - tpm2, - userspace], - install_rpath : pkglibdir, - install : true, - install_dir : libexecdir) - endif endif -executable( - 'systemd-boot-check-no-failures', - 'src/boot/boot-check-no-failures.c', - include_directories : includes, - link_with : [libshared], - dependencies : [libblkid, - userspace], - install_rpath : pkglibdir, - install : true, - install_dir : libexecdir) - -public_programs += executable( - 'systemd-socket-activate', - 'src/socket-activate/socket-activate.c', - include_directories : includes, - link_with : [libshared], - dependencies : [threads, - userspace], - install_rpath : pkglibdir, - install : true) - systemctl = executable( 'systemctl', systemctl_sources, diff --git a/src/analyze/meson.build b/src/analyze/meson.build index 911c0bc3ed2..2bbcf26d1cb 100644 --- a/src/analyze/meson.build +++ b/src/analyze/meson.build @@ -33,6 +33,21 @@ systemd_analyze_sources = files( 'analyze.c', ) +executables += [ + executable_template + { + 'name' : 'systemd-analyze', + 'public' : conf.get('ENABLE_ANALYZE') == 1, + 'sources' : systemd_analyze_sources, + 'include_directories' : core_includes, + 'link_with' : [ + libcore, + libshared, + ], + 'dependencies' : libseccomp, + 'install' : conf.get('ENABLE_ANALYZE') == 1, + }, +] + tests += [ { 'sources' : files( diff --git a/src/boot/meson.build b/src/boot/meson.build index eb621c88d77..fdccb2a428a 100644 --- a/src/boot/meson.build +++ b/src/boot/meson.build @@ -11,3 +11,76 @@ bootctl_sources = files( 'bootctl-util.c', 'bootctl.c', ) + +if get_option('link-boot-shared') + boot_link_with = [libshared] +else + boot_link_with = [ + libshared_static, + libsystemd_static, + ] +endif + +executables += [ + executable_template + { + 'name' : 'bootctl', + 'public' : true, + 'conditions' : [ + 'HAVE_BLKID', + 'ENABLE_BOOTLOADER', + ], + 'sources' : bootctl_sources, + 'link_with' : boot_link_with, + 'dependencies' : libblkid, + }, + libexec_template + { + 'name' : 'systemd-bless-boot', + 'public' : true, + 'conditions' : [ + 'HAVE_BLKID', + 'ENABLE_BOOTLOADER', + ], + 'sources' : files('bless-boot.c'), + 'link_with' : boot_link_with, + 'dependencies' : libblkid, + }, + generator_template + { + 'name' : 'systemd-bless-boot-generator', + 'conditions' : [ + 'HAVE_BLKID', + 'ENABLE_BOOTLOADER', + ], + 'sources' : files('bless-boot-generator.c'), + 'link_with' : boot_link_with, + }, + libexec_template + { + 'name' : 'systemd-measure', + 'conditions' : [ + 'HAVE_BLKID', + 'ENABLE_BOOTLOADER', + 'HAVE_OPENSSL', + 'HAVE_TPM2', + ], + 'sources' : files('measure.c'), + 'dependencies' : libopenssl, + }, + libexec_template + { + 'name' : 'systemd-pcrphase', + 'conditions' : [ + 'HAVE_BLKID', + 'ENABLE_BOOTLOADER', + 'HAVE_OPENSSL', + 'HAVE_TPM2', + ], + 'sources' : files('pcrphase.c'), + 'dependencies' : [ + libblkid, + libopenssl, + tpm2, + ], + }, + libexec_template + { + 'name' : 'systemd-boot-check-no-failures', + 'sources' : files('boot-check-no-failures.c'), + }, +] diff --git a/src/debug-generator/meson.build b/src/debug-generator/meson.build new file mode 100644 index 00000000000..33cb3446dec --- /dev/null +++ b/src/debug-generator/meson.build @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +executables += [ + generator_template + { + 'name' : 'systemd-debug-generator', + 'sources' : files('debug-generator.c'), + }, +] diff --git a/src/dissect/meson.build b/src/dissect/meson.build new file mode 100644 index 00000000000..742b1377bce --- /dev/null +++ b/src/dissect/meson.build @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +executables += [ + executable_template + { + 'name' : 'systemd-dissect', + 'public' : true, + 'conditions' : ['HAVE_BLKID'], + 'sources' : files('dissect.c'), + }, +] + +if conf.get('HAVE_BLKID') == 1 + meson.add_install_script(meson_make_symlink, + bindir / 'systemd-dissect', + sbindir / 'mount.ddi') +endif diff --git a/src/environment-d-generator/meson.build b/src/environment-d-generator/meson.build new file mode 100644 index 00000000000..6ff82b2a325 --- /dev/null +++ b/src/environment-d-generator/meson.build @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +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 + meson.add_install_script(meson_make_symlink, + sysconfdir / 'environment', + environmentdir / '99-environment.conf') +endif diff --git a/src/fstab-generator/meson.build b/src/fstab-generator/meson.build new file mode 100644 index 00000000000..11de6ffd809 --- /dev/null +++ b/src/fstab-generator/meson.build @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +executables += [ + generator_template + { + 'name' : 'systemd-fstab-generator', + 'sources' : files('fstab-generator.c'), + }, +] + +meson.add_install_script(meson_make_symlink, + systemgeneratordir / 'systemd-fstab-generator', + libexecdir / 'systemd-sysroot-fstab-check') diff --git a/src/getty-generator/meson.build b/src/getty-generator/meson.build new file mode 100644 index 00000000000..44eeb869a3c --- /dev/null +++ b/src/getty-generator/meson.build @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +executables += [ + generator_template + { + 'name' : 'systemd-getty-generator', + 'sources' : files('getty-generator.c'), + }, +] diff --git a/src/gpt-auto-generator/meson.build b/src/gpt-auto-generator/meson.build new file mode 100644 index 00000000000..c7cbfbb3f3e --- /dev/null +++ b/src/gpt-auto-generator/meson.build @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +executables += [ + generator_template + { + 'name' : 'systemd-gpt-auto-generator', + 'conditions' : ['HAVE_BLKID'], + 'sources' : files('gpt-auto-generator.c'), + 'dependencies' : libblkid, + }, +] diff --git a/src/hibernate-resume/meson.build b/src/hibernate-resume/meson.build new file mode 100644 index 00000000000..b14ea356c5d --- /dev/null +++ b/src/hibernate-resume/meson.build @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +executables += [ + generator_template + { + 'name' : 'systemd-hibernate-resume-generator', + 'conditions' : ['ENABLE_HIBERNATE'], + 'sources' : files('hibernate-resume-generator.c'), + }, + libexec_template + { + 'name' : 'systemd-hibernate-resume', + 'conditions' : ['ENABLE_HIBERNATE'], + 'sources' : files('hibernate-resume.c'), + }, +] diff --git a/src/journal/meson.build b/src/journal/meson.build index a6837d23c54..0c996847707 100644 --- a/src/journal/meson.build +++ b/src/journal/meson.build @@ -31,13 +31,56 @@ libjournal_core = static_library( journal_includes = [includes, include_directories('.')] -systemd_journald_sources = files( - 'journald.c', -) +if get_option('link-journalctl-shared') + journalctl_link_with = [libshared] +else + journalctl_link_with = [ + libbasic_gcrypt, + libshared_static, + libsystemd_static, + ] +endif -systemd_cat_sources = files('cat.c') - -journalctl_sources = files('journalctl.c') +executables += [ + libexec_template + { + 'name' : 'systemd-journald', + 'sources' : files('journald.c'), + 'link_with' : [ + libjournal_core, + libshared, + ], + 'dependencies' : [ + liblz4, + libselinux, + libxz, + libzstd, + threads, + ], + }, + executable_template + { + 'name' : 'systemd-cat', + 'public' : true, + 'sources' : files('cat.c'), + 'link_with' : [ + libjournal_core, + libshared, + ], + 'dependencies' : threads, + }, + executable_template + { + 'name' : 'journalctl', + 'public' : true, + 'sources' : files('journalctl.c'), + 'link_with' : journalctl_link_with, + 'dependencies' : [ + libdl, + liblz4, + libxz, + libzstd, + threads, + ], + }, +] if install_sysconfdir_samples install_data('journald.conf', diff --git a/src/login/meson.build b/src/login/meson.build index 473cf340893..c641cc700e0 100644 --- a/src/login/meson.build +++ b/src/login/meson.build @@ -44,10 +44,57 @@ loginctl_sources = files( 'sysfs-show.c', ) -user_runtime_dir_sources = files('user-runtime-dir.c') +executables += [ + libexec_template + { + 'name' : 'systemd-logind', + 'dbus' : true, + 'conditions' : ['ENABLE_LOGIND'], + 'sources' : systemd_logind_sources, + 'link_with' : [ + liblogind_core, + libshared, + ], + 'dependencies' : [ + libacl, + threads, + ], + }, + executable_template + { + 'name' : 'loginctl', + 'public' : true, + 'conditions' : ['ENABLE_LOGIND'], + 'sources' : loginctl_sources, + 'dependencies' : [ + liblz4, + libxz, + libzstd, + threads, + ], + }, + executable_template + { + 'name' : 'systemd-inhibit', + 'public' : true, + 'conditions' : ['ENABLE_LOGIND'], + 'sources' : files('inhibit.c'), + }, + libexec_template + { + 'name' : 'systemd-user-runtime-dir', + 'conditions' : ['ENABLE_LOGIND'], + 'sources' : files('user-runtime-dir.c'), + }, +] -pam_systemd_sym = 'src/login/pam_systemd.sym' -pam_systemd_c = files('pam_systemd.c') +modules += [ + pam_template + { + 'name' : 'pam_systemd', + 'conditions' : [ + 'ENABLE_LOGIND', + 'HAVE_PAM', + ], + 'sources' : files('pam_systemd.c'), + 'link_depends' : files('pam_systemd.sym'), + }, +] enable_logind = conf.get('ENABLE_LOGIND') == 1 diff --git a/src/resolve/meson.build b/src/resolve/meson.build index 576c7fc9a19..4cc2459b21f 100644 --- a/src/resolve/meson.build +++ b/src/resolve/meson.build @@ -117,6 +117,38 @@ if conf.get('ENABLE_DNS_OVER_TLS') == 1 endif endif +link_with = [ + libbasic_gcrypt, + libshared, + libsystemd_resolve_core, +] + +executables += [ + libexec_template + { + 'name' : 'systemd-resolved', + 'dbus' : true, + 'conditions' : ['ENABLE_RESOLVE'], + 'sources' : systemd_resolved_sources + + files('resolved.c'), + 'include_directories' : resolve_includes, + 'link_with' : link_with, + 'dependencies' : systemd_resolved_dependencies, + }, + executable_template + { + 'name' : 'resolvectl', + 'public' : true, + 'conditions' : ['ENABLE_RESOLVE'], + 'sources' : resolvectl_sources, + 'link_with' : link_with, + 'dependencies' : [ + lib_openssl_or_gcrypt, + libidn, + libm, + threads, + ], + }, +] + if conf.get('ENABLE_RESOLVE') == 1 install_data('org.freedesktop.resolve1.conf', install_dir : dbuspolicydir) @@ -126,6 +158,14 @@ if conf.get('ENABLE_RESOLVE') == 1 install_dir : polkitpolicydir) install_data('resolv.conf', install_dir : libexecdir) + + meson.add_install_script(meson_make_symlink, + bindir / 'resolvectl', + sbindir / 'resolvconf') + + meson.add_install_script(meson_make_symlink, + bindir / 'resolvectl', + bindir / 'systemd-resolve') endif custom_target( @@ -210,5 +250,3 @@ fuzzers += [ 'base' : fuzzer_resolve_base, }, ] - -systemd_resolved_sources += files('resolved.c') diff --git a/src/run-generator/meson.build b/src/run-generator/meson.build new file mode 100644 index 00000000000..9a4e4ad4a6b --- /dev/null +++ b/src/run-generator/meson.build @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +executables += [ + generator_template + { + 'name' : 'systemd-run-generator', + 'sources' : files('run-generator.c'), + }, +] diff --git a/src/socket-activate/meson.build b/src/socket-activate/meson.build new file mode 100644 index 00000000000..a4d18b58a8d --- /dev/null +++ b/src/socket-activate/meson.build @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +executables += [ + executable_template + { + 'name' : 'systemd-socket-activate', + 'public' : true, + 'sources' : files('socket-activate.c'), + 'dependencies' : threads, + }, +] diff --git a/src/user-sessions/meson.build b/src/user-sessions/meson.build new file mode 100644 index 00000000000..938e5267ef5 --- /dev/null +++ b/src/user-sessions/meson.build @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +executables += [ + libexec_template + { + 'name' : 'systemd-user-sessions', + 'conditions' : ['HAVE_PAM'], + 'sources' : files('user-sessions.c'), + }, +]