diff options
Diffstat (limited to 'mesonbuild/backend/backends.py')
-rw-r--r-- | mesonbuild/backend/backends.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index b5b8171..26402b7 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -1801,9 +1801,12 @@ class Backend: env = build.EnvironmentVariables() extra_paths = set() library_paths = set() + 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() 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 self.environment.need_exe_wrapper() + 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: continue @@ -1813,22 +1816,25 @@ class Backend: # so they get used by default instead of searching on system when # in developer environment. extra_paths.add(tdir) - if mesonlib.is_windows() or mesonlib.is_cygwin(): + if host_machine.is_windows() or host_machine.is_cygwin(): # On windows we cannot rely on rpath to run executables from build # directory. We have to add in PATH the location of every DLL needed. - extra_paths.update(self.determine_windows_extra_paths(t, [])) + library_paths.update(self.determine_windows_extra_paths(t, [])) elif isinstance(t, build.SharedLibrary): # Add libraries that are going to be installed in libdir into # LD_LIBRARY_PATH. This allows running system applications using # that library. library_paths.add(tdir) if library_paths: - if mesonlib.is_windows() or mesonlib.is_cygwin(): + if host_machine.is_windows() or host_machine.is_cygwin(): extra_paths.update(library_paths) - elif mesonlib.is_osx(): + 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: - env.prepend('PATH', list(extra_paths)) + if need_wine: + env.prepend('WINEPATH', list(extra_paths), separator=';') + else: + env.prepend('PATH', list(extra_paths)) return env |