]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: move declarations of hwdb, sysusers, and tmpfiles
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 25 Jun 2023 18:28:32 +0000 (03:28 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 1 Aug 2023 12:37:31 +0000 (21:37 +0900)
meson.build
src/hwdb/meson.build [new file with mode: 0644]
src/sysusers/meson.build [new file with mode: 0644]
src/tmpfiles/meson.build

index 9be67028dcba801406fd0082a6fd4e9373e2e35b..afcdb20f022f4ad7c6dfdb751bd1ce5da3cafdf2 100644 (file)
@@ -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 (file)
index 0000000..385ed85
--- /dev/null
@@ -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 (file)
index 0000000..fcb291d
--- /dev/null
@@ -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,
+        },
+]
index d0a1359501e2f51c5a438ed858141f0c4a3b99c7..892c09b168b40c0d26422f00fcb7dd7b93d620bd 100644 (file)
@@ -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(