aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies/dev.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2019-05-24 16:26:27 -0700
committerJussi Pakkanen <jpakkane@gmail.com>2019-05-27 01:10:17 +0300
commite3e1d67ad61f4b3ddc80a1cbb069a944d5d7a361 (patch)
treeb2dfc88ac999abab905b849399a6f99ef39c1b27 /mesonbuild/dependencies/dev.py
parent9b3592a8baaf6e8e5ffdb6c4edb6056135fd8068 (diff)
downloadmeson-e3e1d67ad61f4b3ddc80a1cbb069a944d5d7a361.zip
meson-e3e1d67ad61f4b3ddc80a1cbb069a944d5d7a361.tar.gz
meson-e3e1d67ad61f4b3ddc80a1cbb069a944d5d7a361.tar.bz2
dependencies/llvm: Fixup bad output from llvm-config on windows
It turns out that llvm-config on windows can return such wonderful output as `-LIBDIR:c:\\... c:\\abslute\\path\\to\\lib.lib`, which was all fine and dandy when we were blindly passing it through, GCC/MinGW ignored it and MSVC understood it meant `/LIBDIR:`; however, after we added some code to validate linker arguments, and we have some code before the validation that tries to remove posix style -L arguments, resulting in IBDIR:..., which doesn't validate. This patch fixes up the output of llvm-config so that -LIBDIR: is replaced by the the link libdir argument of the compiler, via the compiler/linker method for getting that. Fixes #5419
Diffstat (limited to 'mesonbuild/dependencies/dev.py')
-rw-r--r--mesonbuild/dependencies/dev.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/mesonbuild/dependencies/dev.py b/mesonbuild/dependencies/dev.py
index 4d541a3..19991c3 100644
--- a/mesonbuild/dependencies/dev.py
+++ b/mesonbuild/dependencies/dev.py
@@ -260,19 +260,25 @@ class LLVMDependencyConfigTool(ConfigToolDependency):
self.link_args = self.__fix_bogus_link_args(self.link_args)
self._add_sub_dependency(ThreadDependency, environment, kwargs)
- @staticmethod
- def __fix_bogus_link_args(args):
+ def __fix_bogus_link_args(self, args):
"""This function attempts to fix bogus link arguments that llvm-config
generates.
Currently it works around the following:
- FreeBSD: when statically linking -l/usr/lib/libexecinfo.so will
be generated, strip the -l in cases like this.
+ - Windows: We may get -LIBPATH:... which is later interpreted as
+ "-L IBPATH:...", if we're using an msvc like compilers convert
+ that to "/LIBPATH", otherwise to "-L ..."
"""
+ cpp = self.env.coredata.compilers['cpp']
+
new_args = []
for arg in args:
if arg.startswith('-l') and arg.endswith('.so'):
new_args.append(arg.lstrip('-l'))
+ elif arg.startswith('-LIBPATH:'):
+ new_args.extend(cpp.get_linker_search_args(arg.lstrip('-LIBPATH:')))
else:
new_args.append(arg)
return new_args