diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-06-12 20:55:19 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-06-12 20:55:19 +0530 |
commit | d23e6b34c77f1e6bee8ab475ab05e3f5250949e7 (patch) | |
tree | 795ccedcfe7195cf70990381ba23495574a2fda6 /run_unittests.py | |
parent | f792641b34a83d61a421f0d76a8c72a956bdb073 (diff) | |
download | meson-d23e6b34c77f1e6bee8ab475ab05e3f5250949e7.zip meson-d23e6b34c77f1e6bee8ab475ab05e3f5250949e7.tar.gz meson-d23e6b34c77f1e6bee8ab475ab05e3f5250949e7.tar.bz2 |
Preserve -L -l pairings fetched from external deps
While adding link args for external deps, sometimes different
libraries come from different prefixes, and an older version of the
same library might be present in other prefixes and we don't want to
accidentally pick that up.
For example:
/usr/local/lib/libglib-2.0.so
/usr/local/lib/pkgconfig/glib-2.0.pc
/usr/local/lib/libz.so
/usr/local/lib/pkgconfig/zlib.pc
/home/mesonuser/.local/lib/libglib-2.0.so
/home/mesonuser/.local/lib/pkgconfig/glib-2.0.pc
PKG_CONFIG_PATH="/home/mesonuser/.local/lib/pkgconfig/:/usr/local/lib/pkgconfig/"
If a target uses `dependencies : [glib_dep, zlib_dep]`, it will end up
using /usr/local/lib/libglib-2.0.so instead of
/home/mesonuser/.local/lib/libglib-2.0.so despite using the pkg-config
file in /home/mesonuser/.local/lib/pkgconfig because we reorder the -L
flag and separate it from the -l flag.
With this change, external link arguments will be added to the
compiler list without de-dup or reordering.
Closes https://github.com/mesonbuild/meson/issues/1718
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py index dbfd638..9f39890 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -176,6 +176,16 @@ class InternalTests(unittest.TestCase): l += ['-lbar'] self.assertEqual(l, ['-Lbardir', '-Lfoodir', '-lfoo', '-lbar']) + ## Test that 'direct' append and extend works + l = cargsfunc(c, ['-Lfoodir', '-lfoo']) + self.assertEqual(l, ['-Lfoodir', '-lfoo']) + # Direct-adding a library and a libpath appends both correctly + l.extend_direct(['-Lbardir', '-lbar']) + self.assertEqual(l, ['-Lfoodir', '-lfoo', '-Lbardir', '-lbar']) + # Direct-adding the same library again still adds it + l.append_direct('-lbar') + self.assertEqual(l, ['-Lfoodir', '-lfoo', '-Lbardir', '-lbar', '-lbar']) + def test_commonpath(self): from os.path import sep commonpath = mesonbuild.mesonlib.commonpath |