From b0b27b9b9057a5d8ede2186c6b8aa9e03ace942f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Wed, 1 May 2024 14:25:08 +0200 Subject: [PATCH] compat: Limit forwarding of machine-specific options Only forward them if they're either for the build machine, or they're project options for the host machine. --- compat/build.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/compat/build.py b/compat/build.py index c002e6beb..057f449b2 100644 --- a/compat/build.py +++ b/compat/build.py @@ -366,8 +366,21 @@ def option_should_be_forwarded(k: "OptionKey", subprojects: set[str]) -> bool: from mesonbuild import coredata - if coredata.CoreData.is_per_machine_option(k) and k.machine is not coredata.MachineChoice.HOST: - return False + our_project_id = "frida-core" if role == "subproject" else "" + is_for_us = k.subproject == our_project_id + is_for_child = k.subproject in subprojects + + if k.is_project(): + if is_for_us: + tokens = k.name.split("_") + if tokens[0] in {"helper", "agent"} and tokens[-1] in {"modern", "legacy"}: + return False + if k.subproject and k.machine is not coredata.MachineChoice.HOST: + return False + return is_for_us or is_for_child + + if coredata.CoreData.is_per_machine_option(k): + return k.machine is coredata.MachineChoice.BUILD if k.is_builtin(): if k.name in {"buildtype", "genvslite"}: @@ -381,15 +394,6 @@ def option_should_be_forwarded(k: "OptionKey", if not str(v.value): return False - our_project_id = "frida-core" if role == "subproject" else "" - is_for_us = k.subproject == our_project_id - is_for_child = k.subproject in subprojects - - if k.is_project() and is_for_us: - tokens = k.name.split("_") - if tokens[0] in {"helper", "agent"} and tokens[-1] in {"modern", "legacy"}: - return False - return is_for_us or is_for_child