diff options
Diffstat (limited to 'poky/meta/recipes-devtools/meson')
12 files changed, 368 insertions, 85 deletions
diff --git a/poky/meta/recipes-devtools/meson/meson_0.44.1.bb b/poky/meta/recipes-devtools/meson/meson.inc index 6a81dab26..b7fb3e698 100644 --- a/poky/meta/recipes-devtools/meson/meson_0.44.1.bb +++ b/poky/meta/recipes-devtools/meson/meson.inc @@ -4,18 +4,25 @@ SUMMARY = "A high performance build system" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://COPYING;md5=3b83ef96387f14655fc854ddc3c6bd57" -SRC_URI = "https://github.com/mesonbuild/meson/releases/download/${PV}/${BP}.tar.gz \ +SRC_URI = "https://github.com/mesonbuild/meson/releases/download/${PV}/meson-${PV}.tar.gz \ file://0001-gtkdoc-fix-issues-that-arise-when-cross-compiling.patch \ file://0002-gobject-introspection-determine-g-ir-scanner-and-g-i.patch \ file://0001-Linker-rules-move-cross_args-in-front-of-output_args.patch \ file://0003-native_bindir.patch \ + file://gi-flags.patch \ + file://gtkdoc-flags.patch \ " -SRC_URI[md5sum] = "82b1198bf714b5a4da84bfe8376c79cc" -SRC_URI[sha256sum] = "2ea1a721574adb23160b6481191bcc1173f374e02b0ff3bb0ae85d988d97e4fa" +SRC_URI[sha256sum] = "92d8afd921751261e36151643464efd3394162f69efbe8cd53e0a66b1cf395eb" +SRC_URI[md5sum] = "31bda3519d8c0eb3438267268a78085e" + +SRC_URI_append_class-native = "file://0002-Make-CPU-family-warnings-fatal.patch \ + file://0001-Support-building-allarch-recipes-again.patch \ + " + UPSTREAM_CHECK_URI = "https://github.com/mesonbuild/meson/releases" inherit setuptools3 RDEPENDS_${PN} = "ninja python3-core python3-modules" -BBCLASSEXTEND = "native" +FILES_${PN} += "${datadir}/polkit-1" diff --git a/poky/meta/recipes-devtools/meson/meson/0001-Support-building-allarch-recipes-again.patch b/poky/meta/recipes-devtools/meson/meson/0001-Support-building-allarch-recipes-again.patch new file mode 100644 index 000000000..f6dd23091 --- /dev/null +++ b/poky/meta/recipes-devtools/meson/meson/0001-Support-building-allarch-recipes-again.patch @@ -0,0 +1,28 @@ +From d80d02a3ca6e21fa3d055c88c05234c2eb4db128 Mon Sep 17 00:00:00 2001 +From: Peter Kjellerstedt <pkj@axis.com> +Date: Thu, 26 Jul 2018 16:32:49 +0200 +Subject: [PATCH] Support building allarch recipes again + +This registers "allarch" as a known CPU family. + +Upstream-Status: Inappropriate [OE specific] +Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> +--- + mesonbuild/environment.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py +index a0580a2..712b1e8 100644 +--- a/mesonbuild/environment.py ++++ b/mesonbuild/environment.py +@@ -73,6 +73,7 @@ from .compilers import ( + build_filename = 'meson.build' + + known_cpu_families = ( ++ 'allarch', + 'aarch64', + 'arm', + 'e2k', +-- +2.12.0 + diff --git a/poky/meta/recipes-devtools/meson/meson/0001-gtkdoc-fix-issues-that-arise-when-cross-compiling.patch b/poky/meta/recipes-devtools/meson/meson/0001-gtkdoc-fix-issues-that-arise-when-cross-compiling.patch index 1912e9435..7ffd6c54c 100644 --- a/poky/meta/recipes-devtools/meson/meson/0001-gtkdoc-fix-issues-that-arise-when-cross-compiling.patch +++ b/poky/meta/recipes-devtools/meson/meson/0001-gtkdoc-fix-issues-that-arise-when-cross-compiling.patch @@ -1,7 +1,7 @@ -From c5692cac9c555664281377a82bf8b1e46934f437 Mon Sep 17 00:00:00 2001 +From 3ac4e58c5494bd7e603a325b5b5c2b8075849fee Mon Sep 17 00:00:00 2001 From: Alexander Kanavin <alex.kanavin@gmail.com> Date: Fri, 4 Aug 2017 16:16:41 +0300 -Subject: [PATCH 1/3] gtkdoc: fix issues that arise when cross-compiling +Subject: [PATCH] gtkdoc: fix issues that arise when cross-compiling Specifically: 1) Make it possible to specify a wrapper for executing binaries @@ -21,10 +21,10 @@ Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py -index 56765a5..4f7fe30 100644 +index cb69641..727eb6a 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py -@@ -769,6 +769,10 @@ This will become a hard error in the future.''') +@@ -792,6 +792,10 @@ This will become a hard error in the future.''') '--mode=' + mode] if namespace: args.append('--namespace=' + namespace) @@ -35,53 +35,28 @@ index 56765a5..4f7fe30 100644 args += self._unpack_args('--htmlargs=', 'html_args', kwargs) args += self._unpack_args('--scanargs=', 'scan_args', kwargs) args += self._unpack_args('--scanobjsargs=', 'scanobjs_args', kwargs) -@@ -796,14 +800,22 @@ This will become a hard error in the future.''') - raise MesonException( - 'Gir include dirs should be include_directories().') - cflags.update(get_include_args(inc_dirs)) -+ -+ cross_c_args = " ".join(state.environment.cross_info.config["properties"].get('c_args', "")) -+ cross_link_args = " ".join(state.environment.cross_info.config["properties"].get('c_link_args', "")) -+ - if cflags: -- args += ['--cflags=%s' % ' '.join(cflags)] -+ args += ['--cflags=%s %s' % (cross_c_args,' '.join(cflags))] - if ldflags: -- args += ['--ldflags=%s' % ' '.join(ldflags)] -+ args += ['--ldflags=%s %s' % (cross_link_args, ' '.join(ldflags))] - compiler = state.environment.coredata.compilers.get('c') -- if compiler: -+ cross_compiler = state.environment.coredata.cross_compilers.get('c') -+ if compiler and not state.environment.is_cross_build(): - args += ['--cc=%s' % ' '.join(compiler.get_exelist())] - args += ['--ld=%s' % ' '.join(compiler.get_linker_exelist())] -+ elif cross_compiler and state.environment.is_cross_build(): -+ args += ['--cc=%s' % ' '.join(cross_compiler.get_exelist())] -+ args += ['--ld=%s' % ' '.join(cross_compiler.get_linker_exelist())] - - return args - diff --git a/mesonbuild/scripts/gtkdochelper.py b/mesonbuild/scripts/gtkdochelper.py -index 4406b28..b846827 100644 +index 948dc5a..9c5bd19 100644 --- a/mesonbuild/scripts/gtkdochelper.py +++ b/mesonbuild/scripts/gtkdochelper.py -@@ -44,13 +44,14 @@ parser.add_argument('--ignore-headers', dest='ignore_headers', default='') +@@ -45,6 +45,7 @@ parser.add_argument('--ignore-headers', dest='ignore_headers', default='') parser.add_argument('--namespace', dest='namespace', default='') parser.add_argument('--mode', dest='mode', default='') parser.add_argument('--installdir', dest='install_dir') +parser.add_argument('--gtkdoc-exe-wrapper', dest='gtkdoc_exe_wrapper') - def gtkdoc_run_check(cmd, cwd): - # Put stderr into stdout since we want to print it out anyway. + def gtkdoc_run_check(cmd, cwd, library_paths=None): + if library_paths is None: +@@ -64,7 +65,7 @@ def gtkdoc_run_check(cmd, cwd, library_paths=None): # This preserves the order of messages. - p, out = Popen_safe(cmd, cwd=cwd, stderr=subprocess.STDOUT)[0:2] + p, out = Popen_safe(cmd, cwd=cwd, env=env, stderr=subprocess.STDOUT)[0:2] if p.returncode != 0: - err_msg = ["{!r} failed with status {:d}".format(cmd[0], p.returncode)] + err_msg = ["{!r} failed with status {:d}".format(cmd, p.returncode)] if out: err_msg.append(out) raise MesonException('\n'.join(err_msg)) -@@ -58,7 +59,7 @@ def gtkdoc_run_check(cmd, cwd): +@@ -74,7 +75,7 @@ def gtkdoc_run_check(cmd, cwd, library_paths=None): def build_gtkdoc(source_root, build_root, doc_subdir, src_subdirs, main_file, module, html_args, scan_args, fixxref_args, mkdb_args, @@ -90,7 +65,7 @@ index 4406b28..b846827 100644 html_assets, content_files, ignore_headers, namespace, expand_content_files, mode): print("Building documentation for %s" % module) -@@ -111,6 +112,9 @@ def build_gtkdoc(source_root, build_root, doc_subdir, src_subdirs, +@@ -135,6 +136,9 @@ def build_gtkdoc(source_root, build_root, doc_subdir, src_subdirs, if gobject_typesfile: scanobjs_cmd = ['gtkdoc-scangobj'] + scanobjs_args + ['--types=' + gobject_typesfile, '--module=' + module, @@ -99,8 +74,8 @@ index 4406b28..b846827 100644 + '--ld=' + ld, '--cflags=' + cflags, '--ldflags=' + ldflags, - '--ld=' + ld] -@@ -207,6 +211,7 @@ def run(args): + '--cc=' + cc, +@@ -238,6 +242,7 @@ def run(args): mkdbargs, options.gobject_typesfile, scanobjsargs, @@ -108,6 +83,3 @@ index 4406b28..b846827 100644 options.ld, options.cc, options.ldflags, --- -2.15.0 - diff --git a/poky/meta/recipes-devtools/meson/meson/0002-Make-CPU-family-warnings-fatal.patch b/poky/meta/recipes-devtools/meson/meson/0002-Make-CPU-family-warnings-fatal.patch new file mode 100644 index 000000000..ca56a6a8b --- /dev/null +++ b/poky/meta/recipes-devtools/meson/meson/0002-Make-CPU-family-warnings-fatal.patch @@ -0,0 +1,36 @@ +From 2e8553fc01e62ebc4faa240bf20984a8a0ac7387 Mon Sep 17 00:00:00 2001 +From: Ross Burton <ross.burton@intel.com> +Date: Tue, 3 Jul 2018 13:59:09 +0100 +Subject: [PATCH] Make CPU family warnings fatal + +Upstream-Status: Inappropriate [OE specific] +Signed-off-by: Ross Burton <ross.burton@intel.com> + +--- + mesonbuild/environment.py | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py +index d29a77f..267acf9 100644 +--- a/mesonbuild/environment.py ++++ b/mesonbuild/environment.py +@@ -239,9 +239,7 @@ def detect_cpu_family(compilers): + return 'x86_64' + + if trial not in known_cpu_families: +- mlog.warning('Unknown CPU family {!r}, please report this at ' +- 'https://github.com/mesonbuild/meson/issues/new with the' +- 'output of `uname -a` and `cat /proc/cpuinfo`'.format(trial)) ++ raise EnvironmentException('Unknown CPU family %s, see https://wiki.yoctoproject.org/wiki/Meson/UnknownCPU for directions.' % trial) + + return trial + +@@ -1014,7 +1012,7 @@ class CrossBuildInfo: + raise EnvironmentException('Malformed value in cross file variable %s.' % entry) + + if entry == 'cpu_family' and res not in known_cpu_families: +- mlog.warning('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % value) ++ raise EnvironmentException('Unknown CPU family %s, see https://wiki.yoctoproject.org/wiki/Meson/UnknownCPU for directions.' % value) + + if self.ok_type(res): + self.config[s][entry] = res diff --git a/poky/meta/recipes-devtools/meson/meson/0002-gobject-introspection-determine-g-ir-scanner-and-g-i.patch b/poky/meta/recipes-devtools/meson/meson/0002-gobject-introspection-determine-g-ir-scanner-and-g-i.patch index ded42d14f..f32267d0c 100644 --- a/poky/meta/recipes-devtools/meson/meson/0002-gobject-introspection-determine-g-ir-scanner-and-g-i.patch +++ b/poky/meta/recipes-devtools/meson/meson/0002-gobject-introspection-determine-g-ir-scanner-and-g-i.patch @@ -1,7 +1,7 @@ -From 972667e0d789a6969a5d79249404f3539f891810 Mon Sep 17 00:00:00 2001 +From 0b860cb8a22ae876b6088939dbabca216bc29431 Mon Sep 17 00:00:00 2001 From: Alexander Kanavin <alex.kanavin@gmail.com> Date: Fri, 4 Aug 2017 16:18:47 +0300 -Subject: [PATCH 1/2] gobject-introspection: determine g-ir-scanner and +Subject: [PATCH] gobject-introspection: determine g-ir-scanner and g-ir-compiler paths from pkgconfig Do not hardcode the name of those binaries; gobject-introspection @@ -16,19 +16,19 @@ Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py -index 4f7fe30..9610cf6 100644 +index b29bab9..dc4c401 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py -@@ -390,8 +390,6 @@ class GnomeModule(ExtensionModule): +@@ -393,8 +393,6 @@ class GnomeModule(ExtensionModule): raise MesonException('Gir takes one argument') if kwargs.get('install_dir'): raise MesonException('install_dir is not supported with generate_gir(), see "install_dir_gir" and "install_dir_typelib"') -- giscanner = find_program('g-ir-scanner', 'Gir') -- gicompiler = find_program('g-ir-compiler', 'Gir') +- giscanner = self.interpreter.find_program_impl('g-ir-scanner') +- gicompiler = self.interpreter.find_program_impl('g-ir-compiler') girtarget = args[0] while hasattr(girtarget, 'held_object'): girtarget = girtarget.held_object -@@ -402,6 +400,8 @@ class GnomeModule(ExtensionModule): +@@ -405,6 +403,8 @@ class GnomeModule(ExtensionModule): self.gir_dep = PkgConfigDependency('gobject-introspection-1.0', state.environment, {'native': True}) @@ -37,6 +37,3 @@ index 4f7fe30..9610cf6 100644 pkgargs = self.gir_dep.get_compile_args() except Exception: raise MesonException('gobject-introspection dependency was not found, gir cannot be generated.') --- -2.15.0 - diff --git a/poky/meta/recipes-devtools/meson/meson/0003-native_bindir.patch b/poky/meta/recipes-devtools/meson/meson/0003-native_bindir.patch index af5e6a190..da477454c 100644 --- a/poky/meta/recipes-devtools/meson/meson/0003-native_bindir.patch +++ b/poky/meta/recipes-devtools/meson/meson/0003-native_bindir.patch @@ -1,7 +1,7 @@ -From ffa72eac56558aa4171dd70ac1e9c27a07338fa2 Mon Sep 17 00:00:00 2001 +From e762d85c823adfefc27ba6128c7b997aa50166ce 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 4/4] native_bindir +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 @@ -17,15 +17,15 @@ Upstream-Status: Inappropriate [OE specific] Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> --- - mesonbuild/dependencies/base.py | 16 ++++++++++------ + mesonbuild/dependencies/base.py | 19 +++++++++++-------- mesonbuild/dependencies/ui.py | 6 +++--- - 2 files changed, 13 insertions(+), 9 deletions(-) + 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py -index bf79bc5..c9fd08c 100644 +index 6d3678f..90fdb80 100644 --- a/mesonbuild/dependencies/base.py +++ b/mesonbuild/dependencies/base.py -@@ -131,7 +131,7 @@ class Dependency: +@@ -146,7 +146,7 @@ class Dependency: def need_threads(self): return False @@ -34,7 +34,7 @@ index bf79bc5..c9fd08c 100644 raise DependencyException('{!r} is not a pkgconfig dependency'.format(self.name)) def get_configtool_variable(self, variable_name): -@@ -150,7 +150,7 @@ class InternalDependency(Dependency): +@@ -183,7 +183,7 @@ class InternalDependency(Dependency): self.sources = sources self.ext_deps = ext_deps @@ -43,33 +43,47 @@ index bf79bc5..c9fd08c 100644 raise DependencyException('Method "get_pkgconfig_variable()" is ' 'invalid for an internal dependency') -@@ -425,10 +425,14 @@ class PkgConfigDependency(ExternalDependency): +@@ -523,15 +523,18 @@ 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() + "-native" + args ++ else: ++ cmd = self.pkgbin.get_command() + args + p, out = Popen_safe(cmd, env=env)[0:2] + rc, out = p.returncode, out.strip() + call = ' '.join(cmd) + mlog.debug("Called `{}` -> {}\n{}".format(call, rc, out)) + return rc, out + - def _call_pkgbin(self, args, env=None): + def _call_pkgbin(self, args, env=None, use_native=False): - if not env: + if env is None: + fenv = env env = os.environ -- p, out = Popen_safe([self.pkgbin] + args, env=env)[0:2] -+ if use_native: -+ pkgbin = [self.pkgbin + "-native"] -+ else: -+ pkgbin = [self.pkgbin] -+ p, out = Popen_safe(pkgbin + args, env=env)[0:2] - return p.returncode, out.strip() +@@ -540,7 +543,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): -@@ -522,7 +526,7 @@ class PkgConfigDependency(ExternalDependency): - # linkers such as MSVC, so prepend them. - self.link_args = ['-L' + lp for lp in libpaths] + self.link_args +@@ -718,7 +721,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, kwargs): + def get_pkgconfig_variable(self, variable_name, kwargs, use_native=False): options = ['--variable=' + variable_name, self.name] if 'define_variable' in kwargs: -@@ -535,7 +539,7 @@ class PkgConfigDependency(ExternalDependency): +@@ -731,7 +734,7 @@ class PkgConfigDependency(ExternalDependency): options = ['--define-variable=' + '='.join(definition)] + options @@ -79,10 +93,10 @@ index bf79bc5..c9fd08c 100644 if ret != 0: if self.required: diff --git a/mesonbuild/dependencies/ui.py b/mesonbuild/dependencies/ui.py -index 1db518c..4ed1d04 100644 +index 197d22c..c683d21 100644 --- a/mesonbuild/dependencies/ui.py +++ b/mesonbuild/dependencies/ui.py -@@ -239,7 +239,7 @@ class QtBaseDependency(ExternalDependency): +@@ -285,7 +285,7 @@ class QtBaseDependency(ExternalDependency): self.bindir = self.get_pkgconfig_host_bins(core) if not self.bindir: # If exec_prefix is not defined, the pkg-config file is broken @@ -91,7 +105,7 @@ index 1db518c..4ed1d04 100644 if prefix: self.bindir = os.path.join(prefix, 'bin') -@@ -359,7 +359,7 @@ class Qt4Dependency(QtBaseDependency): +@@ -427,7 +427,7 @@ class Qt4Dependency(QtBaseDependency): applications = ['moc', 'uic', 'rcc', 'lupdate', 'lrelease'] for application in applications: try: @@ -100,15 +114,12 @@ index 1db518c..4ed1d04 100644 except MesonException: pass -@@ -369,7 +369,7 @@ class Qt5Dependency(QtBaseDependency): +@@ -437,7 +437,7 @@ class Qt5Dependency(QtBaseDependency): QtBaseDependency.__init__(self, 'qt5', env, kwargs) def get_pkgconfig_host_bins(self, core): - return core.get_pkgconfig_variable('host_bins', {}) + return core.get_pkgconfig_variable('host_bins', {}, use_native=True) - - # There are three different ways of depending on SDL2: --- -2.15.1 - + def get_private_includes(self, mod_inc_dir, module): + return _qt_get_private_includes(mod_inc_dir, module, self.version) diff --git a/poky/meta/recipes-devtools/meson/meson/gi-flags.patch b/poky/meta/recipes-devtools/meson/meson/gi-flags.patch new file mode 100644 index 000000000..9a4c29619 --- /dev/null +++ b/poky/meta/recipes-devtools/meson/meson/gi-flags.patch @@ -0,0 +1,35 @@ +Pass the correct cflags/ldflags to the gobject-introspection tools. + +Upstream-Status: Submitted [https://github.com/mesonbuild/meson/pull/4261] +Signed-off-by: Ross Burton <ross.burton@intel.com> + +diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py +index cb69641e..bb4449a0 100644 +--- a/mesonbuild/modules/gnome.py ++++ b/mesonbuild/modules/gnome.py +@@ -579,7 +579,10 @@ class GnomeModule(ExtensionModule): + external_ldflags += list(dep_external_ldflags) + scan_command += ['--cflags-begin'] + scan_command += cflags +- scan_command += state.environment.coredata.get_external_args(lang) ++ if state.environment.is_cross_build(): ++ scan_command += state.environment.cross_info.config["properties"].get(lang + '_args', "") ++ else: ++ scan_command += state.environment.coredata.get_external_args(lang) + scan_command += ['--cflags-end'] + # need to put our output directory first as we need to use the + # generated libraries instead of any possibly installed system/prefix +@@ -614,7 +614,12 @@ class GnomeModule(ExtensionModule): + scan_command.append('-L' + d) + scan_command += ['--library', libname] + +- for link_arg in state.environment.coredata.get_external_link_args(lang): ++ if state.environment.is_cross_build(): ++ link_args = state.environment.cross_info.config["properties"].get(lang + '_link_args', "") ++ else: ++ link_args = state.environment.coredata.get_external_link_args(lang) ++ ++ for link_arg in link_args: + if link_arg.startswith('-L'): + scan_command.append(link_arg) + scan_command += list(external_ldflags) diff --git a/poky/meta/recipes-devtools/meson/meson/gtkdoc-flags.patch b/poky/meta/recipes-devtools/meson/meson/gtkdoc-flags.patch new file mode 100644 index 000000000..ecf3489bb --- /dev/null +++ b/poky/meta/recipes-devtools/meson/meson/gtkdoc-flags.patch @@ -0,0 +1,44 @@ +Ensure that in a cross compile only the target flags are passed to gtk-doc, and +not the native flags. + +Upstream-Status: Submitted [https://github.com/mesonbuild/meson/pull/4261] +Signed-off-by: Ross Burton <ross.burton@intel.com> + +diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py +index 4af33304..8751f53c 100644 +--- a/mesonbuild/modules/gnome.py ++++ b/mesonbuild/modules/gnome.py +@@ -851,17 +851,30 @@ This will become a hard error in the future.''') + if not isinstance(incd.held_object, (str, build.IncludeDirs)): + raise MesonException( + 'Gir include dirs should be include_directories().') ++ + cflags.update(get_include_args(inc_dirs)) +- cflags.update(state.environment.coredata.get_external_args('c')) ++ if state.environment.is_cross_build(): ++ cflags.update(state.environment.cross_info.config["properties"].get('c_args', "")) ++ else: ++ cflags.update(state.environment.coredata.get_external_args('c')) ++ + ldflags = OrderedSet() + ldflags.update(internal_ldflags) +- ldflags.update(state.environment.coredata.get_external_link_args('c')) ++ if state.environment.is_cross_build(): ++ ldflags.update(state.environment.cross_info.config["properties"].get('c_link_args', "")) ++ else: ++ ldflags.update(state.environment.coredata.get_external_link_args('c')) + ldflags.update(external_ldflags) ++ + if cflags: + args += ['--cflags=%s' % ' '.join(cflags)] + if ldflags: + args += ['--ldflags=%s' % ' '.join(ldflags)] +- compiler = state.environment.coredata.compilers.get('c') ++ ++ if state.environment.is_cross_build(): ++ compiler = state.environment.coredata.cross_compilers.get('c') ++ else: ++ compiler = state.environment.coredata.compilers.get('c') + if compiler: + args += ['--cc=%s' % ' '.join(compiler.get_exelist())] + args += ['--ld=%s' % ' '.join(compiler.get_linker_exelist())] diff --git a/poky/meta/recipes-devtools/meson/meson/meson-setup.py b/poky/meta/recipes-devtools/meson/meson/meson-setup.py new file mode 100755 index 000000000..a9749eae9 --- /dev/null +++ b/poky/meta/recipes-devtools/meson/meson/meson-setup.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 + +import os +import sys + +def bail(msg): + print(msg, file=sys.stderr) + sys.exit(1) + +_MARKER = '@@' +def transform_line(line): + # Substitute any special markers of this form: + # @@ENV@@ + # with the value of ENV, split into meson array syntax. + start = line.find(_MARKER) + if start == -1: + return line + + end = line.rfind(_MARKER) + if end == start: + return line + + # Lookup value of the env var. + var = line[start+len(_MARKER):end] + try: + val = os.environ[var] + except KeyError: + bail('cannot generate meson.cross; env var %s not set' % var) + + # Transform into meson array. + val = ["'%s'" % x for x in val.split()] + val = ', '.join(val) + val = '[%s]' % val + + before = line[:start] + after = line[end+len(_MARKER):] + + return '%s%s%s' % (before, val, after) + +# Make sure this is really an SDK extraction environment. +try: + sysroot = os.environ['OECORE_NATIVE_SYSROOT'] +except KeyError: + bail('OECORE_NATIVE_SYSROOT env var must be set') + +cross_file = os.path.join(sysroot, 'usr/share/meson/meson.cross') +tmp_cross_file = '%s.tmp' % cross_file + +# Read through and transform the current meson.cross. +lines = [] +with open(cross_file, 'r') as f: + for line in f: + lines.append(transform_line(line)) + +# Write the transformed result to a tmp file and atomically rename it. In case +# we crash during the file write, we don't want an invalid meson.cross file. +with open(tmp_cross_file, 'w') as f: + for line in lines: + f.write(line) + f.flush() + os.fdatasync(f.fileno()) +os.rename(tmp_cross_file, cross_file) diff --git a/poky/meta/recipes-devtools/meson/meson/meson-wrapper b/poky/meta/recipes-devtools/meson/meson/meson-wrapper new file mode 100755 index 000000000..b2e00da51 --- /dev/null +++ b/poky/meta/recipes-devtools/meson/meson/meson-wrapper @@ -0,0 +1,14 @@ +#!/bin/sh + +if [ -z "$OECORE_NATIVE_SYSROOT" ]; then + echo "OECORE_NATIVE_SYSROOT not set; are you in a Yocto SDK environment?" >&2 +fi + +# If these are set to a cross-compile path, meson will get confused and try to +# use them as native tools. Unset them to prevent this, as all the cross-compile +# config is already in meson.cross. +unset CC CXX CPP LD AR NM STRIP + +exec "$OECORE_NATIVE_SYSROOT/usr/bin/meson.real" \ + --cross-file "$OECORE_NATIVE_SYSROOT/usr/share/meson/meson.cross" \ + "$@" diff --git a/poky/meta/recipes-devtools/meson/meson_0.47.2.bb b/poky/meta/recipes-devtools/meson/meson_0.47.2.bb new file mode 100644 index 000000000..897fa148d --- /dev/null +++ b/poky/meta/recipes-devtools/meson/meson_0.47.2.bb @@ -0,0 +1,3 @@ +include meson.inc + +BBCLASSEXTEND = "native" diff --git a/poky/meta/recipes-devtools/meson/nativesdk-meson_0.47.2.bb b/poky/meta/recipes-devtools/meson/nativesdk-meson_0.47.2.bb new file mode 100644 index 000000000..53503aa99 --- /dev/null +++ b/poky/meta/recipes-devtools/meson/nativesdk-meson_0.47.2.bb @@ -0,0 +1,74 @@ +include meson.inc + +inherit nativesdk + +SRC_URI += "file://meson-setup.py \ + file://meson-wrapper" + +def meson_array(var, d): + return "', '".join(d.getVar(var).split()).join(("'", "'")) + +# both are required but not used by meson +MESON_SDK_ENDIAN = "bogus-endian" +MESON_TARGET_ENDIAN = "bogus-endian" + +MESON_TOOLCHAIN_ARGS = "${BUILDSDK_CC_ARCH}${TOOLCHAIN_OPTIONS}" +MESON_C_ARGS = "${MESON_TOOLCHAIN_ARGS} ${BUILDSDK_CFLAGS}" +MESON_CPP_ARGS = "${MESON_TOOLCHAIN_ARGS} ${BUILDSDK_CXXFLAGS}" +MESON_LINK_ARGS = "${MESON_TOOLCHAIN_ARGS} ${BUILDSDK_LDFLAGS}" + +# This logic is similar but not identical to that in meson.bbclass, since it's +# generating for an SDK rather than a cross-compile. Important differences are: +# - We can't set vars like CC, CXX, etc. yet because they will be filled in with +# real paths by meson-setup.sh when the SDK is extracted. +# - Some overrides aren't needed, since the SDK injects paths that take care of +# them. +addtask write_config before do_install +do_write_config[vardeps] += "MESON_C_ARGS MESON_CPP_ARGS MESON_LINK_ARGS CC CXX LD AR NM STRIP READELF" +do_write_config() { + # This needs to be Py to split the args into single-element lists + cat >${WORKDIR}/meson.cross <<EOF +[binaries] +c = @@CC@@ +cpp = @@CXX@@ +ar = @@AR@@ +nm = @@NM@@ +ld = @@LD@@ +strip = @@STRIP@@ +pkgconfig = 'pkg-config' + +[properties] +needs_exe_wrapper = true +c_args = @@CFLAGS@@ +c_link_args = @@LDFLAGS@@ +cpp_args = @@CPPFLAGS@@ +cpp_link_args = @@LDFLAGS@@ + +[host_machine] +system = '${SDK_OS}' +cpu_family = '${SDK_ARCH}' +cpu = '${SDK_ARCH}' +endian = '${MESON_SDK_ENDIAN}' +EOF +} + +do_install_append() { + install -d ${D}${datadir}/meson + install -m 0644 ${WORKDIR}/meson.cross ${D}${datadir}/meson/ + + install -d ${D}${SDKPATHNATIVE}/post-relocate-setup.d + install -m 0755 ${WORKDIR}/meson-setup.py ${D}${SDKPATHNATIVE}/post-relocate-setup.d/ + + # We need to wrap the real meson with a thin env setup wrapper. + mv ${D}${bindir}/meson ${D}${bindir}/meson.real + install -m 0755 ${WORKDIR}/meson-wrapper ${D}${bindir}/meson +} + +RDEPENDS_${PN} += "\ + nativesdk-ninja \ + nativesdk-python3-core \ + nativesdk-python3-misc \ + nativesdk-python3-modules \ + " + +FILES_${PN} += "${datadir}/meson ${SDKPATHNATIVE}" |