Module: Mesa Branch: main Commit: 6c5a9ede641f00021eb393aaba1a0e33f77bc367 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6c5a9ede641f00021eb393aaba1a0e33f77bc367
Author: Erik Faye-Lund <[email protected]> Date: Thu Mar 9 08:52:05 2023 +0100 util/xmlconfig: add an env-var for overriding drirc search dir This adds an environment variable that can be used to override the global drirc serach directory. This can be useful for debugging, and meson devenv, as used in the following commit. Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Adam Jackson <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21808> --- docs/envvars.rst | 6 ++++++ src/util/xmlconfig.c | 13 +++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/docs/envvars.rst b/docs/envvars.rst index 01f72fae90e..a6bb026ce7e 100644 --- a/docs/envvars.rst +++ b/docs/envvars.rst @@ -404,6 +404,12 @@ Core Mesa environment variables ``lspci -nn | grep VGA`` can be used to know the PCIe bus or ids to use. +.. envvar:: DRIRC_CONFIGDIR + + If set, overrides the global search-directories used when searching for + drirc config files. The user-local one will still be used. Mostly useful for + internal debugging. + NIR passes environment variables -------------------------------- diff --git a/src/util/xmlconfig.c b/src/util/xmlconfig.c index 62b163be25e..f275166b1e6 100644 --- a/src/util/xmlconfig.c +++ b/src/util/xmlconfig.c @@ -1216,10 +1216,15 @@ driParseConfigFiles(driOptionCache *cache, const driOptionCache *info, userData.execName = execname; #if WITH_XMLCONFIG - char *home; - - parseConfigDir(&userData, datadir); - parseOneConfigFile(&userData, SYSCONFDIR "/drirc"); + char *home, *configdir; + + /* parse from either $DRIRC_CONFIGDIR or $datadir/drirc.d */ + if ((configdir = getenv("DRIRC_CONFIGDIR"))) + parseConfigDir(&userData, configdir); + else { + parseConfigDir(&userData, datadir); + parseOneConfigFile(&userData, SYSCONFDIR "/drirc"); + } if ((home = getenv("HOME"))) { char filename[PATH_MAX];
