aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/compilers.py35
-rw-r--r--mesonbuild/dependencies.py4
2 files changed, 36 insertions, 3 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py
index 64a1410..58444bb 100644
--- a/mesonbuild/compilers.py
+++ b/mesonbuild/compilers.py
@@ -1542,7 +1542,7 @@ class DCompiler(Compiler):
for la in linkargs:
dcargs.append('-L' + la.strip())
continue
- elif arg.startswith(('-l', '-L')):
+ elif arg.startswith('-l'):
# translate library link flag
dcargs.append('-L' + arg)
continue
@@ -1557,6 +1557,12 @@ class GnuDCompiler(DCompiler):
self.warn_args = {'1': ['-Wall', '-Wdeprecated'],
'2': ['-Wall', '-Wextra', '-Wdeprecated'],
'3': ['-Wall', '-Wextra', '-Wdeprecated', '-Wpedantic']}
+ self.base_options = ['b_colorout', 'b_sanitize']
+
+ def get_colorout_args(self, colortype):
+ if mesonlib.version_compare(self.version, '>=4.9.0'):
+ return gnu_color_args[colortype][:]
+ return []
def get_dependency_gen_args(self, outtarget, outfile):
# FIXME: Passing -fmake-deps results in a file-not-found message.
@@ -1581,6 +1587,9 @@ class GnuDCompiler(DCompiler):
def get_werror_args(self):
return ['-Werror']
+ def get_linker_search_args(self, dirname):
+ return ['-L'+dirname]
+
def get_buildtype_args(self, buildtype):
return d_gdc_buildtype_args[buildtype]
@@ -1594,6 +1603,12 @@ class LLVMDCompiler(DCompiler):
def __init__(self, exelist, version, is_cross):
DCompiler.__init__(self, exelist, version, is_cross)
self.id = 'llvm'
+ self.base_options = ['b_coverage', 'b_colorout']
+
+ def get_colorout_args(self, colortype):
+ if colortype == 'always':
+ return ['-enable-color']
+ return []
def get_dependency_gen_args(self, outtarget, outfile):
# LDC using the -deps flag returns a non-Makefile dependency-info file, which
@@ -1627,6 +1642,12 @@ class LLVMDCompiler(DCompiler):
def get_pic_args(self):
return ['-relocation-model=pic']
+ def get_linker_search_args(self, dirname):
+ # -L is recognized as "add this to the search path" by the linker,
+ # while the compiler recognizes it as "pass to linker". So, the first
+ # -L is for the compiler, telling it to pass the second -L to the linker.
+ return ['-L-L'+dirname]
+
def unix_link_flags_to_native(self, args):
return self.translate_args_to_nongnu(args)
@@ -1637,6 +1658,12 @@ class DmdDCompiler(DCompiler):
def __init__(self, exelist, version, is_cross):
DCompiler.__init__(self, exelist, version, is_cross)
self.id = 'dmd'
+ self.base_options = ['b_coverage', 'b_colorout']
+
+ def get_colorout_args(self, colortype):
+ if colortype == 'always':
+ return ['-color=on']
+ return []
def get_dependency_gen_args(self, outtarget, outfile):
# LDC using the -deps flag returns a non-Makefile dependency-info file, which
@@ -1664,6 +1691,12 @@ class DmdDCompiler(DCompiler):
def get_coverage_args(self):
return ['-cov']
+ def get_linker_search_args(self, dirname):
+ # -L is recognized as "add this to the search path" by the linker,
+ # while the compiler recognizes it as "pass to linker". So, the first
+ # -L is for the compiler, telling it to pass the second -L to the linker.
+ return ['-L-L'+dirname]
+
def get_buildtype_args(self, buildtype):
return d_dmd_buildtype_args[buildtype]
diff --git a/mesonbuild/dependencies.py b/mesonbuild/dependencies.py
index b4f825b..d123f77 100644
--- a/mesonbuild/dependencies.py
+++ b/mesonbuild/dependencies.py
@@ -154,7 +154,7 @@ class PkgConfigDependency(Dependency):
out = p.communicate()[0]
if p.returncode != 0:
raise DependencyException('Could not generate cargs for %s:\n\n%s' % \
- (name, out.decode(errors='ignore')))
+ (self.name, out.decode(errors='ignore')))
self.cargs = out.decode().split()
def _set_libs(self):
@@ -166,7 +166,7 @@ class PkgConfigDependency(Dependency):
out = p.communicate()[0]
if p.returncode != 0:
raise DependencyException('Could not generate libs for %s:\n\n%s' % \
- (name, out.decode(errors='ignore')))
+ (self.name, out.decode(errors='ignore')))
self.libs = []
for lib in out.decode().split():
if lib.endswith(".la"):