summaryrefslogtreecommitdiff
path: root/mesonbuild/modules/__init__.py
diff options
context:
space:
mode:
authorFlorian "sp1rit"​ <sp1rit@disroot.org>2025-03-28 12:15:51 +0100
committerJussi Pakkanen <jussi.pakkanen@mailbox.org>2025-08-01 13:27:49 +0300
commit5e627c9b421a4cebb0e112af6a432fec66640c28 (patch)
tree7f630e25529afbb7b4c5483912cc5e5fac159df0 /mesonbuild/modules/__init__.py
parente5fd63b3093ada9e9bf30c0bfa2819ad6fbb94e4 (diff)
downloadmeson-5e627c9b421a4cebb0e112af6a432fec66640c28.tar.gz
gnome: support generate_gir on cross builds
This requires g-ir-scanner >=1.85.0, if this isn't the case we'll just fail.
Diffstat (limited to 'mesonbuild/modules/__init__.py')
-rw-r--r--mesonbuild/modules/__init__.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/mesonbuild/modules/__init__.py b/mesonbuild/modules/__init__.py
index 87892e6d7..3938101ff 100644
--- a/mesonbuild/modules/__init__.py
+++ b/mesonbuild/modules/__init__.py
@@ -82,19 +82,21 @@ class ModuleState:
wanted=wanted, silent=silent, for_machine=for_machine)
def find_tool(self, name: str, depname: str, varname: str, required: bool = True,
- wanted: T.Optional[str] = None) -> T.Union[build.OverrideExecutable, ExternalProgram, 'OverrideProgram']:
- # Look in overrides in case it's built as subproject
- progobj = self._interpreter.program_from_overrides([name], [])
- if progobj is not None:
- return progobj
+ wanted: T.Optional[str] = None, for_machine: MachineChoice = MachineChoice.HOST) -> T.Union[build.OverrideExecutable, ExternalProgram, 'OverrideProgram']:
+ if for_machine is MachineChoice.HOST:
+ # Look in overrides in case it's built as subproject
+ progobj = self._interpreter.program_from_overrides([name], [])
+ if progobj is not None:
+ return progobj
# Look in machine file
- prog_list = self.environment.lookup_binary_entry(MachineChoice.HOST, name)
+ prog_list = self.environment.lookup_binary_entry(for_machine, name)
if prog_list is not None:
return ExternalProgram.from_entry(name, prog_list)
# Check if pkgconfig has a variable
- dep = self.dependency(depname, native=True, required=False, wanted=wanted)
+ dep = self.dependency(depname, native=for_machine is MachineChoice.BUILD,
+ required=False, wanted=wanted)
if dep.found() and dep.type_name == 'pkgconfig':
value = dep.get_variable(pkgconfig=varname)
if value:
@@ -106,7 +108,7 @@ class ModuleState:
return progobj
# Normal program lookup
- return self.find_program(name, required=required, wanted=wanted)
+ return self.find_program(name, required=required, wanted=wanted, for_machine=for_machine)
def dependency(self, depname: str, native: bool = False, required: bool = True,
wanted: T.Optional[str] = None) -> 'Dependency':