]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: add install tags for udev and hwdb
authorLuca Boccassi <luca.boccassi@gmail.com>
Thu, 9 Jan 2025 21:37:26 +0000 (21:37 +0000)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 10 Jan 2025 06:15:13 +0000 (15:15 +0900)
Allows building and installing them individually, like
other existing components

.github/workflows/build_test.sh
.github/workflows/unit_tests.sh
hwdb.d/meson.build
rules.d/meson.build
src/hwdb/meson.build
src/udev/meson.build
units/meson.build

index 113af704a80208c3d565360264c21f66ce73c0eb..986e30c595da39ff0226611ac38076dc9f1ed79d 100755 (executable)
@@ -135,6 +135,9 @@ $CC --version
 meson --version
 ninja --version
 
+# TODO: drop once minimum meson version is bumped to 0.62 or newer
+find . -type f -name meson.build -exec sed -i 's/install_emptydir(\(.*\), install_tag : .*)/install_emptydir(\1)/g' '{}' '+'
+
 for args in "${ARGS[@]}"; do
     SECONDS=0
 
index 4433d847ce264089d5d13317aab2d1609e53176c..7275a72dc5fa3c75cf5a7680e01c0da3efb543e9 100755 (executable)
@@ -32,6 +32,8 @@ function info() {
 }
 
 function run_meson() {
+    # TODO: drop once minimum meson version is bumped to 0.62 or newer
+    find . -type f -name meson.build -exec sed -i 's/install_emptydir(\(.*\), install_tag : .*)/install_emptydir(\1)/g' '{}' '+'
     if ! meson "$@"; then
         find . -type f -name meson-log.txt -exec cat '{}' +
         return 1
index b69b6d8f251854f822163a253d9358dc9f25a647..e7dfd0bea2d5039d7774a3d2b83c7c9ddf423009 100644 (file)
@@ -45,17 +45,20 @@ if conf.get('ENABLE_HWDB') == 1
                 command : make_autosuspend_rules_py,
                 capture : true,
                 install : true,
-                install_dir: udevhwdbdir)
+                install_dir: udevhwdbdir,
+                install_tag: 'hwdb')
 
         install_data(hwdb_files_notest,
                      hwdb_files_test,
-                     install_dir : udevhwdbdir)
+                     install_dir : udevhwdbdir,
+                     install_tag: 'hwdb')
 
         if install_sysconfdir
-                install_emptydir(sysconfdir / 'udev/hwdb.d')
+                install_emptydir(sysconfdir / 'udev/hwdb.d', install_tag : 'hwdb')
 
                 meson.add_install_script(sh, '-c',
-                                         'test -n "$DESTDIR" || @0@/systemd-hwdb update'.format(bindir))
+                                         'test -n "$DESTDIR" || @0@/systemd-hwdb update'.format(bindir),
+                                         install_tag: 'hwdb')
         endif
 
         if want_tests != 'false'
index 61165fd86f49af5332d7ecdab85342a594282d23..e8eb26c57535118bae9342b1585fb5b145c57ec8 100644 (file)
@@ -49,7 +49,8 @@ all_rules = []
 foreach tuple : rules
         if tuple.length() == 1 or tuple[1]
                 install_data(tuple[0],
-                             install_dir : udevrulesdir)
+                             install_dir : udevrulesdir,
+                             install_tag : 'udev')
                 all_rules += tuple[0]
         endif
 endforeach
@@ -76,7 +77,8 @@ foreach tuple : rules_in
                 output: tuple[0],
                 command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
                 install : want,
-                install_dir : udevrulesdir)
+                install_dir : udevrulesdir,
+                install_tag : 'udev')
 
         if want
                 all_rules += rule
index 385ed854d62f197c23270102bcd4563caa3d5ceb..57ace3ad44d4d3b9c8f61ee70f3ccc8375e92b44 100644 (file)
@@ -8,5 +8,6 @@ executables += [
                 'sources' : files('hwdb.c'),
                 'link_with' : udev_link_with,
                 'install_rpath' : udev_rpath,
+                'install_tag' : 'hwdb',
         },
 ]
index 5d5cc33a499f8c0d16f17787ca7892be2edda540..cff396e08289d4a1aeefd5e6c1af2f0899d89801 100644 (file)
@@ -132,6 +132,7 @@ udev_plugin_template = executable_template + {
         'link_with' : udev_link_with,
         'install_rpath' : udev_rpath,
         'install_dir' : udevlibexecdir,
+        'install_tag' : 'udev',
 }
 
 udev_common_template = {
@@ -155,6 +156,7 @@ executables += [
                 'link_with' : [libudevd_core],
                 'dependencies' : udev_dependencies,
                 'install_rpath' : udev_rpath,
+                'install_tag' : 'udev',
         },
         udev_plugin_template + {
                 'name' : 'ata_id',
@@ -254,13 +256,16 @@ executables += [
 ]
 
 meson.add_install_script(sh, '-c', ln_s.format(bindir / 'udevadm',
-                                               libexecdir / 'systemd-udevd'))
+                                               libexecdir / 'systemd-udevd'),
+                         install_tag : 'udev')
 
 if install_sysconfdir_samples
         install_data('udev.conf',
-                     install_dir : configfiledir / 'udev')
+                     install_dir : configfiledir / 'udev',
+                     install_tag : 'udev')
         install_data('iocost/iocost.conf',
-                     install_dir : configfiledir / 'udev')
+                     install_dir : configfiledir / 'udev',
+                     install_tag : 'udev')
 endif
 
 udev_pc = custom_target(
@@ -273,5 +278,5 @@ udev_pc = custom_target(
         install_dir : pkgconfigdatadir)
 
 if install_sysconfdir
-        install_emptydir(sysconfdir / 'udev/rules.d')
+        install_emptydir(sysconfdir / 'udev/rules.d', install_tag : 'udev')
 endif
index 805991dfe494364862c220f01f62e9d62770131a..caae65fea0f97b462b9657d8b719c8c8213bdd0e 100644 (file)
@@ -102,6 +102,7 @@ units = [
         {
           'file' : 'initrd-udevadm-cleanup-db.service',
           'conditions' : ['ENABLE_INITRD'],
+          'install_tag' : 'udev',
         },
         {
           'file' : 'initrd-usr-fs.target',
@@ -365,6 +366,7 @@ units = [
           'file' : 'systemd-hwdb-update.service.in',
           'conditions' : ['ENABLE_HWDB'],
           'symlinks' : ['sysinit.target.wants/'],
+          'install_tag' : 'hwdb',
         },
         {
           'file' : 'systemd-hybrid-sleep.service.in',
@@ -718,27 +720,38 @@ units = [
           'conditions' : ['ENABLE_TMPFILES'],
           'symlinks' : ['sysinit.target.wants/'],
         },
-        { 'file' : 'systemd-udev-load-credentials.service' },
-        { 'file' : 'systemd-udev-settle.service' },
+        {
+          'file' : 'systemd-udev-load-credentials.service',
+          'install_tag' : 'udev',
+        },
+        {
+          'file' : 'systemd-udev-settle.service',
+          'install_tag' : 'udev',
+        },
         {
           'file' : 'systemd-udev-trigger.service',
           'symlinks' : ['sysinit.target.wants/'],
+          'install_tag' : 'udev',
         },
         {
           'file' : 'systemd-udevd-control.socket',
           'symlinks' : ['sockets.target.wants/'],
+          'install_tag' : 'udev',
         },
         {
           'file' : 'systemd-udevd-kernel.socket',
           'symlinks' : ['sockets.target.wants/'],
+          'install_tag' : 'udev',
         },
         {
           'file' : 'systemd-udevd-varlink.socket',
           'symlinks' : ['sockets.target.wants/'],
+          'install_tag' : 'udev',
         },
         {
           'file' : 'systemd-udevd.service.in',
           'symlinks' : ['sysinit.target.wants/'],
+          'install_tag' : 'udev',
         },
         {
           'file' : 'systemd-update-done.service.in',
@@ -848,23 +861,27 @@ foreach unit : units
                         output : name,
                         command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
                         install : install,
-                        install_dir : systemunitdir)
+                        install_dir : systemunitdir,
+                        install_tag : unit.get('install_tag', ''))
         elif install
                 install_data(source,
-                             install_dir : systemunitdir)
+                             install_dir : systemunitdir,
+                             install_tag : unit.get('install_tag', ''))
         endif
 
         if install
                 foreach target : unit.get('symlinks', [])
                         if target.endswith('/')
-                                install_emptydir(systemunitdir / target)
+                                install_emptydir(systemunitdir / target, install_tag : unit.get('install_tag', ''))
                                 meson.add_install_script(sh, '-c',
                                                          ln_s.format(systemunitdir / name,
-                                                                     systemunitdir / target / name))
+                                                                     systemunitdir / target / name),
+                                                         install_tag : unit.get('install_tag', ''))
                         else
                                 meson.add_install_script(sh, '-c',
                                                          ln_s.format(systemunitdir / name,
-                                                                     systemunitdir / target))
+                                                                     systemunitdir / target),
+                                                         install_tag : unit.get('install_tag', ''))
                         endif
                 endforeach
         endif