diff options
author | Corentin Noël <corentin@elementary.io> | 2017-10-03 20:26:16 +0200 |
---|---|---|
committer | Corentin Noël <corentin@elementary.io> | 2017-10-03 20:26:16 +0200 |
commit | 1320a98a33e4e9f188e5daa143316b24d0dce819 (patch) | |
tree | 82ea281b163115277e1c9524283b0d371b6c21ac /mesonbuild/backend | |
parent | f13887b64a9d535682668960493158ae15bfbb2d (diff) | |
parent | 0c3d58baba4a61558ed9b4905f26155a3e95cf6c (diff) | |
download | meson-1320a98a33e4e9f188e5daa143316b24d0dce819.zip meson-1320a98a33e4e9f188e5daa143316b24d0dce819.tar.gz meson-1320a98a33e4e9f188e5daa143316b24d0dce819.tar.bz2 |
Merge github.com:mesonbuild/meson into vala-target-dirs
Diffstat (limited to 'mesonbuild/backend')
-rw-r--r-- | mesonbuild/backend/backends.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 61c5e90..61f7535 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -307,6 +307,25 @@ class Backend: raise MesonException(m.format(target.name)) return l + def rpaths_for_bundled_shared_libraries(self, target): + paths = [] + for dep in target.external_deps: + if isinstance(dep, dependencies.ExternalLibrary): + la = dep.link_args + if len(la) == 1 and os.path.isabs(la[0]): + # The only link argument is an absolute path to a library file. + libpath = la[0] + if libpath.startswith(('/usr/lib', '/lib')): + # No point in adding system paths. + continue + if os.path.splitext(libpath)[1] not in ['.dll', '.lib', '.so']: + continue + absdir = os.path.split(libpath)[0] + rel_to_src = absdir[len(self.environment.get_source_dir()) + 1:] + assert(not os.path.isabs(rel_to_src)) + paths.append(os.path.join(self.build_to_src, rel_to_src)) + return paths + def determine_rpath_dirs(self, target): link_deps = target.get_all_link_deps() result = [] @@ -314,6 +333,9 @@ class Backend: prospective = self.get_target_dir(ld) if prospective not in result: result.append(prospective) + for rp in self.rpaths_for_bundled_shared_libraries(target): + if rp not in result: + result += [rp] return result def object_filename_from_source(self, target, source, is_unity): @@ -522,6 +544,8 @@ class Backend: dirseg = os.path.join(self.environment.get_build_dir(), self.get_target_dir(ld)) if dirseg not in result: result.append(dirseg) + for deppath in self.rpaths_for_bundled_shared_libraries(target): + result.append(os.path.normpath(os.path.join(self.environment.get_build_dir(), deppath))) return result def write_benchmark_file(self, datafile): |