From: Emil Velikov Date: Thu, 24 Oct 2024 12:49:22 +0000 (+0100) Subject: meson: consolidate all get_option('somedir') handling X-Git-Tag: v34~170 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=49a17d3e7e920973378a969fe7a73696c621e93c;p=thirdparty%2Fkmod.git meson: consolidate all get_option('somedir') handling Consolidate fetching of the directory options in a single place. This allows us to see what's missing, wrong and prevents error-prone duplication. Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/209 Signed-off-by: Lucas De Marchi --- diff --git a/meson.build b/meson.build index ab0bc56c..59125596 100644 --- a/meson.build +++ b/meson.build @@ -183,21 +183,28 @@ features = [] # Directories #------------------------------------------------------------------------------- +prefixdir = get_option('prefix') sysconfdir = get_option('sysconfdir') -cdata.set_quoted('SYSCONFDIR', sysconfdir) - -bindir = get_option('prefix') / get_option('bindir') -includedir = get_option('prefix') / get_option('includedir') -libdir = get_option('prefix') / get_option('libdir') +bindir = prefixdir / get_option('bindir') +includedir = prefixdir / get_option('includedir') +libdir = prefixdir / get_option('libdir') +datadir = prefixdir / get_option('datadir') distconfdir = get_option('distconfdir') +moduledir = get_option('moduledir') + +bashcompletiondir = get_option('bashcompletiondir') +fishcompletiondir = get_option('fishcompletiondir') +zshcompletiondir = get_option('zshcompletiondir') + +cdata.set_quoted('SYSCONFDIR', sysconfdir) + if distconfdir == '' distconfdir = libdir endif cdata.set_quoted('DISTCONFDIR', distconfdir) # The default moduledir is hard-coded due to historical reasons -moduledir = get_option('moduledir') if moduledir == '' moduledir = '/lib/modules' endif @@ -215,13 +222,13 @@ foreach tuple : _completiondirs def_path = tuple[2] ins_path = tuple[3] - completiondir = get_option(dir_option) + completiondir = get_variable(dir_option) if completiondir == '' completion = dependency(pkg_dep, required : false) if completion.found() completiondir = completion.get_variable(pkgconfig : 'completionsdir') else - completiondir = get_option('prefix') / get_option('datadir') / def_path + completiondir = datadir / def_path endif endif @@ -429,7 +436,7 @@ endif pkg.generate( name : 'kmod', description : 'Tools to deal with kernel modules', - install_dir : get_option('datadir') / 'pkgconfig', + install_dir : datadir / 'pkgconfig', variables : _kmod_variables, ) @@ -491,7 +498,7 @@ endif summary({ 'moduledir' : moduledir, - 'prefix' : get_option('prefix'), + 'prefix' : prefixdir, 'sysconfdir' : sysconfdir, 'distconfdir' : distconfdir, 'libdir' : libdir,