diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2018-10-04 22:10:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-04 22:10:09 +0300 |
commit | 88054c48a60e386909421dc8e2c89c918f2253d0 (patch) | |
tree | d8dee617bbc746033db72bd7f92d2e2d0cfafef1 /mesonbuild/backend/backends.py | |
parent | c0c075c1298ad9018a62d75a632af1c0d0d7d0f8 (diff) | |
parent | c53d35aa721e3c98590ef15c82a87b01ede9f628 (diff) | |
download | meson-88054c48a60e386909421dc8e2c89c918f2253d0.zip meson-88054c48a60e386909421dc8e2c89c918f2253d0.tar.gz meson-88054c48a60e386909421dc8e2c89c918f2253d0.tar.bz2 |
Merge pull request #4293 from marcelhollerbach/master
Performance optimize the install part generation
Diffstat (limited to 'mesonbuild/backend/backends.py')
-rw-r--r-- | mesonbuild/backend/backends.py | 57 |
1 files changed, 2 insertions, 55 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 78c2877..0a28782 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -27,9 +27,6 @@ from collections import OrderedDict import shlex from functools import lru_cache -@lru_cache(maxsize=None) -def get_target_macos_dylib_install_name(ld): - return get_macos_dylib_install_name(ld.prefix, ld.name, ld.suffix, ld.soversion) class CleanTrees: @@ -970,61 +967,11 @@ class Backend: with open(install_data_file, 'wb') as ofile: pickle.dump(d, ofile) - def get_target_install_dirs(self, t): - # Find the installation directory. - if isinstance(t, build.SharedModule): - default_install_dir = self.environment.get_shared_module_dir() - elif isinstance(t, build.SharedLibrary): - default_install_dir = self.environment.get_shared_lib_dir() - elif isinstance(t, build.StaticLibrary): - default_install_dir = self.environment.get_static_lib_dir() - elif isinstance(t, build.Executable): - default_install_dir = self.environment.get_bindir() - elif isinstance(t, build.CustomTarget): - default_install_dir = None - else: - assert(isinstance(t, build.BuildTarget)) - # XXX: Add BuildTarget-specific install dir cases here - default_install_dir = self.environment.get_libdir() - outdirs = t.get_custom_install_dir() - if outdirs[0] is not None and outdirs[0] != default_install_dir and outdirs[0] is not True: - # Either the value is set to a non-default value, or is set to - # False (which means we want this specific output out of many - # outputs to not be installed). - custom_install_dir = True - else: - custom_install_dir = False - outdirs[0] = default_install_dir - return outdirs, custom_install_dir - - def get_target_link_deps_mappings(self, t, prefix): - ''' - On macOS, we need to change the install names of all built libraries - that a target depends on using install_name_tool so that the target - continues to work after installation. For this, we need a dictionary - mapping of the install_name value to the new one, so we can change them - on install. - ''' - result = {} - if isinstance(t, build.StaticLibrary): - return result - for ld in t.get_all_link_deps(): - if ld is t or not isinstance(ld, build.SharedLibrary): - continue - old = get_target_macos_dylib_install_name(ld) - if old in result: - continue - fname = ld.get_filename() - outdirs, _ = self.get_target_install_dirs(ld) - new = os.path.join(prefix, outdirs[0], fname) - result.update({old: new}) - return result - def generate_target_install(self, d): for t in self.build.get_targets().values(): if not t.should_install(): continue - outdirs, custom_install_dir = self.get_target_install_dirs(t) + outdirs, custom_install_dir = t.get_install_dir(self.environment) # Sanity-check the outputs and install_dirs num_outdirs, num_out = len(outdirs), len(t.get_outputs()) if num_outdirs != 1 and num_outdirs != num_out: @@ -1039,7 +986,7 @@ class Backend: # Install primary build output (library/executable/jar, etc) # Done separately because of strip/aliases/rpath if outdirs[0] is not False: - mappings = self.get_target_link_deps_mappings(t, d.prefix) + mappings = t.get_link_deps_mapping(d.prefix, self.environment) i = TargetInstallData(self.get_target_filename(t), outdirs[0], t.get_aliases(), should_strip, mappings, t.install_rpath, install_mode) |