aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/d.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-03-10 08:31:41 -0700
committerDylan Baker <dylan@pnwbakers.com>2020-03-11 09:26:20 -0700
commitf13608460959af6c17081e7ee82f45c4a7541feb (patch)
tree0e63e2e377c1f0c175cc8d371663d903ef13a61c /mesonbuild/compilers/d.py
parent747061795393a1f4e8ac7d9f3d297b733a34230b (diff)
downloadmeson-f13608460959af6c17081e7ee82f45c4a7541feb.zip
meson-f13608460959af6c17081e7ee82f45c4a7541feb.tar.gz
meson-f13608460959af6c17081e7ee82f45c4a7541feb.tar.bz2
compilers/d: Fix rpath generation with LDC and DMD
Diffstat (limited to 'mesonbuild/compilers/d.py')
-rw-r--r--mesonbuild/compilers/d.py32
1 files changed, 18 insertions, 14 deletions
diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py
index a026e83..52126e3 100644
--- a/mesonbuild/compilers/d.py
+++ b/mesonbuild/compilers/d.py
@@ -219,20 +219,24 @@ class DmdLikeCompilerMixin:
if self.info.is_windows():
return []
- # This method is to be used by LDC and DMD.
- # GDC can deal with the verbatim flags.
- if not rpath_paths and not install_rpath:
- return []
- paths = ':'.join([os.path.join(build_dir, p) for p in rpath_paths])
- if build_rpath != '':
- paths += ':' + build_rpath
- if len(paths) < len(install_rpath):
- padding = 'X' * (len(install_rpath) - len(paths))
- if not paths:
- paths = padding
- else:
- paths = paths + ':' + padding
- return ['-Wl,-rpath,{}'.format(paths)]
+ # GNU ld, solaris ld, and lld acting like GNU ld
+ if self.linker.id.startswith('ld'):
+ # The way that dmd and ldc pass rpath to gcc is different than we would
+ # do directly, each argument -rpath and the value to rpath, need to be
+ # split into two separate arguments both prefaced with the -L=.
+ args = []
+ for r in super().build_rpath_args(
+ env, build_dir, from_dir, rpath_paths, build_rpath, install_rpath):
+ if ',' in r:
+ a, b = r.split(',', maxsplit=1)
+ args.append(a)
+ args.append(self.LINKER_PREFIX + b)
+ else:
+ args.append(r)
+ return args
+
+ return super().build_rpath_args(
+ env, build_dir, from_dir, rpath_paths, build_rpath, install_rpath)
def translate_args_to_nongnu(self, args):
dcargs = []