Skip to content

Commit

Permalink
devenv: Always include env for HOST machine
Browse files Browse the repository at this point in the history
Cross compiled executables could still be run with an exe wrapper, or
with proper binfmt installed.

Fixes: mesonbuild#10999
  • Loading branch information
xclaesse committed Dec 7, 2022
1 parent f73970c commit 302a295
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 1 addition & 3 deletions mesonbuild/backend/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -1854,10 +1854,8 @@ def get_devenv(self) -> build.EnvironmentVariables:
host_machine = self.environment.machines[MachineChoice.HOST]
need_wine = not build_machine.is_windows() and host_machine.is_windows()
for t in self.build.get_targets().values():
cross_built = not self.environment.machines.matches_build_machine(t.for_machine)
can_run = not cross_built or not need_exe_wrapper or need_wine
in_default_dir = t.should_install() and not t.get_install_dir()[2]
if not can_run or not in_default_dir:
if t.for_machine != MachineChoice.HOST or not in_default_dir:
continue
tdir = os.path.join(self.environment.get_build_dir(), self.get_target_dir(t))
if isinstance(t, build.Executable):
Expand Down
8 changes: 8 additions & 0 deletions mesonbuild/mdevenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@ def run(options: argparse.Namespace) -> int:
print(f'export {name}')
return 0

if b.environment.need_exe_wrapper():
m = 'An executable wrapper could be required'
exe_wrapper = b.environment.get_exe_wrapper()
if exe_wrapper:
cmd = ' '.join(exe_wrapper.get_command())
m += f': {cmd}'
mlog.log(m)

install_data = minstall.load_install_data(str(privatedir / 'install.dat'))
write_gdb_script(privatedir, install_data, workdir)

Expand Down

0 comments on commit 302a295

Please sign in to comment.