summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2021-05-17 20:04:42 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2021-05-17 20:04:42 +0300
commit4748fee06ab100fa84150194485e0ff7aa9bc6c3 (patch)
tree05d8dc3e2c0933dceb55693c3aed0237a230986b
parent42abae2e07717f1aad286f40166b13fcccc0d878 (diff)
downloadmeson-overrides.tar.gz
Prohibit the use of override_file and subproject options in machine files.overrides
-rw-r--r--cross/ubuntu-armhf.txt3
-rw-r--r--mesonbuild/environment.py17
-rw-r--r--mesonbuild/msetup.py1
3 files changed, 21 insertions, 0 deletions
diff --git a/cross/ubuntu-armhf.txt b/cross/ubuntu-armhf.txt
index 69e0c8611..aa75cdc59 100644
--- a/cross/ubuntu-armhf.txt
+++ b/cross/ubuntu-armhf.txt
@@ -14,6 +14,9 @@ ld = '/usr/bin/arm-linux/gnueabihf-ld'
c_args = ['-DMESON_TEST_ISSUE_1665=1']
cpp_args = '-DMESON_TEST_ISSUE_1665=1'
+[zlib:built-in options]
+c_std = 'c99'
+
[properties]
root = '/usr/arm-linux-gnueabihf'
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 3a198e969..cb05b1d99 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -783,6 +783,21 @@ class Environment:
self.wrap_resolver = None
self.overrides = OptionOverrides()
self.init_overrides()
+ self.check_dual_overrides()
+
+ def has_per_subproject_options(self):
+ for o in self.options:
+ if o.subproject:
+ return True
+ return False
+
+ def check_dual_overrides(self):
+ if self.has_per_subproject_options() and self.coredata.options[mesonlib.OptionKey('override_file')].value:
+ raise MesonException('''Tried to define a per-subproject option in a machine file when override_file was defined.
+This is not supported. All per-subproject options should be transitioned to
+use the override file. Machine file overrides are deprecatd and will be
+removed in a future Meson release.''')
+
def _load_machine_file_options(self, config: 'ConfigParser', properties: Properties, machine: MachineChoice) -> None:
"""Read the contents of a Machine file and put it in the options store."""
@@ -814,6 +829,8 @@ class Environment:
subproject, section = section.split(':')
else:
subproject = ''
+ if subproject != '':
+ mlog.deprecation('Per-subproject option values in machine files are deprecated, transition to using an override_file instead.')
if section == 'built-in options':
for k, v in values.items():
key = OptionKey.from_string(k)
diff --git a/mesonbuild/msetup.py b/mesonbuild/msetup.py
index b34894876..26d213458 100644
--- a/mesonbuild/msetup.py
+++ b/mesonbuild/msetup.py
@@ -224,6 +224,7 @@ class MesonApp:
except Exception as e:
mintro.write_meson_info_file(b, [e])
raise
+ env.check_dual_overrides()
# Print all default option values that don't match the current value
for def_opt_name, def_opt_value, cur_opt_value in intr.get_non_matching_default_options():
mlog.log('Option', mlog.bold(def_opt_name), 'is:',