summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2022-11-07 13:04:22 -0500
committerXavier Claessens <xavier.claessens@collabora.com>2022-12-07 11:58:36 -0500
commitf73970cc8f2599e41bac4e99de3a88ee7983a7ce (patch)
tree03b673d0e63a6cc0c64f483ca622c6250ba0a38c
parentb926374205bd761085031755c87152d08bc10e9d (diff)
downloadmeson-f73970cc8f2599e41bac4e99de3a88ee7983a7ce.tar.gz
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.
-rw-r--r--mesonbuild/backend/backends.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 747d80edd..eda6fb6d2 100644
--- a/mesonbuild/backend/backends.py
+++ b/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,18 +1874,23 @@ 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))
+ env.prepend('PATH', list(extra_paths))
return env
def compiler_to_generator(self, target: build.BuildTarget,