devenv: Add executables locations to both PATH and WINEPATH

Handles the case when wine-binfmt is installed, which makes .exe files
executable without without specifying an exe wrapper.
pull/10990/head
Xavier Claessens 2 years ago
parent b926374205
commit f73970cc8f
  1. 17
      mesonbuild/backend/backends.py

@ -1850,9 +1850,9 @@ class Backend:
env = build.EnvironmentVariables()
extra_paths = set()
library_paths = set()
build_machine = self.environment.machines[MachineChoice.BUILD]
host_machine = self.environment.machines[MachineChoice.HOST]
need_exe_wrapper = self.environment.need_exe_wrapper()
need_wine = need_exe_wrapper and host_machine.is_windows()
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
@ -1874,17 +1874,22 @@ class Backend:
# LD_LIBRARY_PATH. This allows running system applications using
# that library.
library_paths.add(tdir)
if need_wine:
# Executable paths should be in both PATH and WINEPATH.
# - Having them in PATH makes bash completion find it,
# and make running "foo.exe" find it when wine-binfmt is installed.
# - Having them in WINEPATH makes "wine foo.exe" find it.
library_paths.update(extra_paths)
if library_paths:
if host_machine.is_windows() or host_machine.is_cygwin():
if need_wine:
env.prepend('WINEPATH', list(library_paths), separator=';')
elif host_machine.is_windows() or host_machine.is_cygwin():
extra_paths.update(library_paths)
elif host_machine.is_darwin():
env.prepend('DYLD_LIBRARY_PATH', list(library_paths))
else:
env.prepend('LD_LIBRARY_PATH', list(library_paths))
if extra_paths:
if need_wine:
env.prepend('WINEPATH', list(extra_paths), separator=';')
else:
env.prepend('PATH', list(extra_paths))
return env

Loading…
Cancel
Save