Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1 | From ffa72eac56558aa4171dd70ac1e9c27a07338fa2 Mon Sep 17 00:00:00 2001 |
| 2 | From: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> |
| 3 | Date: Wed, 15 Nov 2017 15:05:01 +0100 |
| 4 | Subject: [PATCH 4/4] native_bindir |
| 5 | |
| 6 | Some libraries, like QT, have pre-processors that convert their input |
| 7 | files into something that the cross-compiler can process. We find the |
| 8 | path of those pre-processors via pkg-config-native instead of |
| 9 | pkg-config. |
| 10 | |
| 11 | This path forces the use of pkg-config-native for host_bins arguments. |
| 12 | |
| 13 | There are some discussions upstream to merge this patch, but I presonaly believe |
| 14 | that is is OE only. https://github.com/mesonbuild/meson/issues/1849#issuecomment-303730323 |
| 15 | |
| 16 | Upstream-Status: Inappropriate [OE specific] |
| 17 | Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> |
| 18 | |
| 19 | --- |
| 20 | mesonbuild/dependencies/base.py | 16 ++++++++++------ |
| 21 | mesonbuild/dependencies/ui.py | 6 +++--- |
| 22 | 2 files changed, 13 insertions(+), 9 deletions(-) |
| 23 | |
| 24 | diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py |
| 25 | index bf79bc5..c9fd08c 100644 |
| 26 | --- a/mesonbuild/dependencies/base.py |
| 27 | +++ b/mesonbuild/dependencies/base.py |
| 28 | @@ -131,7 +131,7 @@ class Dependency: |
| 29 | def need_threads(self): |
| 30 | return False |
| 31 | |
| 32 | - def get_pkgconfig_variable(self, variable_name, kwargs): |
| 33 | + def get_pkgconfig_variable(self, variable_name, kwargs, use_native=False): |
| 34 | raise DependencyException('{!r} is not a pkgconfig dependency'.format(self.name)) |
| 35 | |
| 36 | def get_configtool_variable(self, variable_name): |
| 37 | @@ -150,7 +150,7 @@ class InternalDependency(Dependency): |
| 38 | self.sources = sources |
| 39 | self.ext_deps = ext_deps |
| 40 | |
| 41 | - def get_pkgconfig_variable(self, variable_name, kwargs): |
| 42 | + def get_pkgconfig_variable(self, variable_name, kwargs, use_native=False): |
| 43 | raise DependencyException('Method "get_pkgconfig_variable()" is ' |
| 44 | 'invalid for an internal dependency') |
| 45 | |
| 46 | @@ -425,10 +425,14 @@ class PkgConfigDependency(ExternalDependency): |
| 47 | return s.format(self.__class__.__name__, self.name, self.is_found, |
| 48 | self.version_reqs) |
| 49 | |
| 50 | - def _call_pkgbin(self, args, env=None): |
| 51 | + def _call_pkgbin(self, args, env=None, use_native=False): |
| 52 | if not env: |
| 53 | env = os.environ |
| 54 | - p, out = Popen_safe([self.pkgbin] + args, env=env)[0:2] |
| 55 | + if use_native: |
| 56 | + pkgbin = [self.pkgbin + "-native"] |
| 57 | + else: |
| 58 | + pkgbin = [self.pkgbin] |
| 59 | + p, out = Popen_safe(pkgbin + args, env=env)[0:2] |
| 60 | return p.returncode, out.strip() |
| 61 | |
| 62 | def _convert_mingw_paths(self, args): |
| 63 | @@ -522,7 +526,7 @@ class PkgConfigDependency(ExternalDependency): |
| 64 | # linkers such as MSVC, so prepend them. |
| 65 | self.link_args = ['-L' + lp for lp in libpaths] + self.link_args |
| 66 | |
| 67 | - def get_pkgconfig_variable(self, variable_name, kwargs): |
| 68 | + def get_pkgconfig_variable(self, variable_name, kwargs, use_native=False): |
| 69 | options = ['--variable=' + variable_name, self.name] |
| 70 | |
| 71 | if 'define_variable' in kwargs: |
| 72 | @@ -535,7 +539,7 @@ class PkgConfigDependency(ExternalDependency): |
| 73 | |
| 74 | options = ['--define-variable=' + '='.join(definition)] + options |
| 75 | |
| 76 | - ret, out = self._call_pkgbin(options) |
| 77 | + ret, out = self._call_pkgbin(options, use_native=use_native) |
| 78 | variable = '' |
| 79 | if ret != 0: |
| 80 | if self.required: |
| 81 | diff --git a/mesonbuild/dependencies/ui.py b/mesonbuild/dependencies/ui.py |
| 82 | index 1db518c..4ed1d04 100644 |
| 83 | --- a/mesonbuild/dependencies/ui.py |
| 84 | +++ b/mesonbuild/dependencies/ui.py |
| 85 | @@ -239,7 +239,7 @@ class QtBaseDependency(ExternalDependency): |
| 86 | self.bindir = self.get_pkgconfig_host_bins(core) |
| 87 | if not self.bindir: |
| 88 | # If exec_prefix is not defined, the pkg-config file is broken |
| 89 | - prefix = core.get_pkgconfig_variable('exec_prefix', {}) |
| 90 | + prefix = core.get_pkgconfig_variable('exec_prefix', {}, use_native=True) |
| 91 | if prefix: |
| 92 | self.bindir = os.path.join(prefix, 'bin') |
| 93 | |
| 94 | @@ -359,7 +359,7 @@ class Qt4Dependency(QtBaseDependency): |
| 95 | applications = ['moc', 'uic', 'rcc', 'lupdate', 'lrelease'] |
| 96 | for application in applications: |
| 97 | try: |
| 98 | - return os.path.dirname(core.get_pkgconfig_variable('%s_location' % application, {})) |
| 99 | + return os.path.dirname(core.get_pkgconfig_variable('%s_location' % application, {}, use_native=True)) |
| 100 | except MesonException: |
| 101 | pass |
| 102 | |
| 103 | @@ -369,7 +369,7 @@ class Qt5Dependency(QtBaseDependency): |
| 104 | QtBaseDependency.__init__(self, 'qt5', env, kwargs) |
| 105 | |
| 106 | def get_pkgconfig_host_bins(self, core): |
| 107 | - return core.get_pkgconfig_variable('host_bins', {}) |
| 108 | + return core.get_pkgconfig_variable('host_bins', {}, use_native=True) |
| 109 | |
| 110 | |
| 111 | # There are three different ways of depending on SDL2: |
| 112 | -- |
| 113 | 2.15.1 |
| 114 | |