Skip to content

Commit

Permalink
compat: Limit forwarding of machine-specific options
Browse files Browse the repository at this point in the history
Only forward them if they're either for the build machine, or
they're project options for the host machine.
  • Loading branch information
oleavr committed May 1, 2024
1 parent 9367cc5 commit b0b27b9
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions compat/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}:
Expand All @@ -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


Expand Down

0 comments on commit b0b27b9

Please sign in to comment.