aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-06-11 14:54:10 +0300
committerGitHub <noreply@github.com>2017-06-11 14:54:10 +0300
commitf792641b34a83d61a421f0d76a8c72a956bdb073 (patch)
treead1a16ae7b6d9b8a0691f7a8d5e821b1eb76598d /mesonbuild/compilers.py
parentb8f02047bec9fd2d1a36db82df5fed14ef386cd6 (diff)
parent1e42241ef3c9f4d7be70b7c44703cf8856a85ddd (diff)
downloadmeson-f792641b34a83d61a421f0d76a8c72a956bdb073.zip
meson-f792641b34a83d61a421f0d76a8c72a956bdb073.tar.gz
meson-f792641b34a83d61a421f0d76a8c72a956bdb073.tar.bz2
Merge pull request #1927 from centricular/gir-rpath-link
Work around GNU ld bug with -rpath,$ORIGIN
Diffstat (limited to 'mesonbuild/compilers.py')
-rw-r--r--mesonbuild/compilers.py58
1 files changed, 29 insertions, 29 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py
index 977b7c4..80d12a0 100644
--- a/mesonbuild/compilers.py
+++ b/mesonbuild/compilers.py
@@ -731,35 +731,35 @@ class Compiler:
raise EnvironmentException('Language %s does not support linking whole archives.' % self.language)
def build_unix_rpath_args(self, build_dir, from_dir, rpath_paths, install_rpath):
- if not rpath_paths and not install_rpath:
- return []
- # The rpaths we write must be relative, because otherwise
- # they have different length depending on the build
- # directory. This breaks reproducible builds.
- rel_rpaths = []
- for p in rpath_paths:
- if p == from_dir:
- relative = '' # relpath errors out in this case
- else:
- relative = os.path.relpath(p, from_dir)
- rel_rpaths.append(relative)
- paths = ':'.join([os.path.join('$ORIGIN', p) for p in rel_rpaths])
- if len(paths) < len(install_rpath):
- padding = 'X' * (len(install_rpath) - len(paths))
- if not paths:
- paths = padding
- else:
- paths = paths + ':' + padding
- args = ['-Wl,-rpath,' + paths]
- if get_compiler_is_linuxlike(self):
- # Rpaths to use while linking must be absolute. These are not
- # written to the binary. Needed only with GNU ld:
- # https://sourceware.org/bugzilla/show_bug.cgi?id=16936
- # Not needed on Windows or other platforms that don't use RPATH
- # https://github.com/mesonbuild/meson/issues/1897
- lpaths = ':'.join([os.path.join(build_dir, p) for p in rpath_paths])
- args += ['-Wl,-rpath-link,' + lpaths]
- return args
+ if not rpath_paths and not install_rpath:
+ return []
+ # The rpaths we write must be relative, because otherwise
+ # they have different length depending on the build
+ # directory. This breaks reproducible builds.
+ rel_rpaths = []
+ for p in rpath_paths:
+ if p == from_dir:
+ relative = '' # relpath errors out in this case
+ else:
+ relative = os.path.relpath(p, from_dir)
+ rel_rpaths.append(relative)
+ paths = ':'.join([os.path.join('$ORIGIN', p) for p in rel_rpaths])
+ if len(paths) < len(install_rpath):
+ padding = 'X' * (len(install_rpath) - len(paths))
+ if not paths:
+ paths = padding
+ else:
+ paths = paths + ':' + padding
+ args = ['-Wl,-rpath,' + paths]
+ if get_compiler_is_linuxlike(self):
+ # Rpaths to use while linking must be absolute. These are not
+ # written to the binary. Needed only with GNU ld:
+ # https://sourceware.org/bugzilla/show_bug.cgi?id=16936
+ # Not needed on Windows or other platforms that don't use RPATH
+ # https://github.com/mesonbuild/meson/issues/1897
+ lpaths = ':'.join([os.path.join(build_dir, p) for p in rpath_paths])
+ args += ['-Wl,-rpath-link,' + lpaths]
+ return args
class CCompiler(Compiler):
def __init__(self, exelist, version, is_cross, exe_wrapper=None):