blob: 89257b9e059f9aa8c9a144c3d1e0f7deed4fbc81 [file] [log] [blame]
From 30e97d4090a3d3f5b7ddcaf27cfa17f3c8c1d462 Mon Sep 17 00:00:00 2001
From: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Date: Wed, 15 Nov 2017 15:05:01 +0100
Subject: [PATCH] native_bindir
Some libraries, like QT, have pre-processors that convert their input
files into something that the cross-compiler can process. We find the
path of those pre-processors via pkg-config-native instead of
pkg-config.
This path forces the use of pkg-config-native for host_bins arguments.
There are some discussions upstream to merge this patch, but I presonaly believe
that is is OE only. https://github.com/mesonbuild/meson/issues/1849#issuecomment-303730323
Upstream-Status: Inappropriate [OE specific]
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
---
mesonbuild/dependencies/base.py | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index 14380d4..d0c443f 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -179,7 +179,7 @@ class Dependency:
def get_exe_args(self, compiler):
return []
- def get_pkgconfig_variable(self, variable_name: str, kwargs: T.Dict[str, T.Any]) -> str:
+ def get_pkgconfig_variable(self, variable_name: str, kwargs: T.Dict[str, T.Any], use_native=False) -> str:
raise DependencyException(f'{self.name!r} is not a pkgconfig dependency')
def get_configtool_variable(self, variable_name):
@@ -267,7 +267,7 @@ class InternalDependency(Dependency):
return True
return any(d.is_built() for d in self.ext_deps)
- def get_pkgconfig_variable(self, variable_name: str, kwargs: T.Dict[str, T.Any]) -> str:
+ def get_pkgconfig_variable(self, variable_name: str, kwargs: T.Dict[str, T.Any], use_native=False) -> str:
raise DependencyException('Method "get_pkgconfig_variable()" is '
'invalid for an internal dependency')
@@ -645,8 +645,11 @@ class PkgConfigDependency(ExternalDependency):
return s.format(self.__class__.__name__, self.name, self.is_found,
self.version_reqs)
- def _call_pkgbin_real(self, args, env):
- cmd = self.pkgbin.get_command() + args
+ def _call_pkgbin_real(self, args, env, use_native=False):
+ if use_native:
+ cmd = [self.pkgbin.get_command()[0] + "-native"] + args
+ else:
+ cmd = self.pkgbin.get_command() + args
p, out, err = Popen_safe(cmd, env=env)
rc, out, err = p.returncode, out.strip(), err.strip()
call = ' '.join(cmd)
@@ -674,7 +677,7 @@ class PkgConfigDependency(ExternalDependency):
if key.startswith('PKG_'):
mlog.debug(f'env[{key}]: {value}')
- def _call_pkgbin(self, args, env=None):
+ def _call_pkgbin(self, args, env=None, use_native=False):
# Always copy the environment since we're going to modify it
# with pkg-config variables
if env is None:
@@ -688,7 +691,7 @@ class PkgConfigDependency(ExternalDependency):
targs = tuple(args)
cache = PkgConfigDependency.pkgbin_cache
if (self.pkgbin, targs, fenv) not in cache:
- cache[(self.pkgbin, targs, fenv)] = self._call_pkgbin_real(args, env)
+ cache[(self.pkgbin, targs, fenv)] = self._call_pkgbin_real(args, env, use_native)
return cache[(self.pkgbin, targs, fenv)]
def _convert_mingw_paths(self, args: T.List[str]) -> T.List[str]:
@@ -894,7 +897,7 @@ class PkgConfigDependency(ExternalDependency):
(self.name, out_raw))
self.link_args, self.raw_link_args = self._search_libs(out, out_raw)
- def get_pkgconfig_variable(self, variable_name: str, kwargs: T.Dict[str, T.Any]) -> str:
+ def get_pkgconfig_variable(self, variable_name: str, kwargs: T.Dict[str, T.Any], use_native=False) -> str:
options = ['--variable=' + variable_name, self.name]
if 'define_variable' in kwargs:
@@ -907,7 +910,7 @@ class PkgConfigDependency(ExternalDependency):
options = ['--define-variable=' + '='.join(definition)] + options
- ret, out, err = self._call_pkgbin(options)
+ ret, out, err = self._call_pkgbin(options, use_native=use_native)
variable = ''
if ret != 0:
if self.required: