]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
meson: port moduledir/distconfdir checks from autoconf
authorEmil Velikov <emil.l.velikov@gmail.com>
Thu, 24 Oct 2024 13:27:42 +0000 (14:27 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Thu, 24 Oct 2024 23:09:31 +0000 (18:09 -0500)
Namely, ensure they are absolute paths and any trailing / is stripped.

    $ meson setup -D moduledir=relative/ build/
    ...
    ERROR: Problem encountered: User provided moduledir, 'relative' is not an absolute path.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/209
[ Fix relative customdir ]
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
meson.build

index 3937901f404e4237d7df6665ebfd0303bc14f6e2..37d33d26fd59f414bb63507b7ec0e6aedcaedc78 100644 (file)
@@ -213,6 +213,13 @@ foreach tuple : _customdirs
   customdir = get_variable(dir_option)
   if customdir == ''
     customdir = def_path
+  else
+    if not customdir.startswith('/')
+      error('User provided @0@, \'@1@\' is not an absolute path.'
+          .format(dir_option, customdir))
+    endif
+    # Strip all leading/trailing and re-add only the leading one.
+    customdir = '' / customdir.strip('/')
   endif
   cdata.set_quoted(quoted, customdir)
   set_variable(dir_option, customdir)