aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorlilinzhe <slayercat.subscription@gmail.com>2021-07-19 15:24:44 +0800
committerDaniel Mensinger <daniel@mensinger-ka.de>2021-08-09 19:32:48 +0200
commitdd2e3bf446af0007fa62bf918d77c082f13dbf01 (patch)
tree728450673bb5a8f7e83fc73a6e26c548e34b47c5 /mesonbuild
parent5c87167a34c6ed703444af180fffd8a45a7928ee (diff)
downloadmeson-dd2e3bf446af0007fa62bf918d77c082f13dbf01.zip
meson-dd2e3bf446af0007fa62bf918d77c082f13dbf01.tar.gz
meson-dd2e3bf446af0007fa62bf918d77c082f13dbf01.tar.bz2
pkg-config: support for `-l:libfoo.a`
fixs: #9000 Meson not correctly process with -l:xxx.a link arguments in pkgconfig .pc file. see also:https://stackoverflow.com/questions/48532868/gcc-library-option-with-a-colon-llibevent-a with unit test, unit test will be partially skiped if pkg-config version < 0.28 . see: https://gitlab.freedesktop.org/pkg-config/pkg-config/-/blob/master/NEWS
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/dependencies/pkgconfig.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/mesonbuild/dependencies/pkgconfig.py b/mesonbuild/dependencies/pkgconfig.py
index 9786918..d047e81 100644
--- a/mesonbuild/dependencies/pkgconfig.py
+++ b/mesonbuild/dependencies/pkgconfig.py
@@ -276,6 +276,30 @@ class PkgConfigDependency(ExternalDependency):
elif lib.startswith('-L'):
# We already handled library paths above
continue
+ elif lib.startswith('-l:'):
+ # see: https://stackoverflow.com/questions/48532868/gcc-library-option-with-a-colon-llibevent-a
+ # also : See the documentation of -lnamespec | --library=namespec in the linker manual
+ # https://sourceware.org/binutils/docs-2.18/ld/Options.html
+
+ # Don't resolve the same -l:libfoo.a argument again
+ if lib in libs_found:
+ continue
+ libfilename = lib[3:]
+ foundname = None
+ for libdir in libpaths:
+ target = os.path.join(libdir, libfilename)
+ if os.path.exists(target):
+ foundname = target
+ break
+ if foundname is None:
+ if lib in libs_notfound:
+ continue
+ else:
+ mlog.warning('Library {!r} not found for dependency {!r}, may '
+ 'not be successfully linked'.format(libfilename, self.name))
+ libs_notfound.append(lib)
+ else:
+ lib = foundname
elif lib.startswith('-l'):
# Don't resolve the same -lfoo argument again
if lib in libs_found: