From aa4c4cdd2a99a3343de6b2a17e10e6f0887b2a0d Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Thu, 24 Oct 2024 14:27:42 +0100 Subject: [PATCH] meson: port moduledir/distconfdir checks from autoconf 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 Link: https://github.com/kmod-project/kmod/pull/209 [ Fix relative customdir ] Signed-off-by: Lucas De Marchi --- meson.build | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/meson.build b/meson.build index 3937901f..37d33d26 100644 --- a/meson.build +++ b/meson.build @@ -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) -- 2.47.2