aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/scripts
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2020-02-12 02:29:09 +0530
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2020-02-17 23:58:20 +0530
commit561a284c512ab262ae669ceb2d26dee77f1c4bc1 (patch)
tree77a36fa9a02084afd4d71bf2ede3e24c8b26d5e8 /mesonbuild/scripts
parent21c4b7e40028382b0cecd5509e8a305e82a9036a (diff)
downloadmeson-561a284c512ab262ae669ceb2d26dee77f1c4bc1.zip
meson-561a284c512ab262ae669ceb2d26dee77f1c4bc1.tar.gz
meson-561a284c512ab262ae669ceb2d26dee77f1c4bc1.tar.bz2
depfixer: Cache searching of install_name_tool
This gives a significant speedup in large projects such as gst-build since now we only search for the tool once. Speed-up on Windows: ``` meson install: before: 15.3 seconds after: 5.4 seconds meson install --only-changed: before: 11.6 seconds after: 2.7 seconds ```
Diffstat (limited to 'mesonbuild/scripts')
-rw-r--r--mesonbuild/scripts/depfixer.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/mesonbuild/scripts/depfixer.py b/mesonbuild/scripts/depfixer.py
index 5be7d40..969f1cc 100644
--- a/mesonbuild/scripts/depfixer.py
+++ b/mesonbuild/scripts/depfixer.py
@@ -26,6 +26,9 @@ DT_STRTAB = 5
DT_SONAME = 14
DT_MIPS_RLD_MAP_REL = 1879048245
+# Global cache for tools
+INSTALL_NAME_TOOL = False
+
class DataSizes:
def __init__(self, ptrsize, is_le):
if is_le:
@@ -428,6 +431,7 @@ def fix_jar(fname):
subprocess.check_call(['jar', 'ufm', fname, 'META-INF/MANIFEST.MF'])
def fix_rpath(fname, new_rpath, final_path, install_name_mappings, verbose=True):
+ global INSTALL_NAME_TOOL
# Static libraries never have rpaths
if fname.endswith('.a'):
return
@@ -445,5 +449,11 @@ def fix_rpath(fname, new_rpath, final_path, install_name_mappings, verbose=True)
pass
else:
raise
- if shutil.which('install_name_tool'):
+ # We don't look for this on import because it will do a useless PATH lookup
+ # on non-mac platforms. That can be expensive on some Windows machines
+ # (upto 30ms), which is significant with --only-changed. For details, see:
+ # https://github.com/mesonbuild/meson/pull/6612#discussion_r378581401
+ if INSTALL_NAME_TOOL is False:
+ INSTALL_NAME_TOOL = shutil.which('install_name_tool')
+ if INSTALL_NAME_TOOL:
fix_darwin(fname, new_rpath, final_path, install_name_mappings)