diff options
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/coredata.py | 8 | ||||
-rw-r--r-- | mesonbuild/dependencies/base.py | 11 | ||||
-rw-r--r-- | mesonbuild/msetup.py | 8 |
3 files changed, 15 insertions, 12 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index 2666bb9..034f86a 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -270,7 +270,6 @@ class CoreData: self.cross_compilers = OrderedDict() self.deps = OrderedDict() # Only to print a warning if it changes between Meson invocations. - self.pkgconf_envvar = os.environ.get('PKG_CONFIG_PATH', '') self.config_files = self.__load_config_files(options.native_file) self.libdir_cross_fixup() @@ -504,6 +503,12 @@ class CoreData: # languages and setting the backend (builtin options must be set first # to know which backend we'll use). options = {} + + # Some options default to environment variables if they are + # unset, set those now. These will either be overwritten + # below, or they won't. + options['pkg_config_path'] = os.environ.get('PKG_CONFIG_PATH', '').split(':') + for k, v in env.cmd_line_options.items(): if subproject: if not k.startswith(subproject + ':'): @@ -789,6 +794,7 @@ builtin_options = { 'optimization': BuiltinOption(UserComboOption, 'Optimization level', '0', choices=['0', 'g', '1', '2', '3', 's']), 'debug': BuiltinOption(UserBooleanOption, 'Debug', True), 'wrap_mode': BuiltinOption(UserComboOption, 'Wrap mode', 'default', choices=['default', 'nofallback', 'nodownload', 'forcefallback']), + 'pkg_config_path': BuiltinOption(UserArrayOption, 'List of additional paths for pkg-config to search', []), } # Special prefix-dependent defaults for installation directories that reside in diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py index af4b13f..94a6a6b 100644 --- a/mesonbuild/dependencies/base.py +++ b/mesonbuild/dependencies/base.py @@ -609,11 +609,16 @@ class PkgConfigDependency(ExternalDependency): return rc, out def _call_pkgbin(self, args, env=None): + # Always copy the environment since we're going to modify it + # with pkg-config variables if env is None: - fenv = env - env = os.environ + env = os.environ.copy() else: - fenv = frozenset(env.items()) + env = env.copy() + + extra_paths = self.env.coredata.get_builtin_option('pkg_config_path') + env['PKG_CONFIG_PATH'] = ':'.join([p for p in extra_paths]) + fenv = frozenset(env.items()) targs = tuple(args) cache = PkgConfigDependency.pkgbin_cache if (self.pkgbin, targs, fenv) not in cache: diff --git a/mesonbuild/msetup.py b/mesonbuild/msetup.py index 6e8ca83..ef0511d 100644 --- a/mesonbuild/msetup.py +++ b/mesonbuild/msetup.py @@ -149,13 +149,6 @@ class MesonApp: sys.exit(1) return src_dir, build_dir - def check_pkgconfig_envvar(self, env): - curvar = os.environ.get('PKG_CONFIG_PATH', '') - if curvar != env.coredata.pkgconf_envvar: - mlog.warning('PKG_CONFIG_PATH has changed between invocations from "%s" to "%s".' % - (env.coredata.pkgconf_envvar, curvar)) - env.coredata.pkgconf_envvar = curvar - def generate(self): env = environment.Environment(self.source_dir, self.build_dir, self.options) mlog.initialize(env.get_log_dir(), self.options.fatal_warnings) @@ -169,7 +162,6 @@ class MesonApp: mlog.debug('Main binary:', sys.executable) mlog.debug('Python system:', platform.system()) mlog.log(mlog.bold('The Meson build system')) - self.check_pkgconfig_envvar(env) mlog.log('Version:', coredata.version) mlog.log('Source dir:', mlog.bold(self.source_dir)) mlog.log('Build dir:', mlog.bold(self.build_dir)) |