From edb52e90037bac0233e680e2d0a7c5847aac93ae Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 27 Jan 2020 09:18:31 -0800 Subject: [PATCH] coredata: Warn on reconfigure if PKG_CONFIG_PATH has changed Fixes #6520 Fixes #5223 --- mesonbuild/coredata.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index 11b8deb0d..8f709ddbd 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -19,7 +19,7 @@ from itertools import chain from pathlib import PurePath from collections import OrderedDict from .mesonlib import ( - MesonException, MachineChoice, PerMachine, + MesonException, MachineChoice, PerMachine, OrderedSet, default_libdir, default_libexecdir, default_prefix, split_args ) from .wrap import WrapMode @@ -746,16 +746,20 @@ class CoreData: # Some options default to environment variables if they are # unset, set those now. These will either be overwritten # below, or they won't. These should only be set on the first run. - if env.first_invocation: - p_env = os.environ.get('PKG_CONFIG_PATH') - if p_env: - # PKG_CONFIG_PATH may contain duplicates, which must be - # removed, else a duplicates-in-array-option warning arises. - pkg_config_paths = [] - for k in p_env.split(':'): - if k not in pkg_config_paths: - pkg_config_paths.append(k) - options['pkg_config_path'] = pkg_config_paths + p_env = os.environ.get('PKG_CONFIG_PATH') + if p_env: + # PKG_CONFIG_PATH may contain duplicates, which must be + # removed, else a duplicates-in-array-option warning arises. + p_list = list(OrderedSet(p_env.split(':'))) + if env.first_invocation: + options['pkg_config_path'] = p_list + elif options.get('pkg_config_path', []) != p_list: + mlog.warning( + 'PKG_CONFIG_PATH environment variable has changed ' + 'between configurations, meson ignores this. ' + 'Use -Dpkg_config_path to change pkg-config search ' + 'path instead.' + ) for k, v in env.cmd_line_options.items(): if subproject: