aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2020-08-09 08:45:34 -0400
committerXavier Claessens <xclaesse@gmail.com>2020-10-16 17:42:24 -0400
commit7271b1e9423a83c56bf6e011b4f06dc6831a6d71 (patch)
treefba0896e0ff3235e04ecac58faf96ae8feda03d8 /mesonbuild
parent254b836bd49a10dd2cb4a91771398a8d08d59dda (diff)
downloadmeson-7271b1e9423a83c56bf6e011b4f06dc6831a6d71.zip
meson-7271b1e9423a83c56bf6e011b4f06dc6831a6d71.tar.gz
meson-7271b1e9423a83c56bf6e011b4f06dc6831a6d71.tar.bz2
Machine file pkg_config_path overrides environment
This is consistent with c_args in machine file overriding CFLAGS from env. This also spotted an issue where in a native build this resulted in pkg_config_path being /bar instead of /foo: `-Dpkg_config_path=/foo -Dbuild.pkg_config_path=/bar` Fixes: #7573
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/coredata.py4
-rw-r--r--mesonbuild/environment.py10
2 files changed, 8 insertions, 6 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index 9ed939b..d5d90f9 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -735,7 +735,9 @@ class CoreData:
for k, v in options.items():
if k.startswith('build.'):
k = k.split('.', 1)[1]
- res[k] = v
+ res.setdefault(k, v)
+ else:
+ res[k] = v
return res
def copy_build_options_from_regular_ones(self):
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index e63e9bf..e3ea956 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -629,12 +629,12 @@ class Environment:
self.properties = properties.default_missing()
self.cmakevars = cmakevars.default_missing()
- # Environment options override those from cross/native files
- self.set_options_from_env()
-
# Command line options override those from cross/native files
self.raw_options.update(options.cmd_line_options)
+ # Take default value from env if not set in cross/native files or command line.
+ self.set_default_options_from_env()
+
# Warn if the user is using two different ways of setting build-type
# options that override each other
if 'buildtype' in self.raw_options and \
@@ -727,7 +727,7 @@ class Environment:
per_machine_options[build_optname] = value
self.raw_options = per_machine_options
- def set_options_from_env(self):
+ def set_default_options_from_env(self):
for for_machine in MachineChoice:
p_env_pair = get_env_var_pair(for_machine, self.is_cross_build(), 'PKG_CONFIG_PATH')
if p_env_pair is not None:
@@ -746,7 +746,7 @@ class Environment:
# FIXME: We should remember if we took the value from env to warn
# if it changes on future invocations.
if self.first_invocation:
- self.raw_options[key] = p_list
+ self.raw_options.setdefault(key, p_list)
def create_new_coredata(self, options: 'argparse.Namespace') -> None:
# WARNING: Don't use any values from coredata in __init__. It gets