From 6fab49e4ff0dff684b60e8ec0bd3544f9cb38f41 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 26 Jun 2023 03:28:32 +0900 Subject: [PATCH] meson: move declarations of hwdb, sysusers, and tmpfiles --- meson.build | 69 +++++----------------------------------- src/hwdb/meson.build | 12 +++++++ src/sysusers/meson.build | 25 +++++++++++++++ src/tmpfiles/meson.build | 26 +++++++++++++++ 4 files changed, 71 insertions(+), 61 deletions(-) create mode 100644 src/hwdb/meson.build create mode 100644 src/sysusers/meson.build diff --git a/meson.build b/meson.build index 9be67028dcb..afcdb20f022 100644 --- a/meson.build +++ b/meson.build @@ -2400,6 +2400,7 @@ subdir('src/gpt-auto-generator') subdir('src/hibernate-resume') subdir('src/home') subdir('src/hostname') +subdir('src/hwdb') subdir('src/id128') subdir('src/import') subdir('src/initctl') @@ -2441,6 +2442,7 @@ subdir('src/sysext') subdir('src/system-update-generator') subdir('src/systemctl') subdir('src/sysupdate') +subdir('src/sysusers') subdir('src/sysv-generator') subdir('src/timedate') subdir('src/timesync') @@ -2621,39 +2623,17 @@ if want_tests != 'false' endif if enable_sysusers - exe = executable( - 'systemd-sysusers', - 'src/sysusers/sysusers.c', - include_directories : includes, - link_with : [libshared], - dependencies : [userspace], - install_rpath : pkglibdir, - install : true) - public_programs += exe - if want_tests != 'false' + exe = executables_by_name.get('systemd-sysusers') test('test-sysusers', test_sysusers_sh, # https://github.com/mesonbuild/meson/issues/2681 args : exe.full_path()) endif - exe = executable( - 'systemd-sysusers.standalone', - 'src/sysusers/sysusers.c', - include_directories : includes, - c_args : '-DSTANDALONE', - link_with : [libshared_static, - libbasic, - libbasic_gcrypt, - libsystemd_static], - dependencies : [userspace], - build_by_default: have_standalone_binaries, - install : have_standalone_binaries) if have_standalone_binaries - public_programs += exe - if want_tests != 'false' + exe = executables_by_name.get('systemd-sysusers.standalone') test('test-sysusers.standalone', test_sysusers_sh, # https://github.com/mesonbuild/meson/issues/2681 @@ -2663,41 +2643,17 @@ if enable_sysusers endif if conf.get('ENABLE_TMPFILES') == 1 - exe = executable( - 'systemd-tmpfiles', - systemd_tmpfiles_sources, - include_directories : includes, - link_with : [libshared], - dependencies : [libacl, - userspace], - install_rpath : pkglibdir, - install : true) - public_programs += exe - if want_tests != 'false' + exe = executables_by_name.get('systemd-tmpfiles') test('test-systemd-tmpfiles', test_systemd_tmpfiles_py, # https://github.com/mesonbuild/meson/issues/2681 args : exe.full_path()) endif - exe = executable( - 'systemd-tmpfiles.standalone', - systemd_tmpfiles_sources, - include_directories : includes, - c_args : '-DSTANDALONE', - link_with : [libshared_static, - libbasic, - libbasic_gcrypt, - libsystemd_static], - dependencies : [libacl, - userspace], - build_by_default: have_standalone_binaries, - install : have_standalone_binaries) if have_standalone_binaries - public_programs += exe - if want_tests != 'false' + exe = executables_by_name.get('systemd-tmpfiles.standalone') test('test-systemd-tmpfiles.standalone', test_systemd_tmpfiles_py, # https://github.com/mesonbuild/meson/issues/2681 @@ -2707,21 +2663,12 @@ if conf.get('ENABLE_TMPFILES') == 1 endif if conf.get('ENABLE_HWDB') == 1 - systemd_hwdb = executable( - 'systemd-hwdb', - 'src/hwdb/hwdb.c', - include_directories : includes, - link_with : udev_link_with, - dependencies : [userspace], - install_rpath : udev_rpath, - install : true) - public_programs += systemd_hwdb - if want_tests != 'false' + exe = executables_by_name.get('systemd-hwdb') test('hwdb-test', hwdb_test_sh, suite : 'dist', - args : [systemd_hwdb.full_path()], + args : exe.full_path(), timeout : 90) endif endif diff --git a/src/hwdb/meson.build b/src/hwdb/meson.build new file mode 100644 index 00000000000..385ed854d62 --- /dev/null +++ b/src/hwdb/meson.build @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +executables += [ + executable_template + { + 'name' : 'systemd-hwdb', + 'public' : true, + 'conditions' : ['ENABLE_HWDB'], + 'sources' : files('hwdb.c'), + 'link_with' : udev_link_with, + 'install_rpath' : udev_rpath, + }, +] diff --git a/src/sysusers/meson.build b/src/sysusers/meson.build new file mode 100644 index 00000000000..fcb291d02c2 --- /dev/null +++ b/src/sysusers/meson.build @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +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' : [ + libbasic, + libbasic_gcrypt, + libshared_static, + libsystemd_static, + ], + 'build_by_default' : have_standalone_binaries, + 'install' : have_standalone_binaries, + }, +] diff --git a/src/tmpfiles/meson.build b/src/tmpfiles/meson.build index d0a1359501e..892c09b168b 100644 --- a/src/tmpfiles/meson.build +++ b/src/tmpfiles/meson.build @@ -5,6 +5,32 @@ systemd_tmpfiles_sources = files( 'offline-passwd.c', ) +executables += [ + executable_template + { + 'name' : 'systemd-tmpfiles', + 'public' : true, + 'conditions' : ['ENABLE_TMPFILES'], + 'sources' : systemd_tmpfiles_sources, + 'dependencies' : libacl, + }, + executable_template + { + 'name' : 'systemd-tmpfiles.standalone', + 'public' : have_standalone_binaries, + 'conditions' : ['ENABLE_TMPFILES'], + 'sources' : systemd_tmpfiles_sources, + 'c_args' : '-DSTANDALONE', + 'link_with' : [ + libbasic, + libbasic_gcrypt, + libshared_static, + libsystemd_static, + ], + 'dependencies' : libacl, + 'build_by_default' : have_standalone_binaries, + 'install' : have_standalone_binaries, + }, +] + tests += [ { 'sources' : files(