aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/environment.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-02-20 07:01:25 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2017-02-21 01:36:08 +0530
commit56a8b2a1810b3ec1964c2a2f09e12ff841ac13ef (patch)
tree325f125baceae2795071d31bb31ed084d4e1ce5f /mesonbuild/environment.py
parent798c349e35f5f7b740ce83360c7f59188a96bd28 (diff)
downloadmeson-56a8b2a1810b3ec1964c2a2f09e12ff841ac13ef.zip
meson-56a8b2a1810b3ec1964c2a2f09e12ff841ac13ef.tar.gz
meson-56a8b2a1810b3ec1964c2a2f09e12ff841ac13ef.tar.bz2
Fix static linker exelist in cross-info and environment
https://github.com/mesonbuild/meson/pull/1406 had an incomplete fix for this. The test case caught it. Note: this still doesn't test that setting it in the cross-info works, but it's the same codepath as via the environment so it should be ok.
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r--mesonbuild/environment.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 3021770..76b2205 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -677,30 +677,32 @@ class Environment:
def detect_static_linker(self, compiler):
if compiler.is_cross:
linker = self.cross_info.config['binaries']['ar']
+ if isinstance(linker, str):
+ linker = [linker]
else:
evar = 'AR'
if evar in os.environ:
linker = shlex.split(os.environ[evar])
elif isinstance(compiler, VisualStudioCCompiler):
- linker = self.vs_static_linker
+ linker = [self.vs_static_linker]
else:
- linker = self.default_static_linker
- basename = os.path.basename(linker).lower()
+ linker = [self.default_static_linker]
+ basename = os.path.basename(linker[-1]).lower()
if basename == 'lib' or basename == 'lib.exe':
arg = '/?'
else:
arg = '--version'
try:
- p, out, err = Popen_safe([linker, arg])
+ p, out, err = Popen_safe(linker + [arg])
except OSError:
- raise EnvironmentException('Could not execute static linker "%s".' % linker)
+ raise EnvironmentException('Could not execute static linker "%s".' % ' '.join(linker))
if '/OUT:' in out or '/OUT:' in err:
- return VisualStudioLinker([linker])
+ return VisualStudioLinker(linker)
if p.returncode == 0:
- return ArLinker([linker])
+ return ArLinker(linker)
if p.returncode == 1 and err.startswith('usage'): # OSX
- return ArLinker([linker])
- raise EnvironmentException('Unknown static linker "%s"' % linker)
+ return ArLinker(linker)
+ raise EnvironmentException('Unknown static linker "%s"' % ' '.join(linker))
def detect_ccache(self):
try: