summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-05-11 10:27:35 +0200
committerThomas Haller <thaller@redhat.com>2022-05-11 10:38:32 +0200
commitbddffb1731c764032e163d10569ebaec88968732 (patch)
treeb0660768cb33573e22bc10084eddc4fac9524cf5
parentb0240418b3b27f51034cfe6dddde562a44e2c730 (diff)
build/meson: honor prefix for udev_dir and don't use pkg-config
When building with `mesond -Dprefix=/tmp/nm`, then we would expect that udev files are installed there (wouldn't we?). The user can already explicitly set "-Dudev_dir=", or even disable installing the files with "-Dudev_dir=no". Note that meson be default pre-populates `get_option("prefix")`, so there is always something set. So we cannot just act on whether the user set a prefix. It seems to default to /usr/local. Note that package builds from Fedora spec file pass "-Dprefix=/usr". I think we should honor the prefix. However, then it seems wrong to also honor pkg-config at the same time. In particular, because `pkg-config --variable=udevdir udev` gives /usr/lib/udev. That means, if we would just prepend the default prefix "/usr" or "/usr/local" to "/usr/lib/udev" we get the wrong result. Note that we already to the same for autotools.
-rw-r--r--meson.build14
1 files changed, 10 insertions, 4 deletions
diff --git a/meson.build b/meson.build
index 5db2a30e60..84b283e60f 100644
--- a/meson.build
+++ b/meson.build
@@ -353,10 +353,15 @@ if enable_introspection
endif
udev_udevdir = get_option('udev_dir')
-install_udevdir = (udev_udevdir != 'no')
-
-if install_udevdir and udev_udevdir == ''
- udev_udevdir = dependency('udev').get_pkgconfig_variable('udevdir')
+if udev_udevdir == 'no'
+ install_udevdir = false
+ udev_udevdir = ''
+else
+ install_udevdir = true
+ if (udev_udevdir == '' or udev_udevdir == 'yes')
+ udev_udevdir = join_paths(nm_prefix, 'lib/udev')
+ endif
+ assert(udev_udevdir.startswith('/'), 'udev_dir must be an absolute path, but is ' + udev_udevdir)
endif
systemd_systemdsystemunitdir = get_option('systemdsystemunitdir')
@@ -1013,6 +1018,7 @@ output = '\nSystem paths:\n'
output += ' prefix: ' + nm_prefix + '\n'
output += ' exec_prefix: ' + nm_prefix + '\n'
output += ' systemdunitdir: ' + systemd_systemdsystemunitdir + '\n'
+output += ' udev_dir: ' + (install_udevdir ? udev_udevdir : '(none)') + '\n'
output += ' nmbinary: ' + nm_pkgsbindir + '\n'
output += ' nmconfdir: ' + nm_pkgconfdir + '\n'
output += ' nmlibdir: ' + nm_pkglibdir + '\n'