Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 1 | From e762d85c823adfefc27ba6128c7b997aa50166ce Mon Sep 17 00:00:00 2001 |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 2 | From: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> |
| 3 | Date: Wed, 15 Nov 2017 15:05:01 +0100 |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 4 | Subject: [PATCH] native_bindir |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 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 | --- |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 20 | mesonbuild/dependencies/base.py | 19 +++++++++++-------- |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 21 | mesonbuild/dependencies/ui.py | 6 +++--- |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 22 | 2 files changed, 14 insertions(+), 11 deletions(-) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 23 | |
| 24 | diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 25 | index 6d3678f..90fdb80 100644 |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 26 | --- a/mesonbuild/dependencies/base.py |
| 27 | +++ b/mesonbuild/dependencies/base.py |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 28 | @@ -146,7 +146,7 @@ class Dependency: |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 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): |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 37 | @@ -183,7 +183,7 @@ class InternalDependency(Dependency): |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 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 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 46 | @@ -523,15 +523,18 @@ class PkgConfigDependency(ExternalDependency): |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 47 | return s.format(self.__class__.__name__, self.name, self.is_found, |
| 48 | self.version_reqs) |
| 49 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 50 | - def _call_pkgbin_real(self, args, env): |
| 51 | - cmd = self.pkgbin.get_command() + args |
| 52 | + def _call_pkgbin_real(self, args, env, use_native=False): |
| 53 | + if use_native: |
| 54 | + cmd = self.pkgbin.get_command() + "-native" + args |
| 55 | + else: |
| 56 | + cmd = self.pkgbin.get_command() + args |
| 57 | p, out = Popen_safe(cmd, env=env)[0:2] |
| 58 | rc, out = p.returncode, out.strip() |
| 59 | call = ' '.join(cmd) |
| 60 | mlog.debug("Called `{}` -> {}\n{}".format(call, rc, out)) |
| 61 | return rc, out |
| 62 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 63 | - def _call_pkgbin(self, args, env=None): |
| 64 | + def _call_pkgbin(self, args, env=None, use_native=False): |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 65 | if env is None: |
| 66 | fenv = env |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 67 | env = os.environ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 68 | @@ -540,7 +543,7 @@ class PkgConfigDependency(ExternalDependency): |
| 69 | targs = tuple(args) |
| 70 | cache = PkgConfigDependency.pkgbin_cache |
| 71 | if (self.pkgbin, targs, fenv) not in cache: |
| 72 | - cache[(self.pkgbin, targs, fenv)] = self._call_pkgbin_real(args, env) |
| 73 | + cache[(self.pkgbin, targs, fenv)] = self._call_pkgbin_real(args, env, use_native) |
| 74 | return cache[(self.pkgbin, targs, fenv)] |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 75 | |
| 76 | def _convert_mingw_paths(self, args): |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 77 | @@ -718,7 +721,7 @@ class PkgConfigDependency(ExternalDependency): |
| 78 | (self.name, out_raw)) |
| 79 | self.link_args, self.raw_link_args = self._search_libs(out, out_raw) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 80 | |
| 81 | - def get_pkgconfig_variable(self, variable_name, kwargs): |
| 82 | + def get_pkgconfig_variable(self, variable_name, kwargs, use_native=False): |
| 83 | options = ['--variable=' + variable_name, self.name] |
| 84 | |
| 85 | if 'define_variable' in kwargs: |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 86 | @@ -731,7 +734,7 @@ class PkgConfigDependency(ExternalDependency): |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 87 | |
| 88 | options = ['--define-variable=' + '='.join(definition)] + options |
| 89 | |
| 90 | - ret, out = self._call_pkgbin(options) |
| 91 | + ret, out = self._call_pkgbin(options, use_native=use_native) |
| 92 | variable = '' |
| 93 | if ret != 0: |
| 94 | if self.required: |
| 95 | diff --git a/mesonbuild/dependencies/ui.py b/mesonbuild/dependencies/ui.py |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 96 | index 197d22c..c683d21 100644 |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 97 | --- a/mesonbuild/dependencies/ui.py |
| 98 | +++ b/mesonbuild/dependencies/ui.py |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 99 | @@ -285,7 +285,7 @@ class QtBaseDependency(ExternalDependency): |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 100 | self.bindir = self.get_pkgconfig_host_bins(core) |
| 101 | if not self.bindir: |
| 102 | # If exec_prefix is not defined, the pkg-config file is broken |
| 103 | - prefix = core.get_pkgconfig_variable('exec_prefix', {}) |
| 104 | + prefix = core.get_pkgconfig_variable('exec_prefix', {}, use_native=True) |
| 105 | if prefix: |
| 106 | self.bindir = os.path.join(prefix, 'bin') |
| 107 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 108 | @@ -427,7 +427,7 @@ class Qt4Dependency(QtBaseDependency): |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 109 | applications = ['moc', 'uic', 'rcc', 'lupdate', 'lrelease'] |
| 110 | for application in applications: |
| 111 | try: |
| 112 | - return os.path.dirname(core.get_pkgconfig_variable('%s_location' % application, {})) |
| 113 | + return os.path.dirname(core.get_pkgconfig_variable('%s_location' % application, {}, use_native=True)) |
| 114 | except MesonException: |
| 115 | pass |
| 116 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 117 | @@ -437,7 +437,7 @@ class Qt5Dependency(QtBaseDependency): |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 118 | QtBaseDependency.__init__(self, 'qt5', env, kwargs) |
| 119 | |
| 120 | def get_pkgconfig_host_bins(self, core): |
| 121 | - return core.get_pkgconfig_variable('host_bins', {}) |
| 122 | + return core.get_pkgconfig_variable('host_bins', {}, use_native=True) |
| 123 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 124 | def get_private_includes(self, mod_inc_dir, module): |
| 125 | return _qt_get_private_includes(mod_inc_dir, module, self.version) |