From: Emil Velikov Date: Thu, 24 Oct 2024 13:07:52 +0000 (+0100) Subject: meson: fold distconfdir/moduledir handling X-Git-Tag: v34~168 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9023f4f1bbf7ce581d0db202f8cf38c418020428;p=thirdparty%2Fkmod.git meson: fold distconfdir/moduledir handling We're about to add a few more checks, so instead of duplicating them fold the handling of custom variables in single place. 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 e58af869..3937901f 100644 --- a/meson.build +++ b/meson.build @@ -199,16 +199,24 @@ zshcompletiondir = get_option('zshcompletiondir') cdata.set_quoted('SYSCONFDIR', sysconfdir) -if distconfdir == '' - distconfdir = libdir -endif -cdata.set_quoted('DISTCONFDIR', distconfdir) +_customdirs = [ + ['distconfdir', libdir, 'DISTCONFDIR'], + # The default moduledir is hard-coded due to historical reasons + ['moduledir', '/lib/modules', 'MODULE_DIRECTORY'], +] -# The default moduledir is hard-coded due to historical reasons -if moduledir == '' - moduledir = '/lib/modules' -endif -cdata.set_quoted('MODULE_DIRECTORY', moduledir) +foreach tuple : _customdirs + dir_option = tuple[0] + def_path = tuple[1] + quoted = tuple[2] + + customdir = get_variable(dir_option) + if customdir == '' + customdir = def_path + endif + cdata.set_quoted(quoted, customdir) + set_variable(dir_option, customdir) +endforeach _completiondirs = [ ['bashcompletiondir', 'bash-completion', 'bash-completion/completions', 'shell-completion/bash/@0@'],