diff options
author | lilinzhe <slayercat.subscription@gmail.com> | 2021-07-19 15:24:44 +0800 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2021-08-09 19:32:48 +0200 |
commit | dd2e3bf446af0007fa62bf918d77c082f13dbf01 (patch) | |
tree | 728450673bb5a8f7e83fc73a6e26c548e34b47c5 /unittests/linuxliketests.py | |
parent | 5c87167a34c6ed703444af180fffd8a45a7928ee (diff) | |
download | meson-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 'unittests/linuxliketests.py')
-rw-r--r-- | unittests/linuxliketests.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/unittests/linuxliketests.py b/unittests/linuxliketests.py index 2ab4dd7..d3067bb 100644 --- a/unittests/linuxliketests.py +++ b/unittests/linuxliketests.py @@ -1297,6 +1297,49 @@ class LinuxlikeTests(BasePlatformTests): out = self._run(['otool', '-L', f]) # Ensure that the otool output does not contain self.installdir self.assertNotRegex(out, self.installdir + '.*dylib ') + + @skipIfNoPkgconfig + def test_link_arg_fullname(self): + ''' + Test for support of -l:libfullname.a + see: https://github.com/mesonbuild/meson/issues/9000 + https://stackoverflow.com/questions/48532868/gcc-library-option-with-a-colon-llibevent-a + ''' + testdir = os.path.join(self.unit_test_dir, '97 link full name','libtestprovider') + oldprefix = self.prefix + # install into installdir without using DESTDIR + installdir = self.installdir + self.prefix = installdir + self.init(testdir) + self.prefix=oldprefix + self.build() + self.install(use_destdir=False) + + self.new_builddir() + env = {'LIBRARY_PATH': os.path.join(installdir, self.libdir), + 'PKG_CONFIG_PATH': os.path.join(installdir, self.libdir, 'pkgconfig')} + testdir = os.path.join(self.unit_test_dir, '97 link full name','proguser') + self.init(testdir,override_envvars=env) + + # test for link with full path + with open(os.path.join(self.builddir, 'build.ninja'), encoding='utf-8') as bfile: + for line in bfile: + if 'build dprovidertest:' in line: + self.assertIn('/libtestprovider.a', line) + + if is_osx(): + # macOS's ld do not supports `--whole-archive`, skip build & run + return + + self.build(override_envvars=env) + + # skip test if pkg-config is too old. + # before v0.28, Libs flags like -Wl will not kept in context order with -l flags. + # see https://gitlab.freedesktop.org/pkg-config/pkg-config/-/blob/master/NEWS + pkgconfigver = subprocess.check_output(['pkg-config', '--version']) + if b'0.28' > pkgconfigver: + raise SkipTest('pkg-config is too old to be correctly done this.') + self.run_tests() @skipIfNoPkgconfig def test_usage_pkgconfig_prefixes(self): |