aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/minstall.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2021-01-26 13:51:23 -0500
committerJussi Pakkanen <jpakkane@gmail.com>2021-01-30 09:51:06 +0000
commit0626465ea8aa65b10776d5c4064e881fe0d6fa25 (patch)
treebe11f7029bd7bd418494d45cf7f3de52cbaf435f /mesonbuild/minstall.py
parentc321339b24f896d02b0839d1b1e5008eae405858 (diff)
downloadmeson-0626465ea8aa65b10776d5c4064e881fe0d6fa25.zip
meson-0626465ea8aa65b10776d5c4064e881fe0d6fa25.tar.gz
meson-0626465ea8aa65b10776d5c4064e881fe0d6fa25.tar.bz2
Fix executable as script on Windows
On Windows this would fail because of missing DLL: ``` mylib = library(...) exe = executable(..., link_with: mylib) meson.add_install_script(exe) ``` The reason is on Windows we cannot rely on rpath to find libraries from build directory, they are searched in $PATH. We already have all that mechanism in place for custom_target() using ExecutableSerialisation class, so reuse it for install/dist/postconf scripts too. This has bonus side effect to also use exe_wrapper for those scripts. Fixes: #8187
Diffstat (limited to 'mesonbuild/minstall.py')
-rw-r--r--mesonbuild/minstall.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/mesonbuild/minstall.py b/mesonbuild/minstall.py
index 3e425eb..98608c7 100644
--- a/mesonbuild/minstall.py
+++ b/mesonbuild/minstall.py
@@ -30,6 +30,7 @@ from .coredata import major_versions_differ, MesonVersionMismatchException
from .coredata import version as coredata_version
from .mesonlib import is_windows, Popen_safe
from .scripts import depfixer, destdir_join
+from .scripts.meson_exe import run_exe
try:
from __main__ import __file__ as main_file
except ImportError:
@@ -485,17 +486,12 @@ class Installer:
if self.options.quiet:
env['MESON_INSTALL_QUIET'] = '1'
- child_env = os.environ.copy()
- child_env.update(env)
-
for i in d.install_scripts:
self.did_install_something = True # Custom script must report itself if it does nothing.
- script = i['exe']
- args = i['args']
- name = ' '.join(script + args)
+ name = ' '.join(i.cmd_args)
self.log('Running custom install script {!r}'.format(name))
try:
- rc = subprocess.call(script + args, env=child_env)
+ rc = run_exe(i, env)
except OSError:
print('FAILED: install script \'{}\' could not be run, stopped'.format(name))
# POSIX shells return 127 when a command could not be found