aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-11-06 15:42:09 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2017-11-11 23:06:49 +0530
commit9da031c04c9905949c896a8fdc5b608acd6dde47 (patch)
tree03dcdae8d446c45659b8651649939583bf0e339f /mesonbuild
parentd32c6729901a8da6b30c7dced565697b378677dc (diff)
downloadmeson-9da031c04c9905949c896a8fdc5b608acd6dde47.zip
meson-9da031c04c9905949c896a8fdc5b608acd6dde47.tar.gz
meson-9da031c04c9905949c896a8fdc5b608acd6dde47.tar.bz2
dependencies: Force pkg-config to output -L args
Sometimes pkg-config can decide that the libdir is a system library dir and must not be included in the output because that would mess up the library search order for pkg-config libraries that must be sourced from a non-system prefix. However, when we're doing manual searching, we always want to see the library directory even if it's the system path, otherwise we can't do manual searching at all.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/dependencies/base.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index 8d364a8..55c0900 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -259,8 +259,10 @@ class PkgConfigDependency(ExternalDependency):
return s.format(self.__class__.__name__, self.name, self.is_found,
self.version_reqs)
- def _call_pkgbin(self, args):
- p, out = Popen_safe([self.pkgbin] + args, env=os.environ)[0:2]
+ def _call_pkgbin(self, args, env=None):
+ if not env:
+ env = os.environ
+ p, out = Popen_safe([self.pkgbin] + args, env=env)[0:2]
return p.returncode, out.strip()
def _set_cargs(self):
@@ -271,10 +273,15 @@ class PkgConfigDependency(ExternalDependency):
self.compile_args = shlex.split(out)
def _set_libs(self):
+ env = None
libcmd = [self.name, '--libs']
if self.static:
libcmd.append('--static')
- ret, out = self._call_pkgbin(libcmd)
+ # 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()
+ env['PKG_CONFIG_ALLOW_SYSTEM_LIBS'] = '1'
+ ret, out = self._call_pkgbin(libcmd, env=env)
if ret != 0:
raise DependencyException('Could not generate libs for %s:\n\n%s' %
(self.name, out))