diff options
author | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2020-11-01 03:08:16 +0100 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2020-11-12 20:27:40 +0200 |
commit | d2aac3d80984b51919ecc39e50d5cec32b264580 (patch) | |
tree | 0600eb264cfbec50f4c4194baa2f0ba6cb3aa549 | |
parent | dffd66e0ff2d3c91003fc4c361382c473ed11cfa (diff) | |
download | meson-d2aac3d80984b51919ecc39e50d5cec32b264580.zip meson-d2aac3d80984b51919ecc39e50d5cec32b264580.tar.gz meson-d2aac3d80984b51919ecc39e50d5cec32b264580.tar.bz2 |
dependencies: Put pkgconfig options before operands
This fixes building with meson when the POSIX behavior of getopt is used, such as when GNU libc is used with POSIXLY_CORRECT=1 defined
-rw-r--r-- | mesonbuild/dependencies/base.py | 6 | ||||
-rwxr-xr-x | run_unittests.py | 6 | ||||
-rwxr-xr-x | test cases/common/231 external project/libfoo/configure | 2 |
3 files changed, 9 insertions, 5 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py index 3a5f5f8..87518e1 100644 --- a/mesonbuild/dependencies/base.py +++ b/mesonbuild/dependencies/base.py @@ -869,9 +869,13 @@ class PkgConfigDependency(ExternalDependency): def _set_libs(self): env = None - libcmd = [self.name, '--libs'] + libcmd = ['--libs'] + if self.static: libcmd.append('--static') + + libcmd.append(self.name) + # Force pkg-config to output -L fields even if they are system # paths so we can do manual searching with cc.find_library() later. env = os.environ.copy() diff --git a/run_unittests.py b/run_unittests.py index f0c2f65..7b1a37d 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -885,11 +885,11 @@ class InternalTests(unittest.TestCase): def fake_call_pkgbin(self, args, env=None): if '--libs' not in args: return 0, '', '' - if args[0] == 'foo': + if args[-1] == 'foo': return 0, '-L{} -lfoo -L{} -lbar'.format(p2.as_posix(), p1.as_posix()), '' - if args[0] == 'bar': + if args[-1] == 'bar': return 0, '-L{} -lbar'.format(p2.as_posix()), '' - if args[0] == 'internal': + if args[-1] == 'internal': return 0, '-L{} -lpthread -lm -lc -lrt -ldl'.format(p1.as_posix()), '' old_call = PkgConfigDependency._call_pkgbin diff --git a/test cases/common/231 external project/libfoo/configure b/test cases/common/231 external project/libfoo/configure index a867b48..0e4aa72 100755 --- a/test cases/common/231 external project/libfoo/configure +++ b/test cases/common/231 external project/libfoo/configure @@ -27,7 +27,7 @@ case $i in esac done -DEP_ARGS=$(pkg-config somelib --cflags --libs) +DEP_ARGS=$(pkg-config --cflags --libs somelib) cat > Makefile << EOL all: libfoo.$LIBEXT |