util/meson.build: don't install udev.rules if udevdir cannot be determined (#801)
authorwdlkmpx <wdlkmpx@gmail.com>
Thu, 8 Jun 2023 10:24:43 +0000 (05:24 -0500)
committerGitHub <noreply@github.com>
Thu, 8 Jun 2023 10:24:43 +0000 (11:24 +0100)
make the udev dependency optional

just show a big warning if `udevrulesdir` is empty

util/install_helper.sh
util/meson.build

index 33f4a42f0a6ab757cdd7bb996671537bb6d0b554..76f2b47fe6c8f9088094e49e722168f6c92d9ff6 100755 (executable)
@@ -37,8 +37,10 @@ if $useroot; then
     fi
 fi
 
-install -D -m 644 "${MESON_SOURCE_ROOT}/util/udev.rules" \
+if [ "${udevrulesdir}" != "" ]; then
+    install -D -m 644 "${MESON_SOURCE_ROOT}/util/udev.rules" \
         "${DESTDIR}${udevrulesdir}/99-fuse3.rules"
+fi
 
 if [ "$initscriptdir" != "" ]; then
     install -D -m 755 "${MESON_SOURCE_ROOT}/util/init_script" \
index a2f3b9d2d23acad652a7b65a185b9eaaf8344097..47aac147e526ea8d7e99e664536af1462579910d 100644 (file)
@@ -16,8 +16,14 @@ executable('mount.fuse3', ['mount.fuse.c'],
 
 udevrulesdir = get_option('udevrulesdir')
 if udevrulesdir == ''
-  udev = dependency('udev')
-  udevrulesdir = join_paths(udev.get_variable(pkgconfig: 'udevdir'), 'rules.d')
+  udev = dependency('udev', required: false)
+  if udev.found()
+     udevrulesdir = join_paths(udev.get_variable(pkgconfig: 'udevdir'), 'rules.d')
+  endif
+endif
+
+if udevrulesdir == ''
+  warning('could not determine udevdir, udev.rules will not be installed')
 endif
 
 meson.add_install_script('install_helper.sh',