reset upstream subtrees to HEAD

Reset the following subtrees on HEAD:
  poky: 8217b477a1(master)
  meta-xilinx: 64aa3d35ae(master)
  meta-openembedded: 0435c9e193(master)
  meta-raspberrypi: 490a4441ac(master)
  meta-security: cb6d1c85ee(master)

Squashed patches:
  meta-phosphor: drop systemd 239 patches
  meta-phosphor: mrw-api: use correct install path

Change-Id: I268e2646d9174ad305630c6bbd3fbc1a6105f43d
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/poky/meta/recipes-devtools/meson/meson.inc b/poky/meta/recipes-devtools/meson/meson.inc
index 61b2391..2d18f72 100644
--- a/poky/meta/recipes-devtools/meson/meson.inc
+++ b/poky/meta/recipes-devtools/meson/meson.inc
@@ -9,17 +9,20 @@
            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 \
            file://0001-python-module-do-not-manipulate-the-environment-when.patch \
            file://disable-rpath-handling.patch \
+           file://0001-modules-windows-split-WINDRES-env-variable.patch \
+           file://0002-environment.py-detect-windows-also-if-the-system-str.patch \
+           file://cross-prop-default.patch \
+           file://many-cross.patch \
+           file://cross-libdir.patch \
            "
-SRC_URI[sha256sum] = "92d8afd921751261e36151643464efd3394162f69efbe8cd53e0a66b1cf395eb"
-SRC_URI[md5sum] = "31bda3519d8c0eb3438267268a78085e"
+SRC_URI[sha256sum] = "ef9f14326ec1e30d3ba1a26df0f92826ede5a79255ad723af78a2691c37109fd"
+SRC_URI[md5sum] = "0267b0871266056184c484792572c682"
 
 SRC_URI_append_class-native = " \
-    file://0002-Make-CPU-family-warnings-fatal.patch \
-    file://0001-Support-building-allarch-recipes-again.patch \
+    file://0001-Make-CPU-family-warnings-fatal.patch \
+    file://0002-Support-building-allarch-recipes-again.patch \
 "
 
 UPSTREAM_CHECK_URI = "https://github.com/mesonbuild/meson/releases"
diff --git a/poky/meta/recipes-devtools/meson/meson/0001-Make-CPU-family-warnings-fatal.patch b/poky/meta/recipes-devtools/meson/meson/0001-Make-CPU-family-warnings-fatal.patch
new file mode 100644
index 0000000..fbc3f5a
--- /dev/null
+++ b/poky/meta/recipes-devtools/meson/meson/0001-Make-CPU-family-warnings-fatal.patch
@@ -0,0 +1,36 @@
+From 2db829d865bb6464ac15dbb4a58c9a675e296866 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 2ccd31e..5fcf9df 100644
+--- a/mesonbuild/environment.py
++++ b/mesonbuild/environment.py
+@@ -265,9 +265,7 @@ def detect_cpu_family(compilers):
+     # below.
+ 
+     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
+ 
+@@ -1232,7 +1230,7 @@ class MachineInfo:
+ 
+         cpu_family = literal['cpu_family']
+         if cpu_family not in known_cpu_families:
+-            mlog.warning('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % cpu_family)
++            raise EnvironmentException('Unknown CPU family %s, see https://wiki.yoctoproject.org/wiki/Meson/UnknownCPU for directions.' % cpu_family)
+ 
+         endian = literal['endian']
+         if endian not in ('little', 'big'):
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
deleted file mode 100644
index 96be104..0000000
--- a/poky/meta/recipes-devtools/meson/meson/0001-Support-building-allarch-recipes-again.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-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(+)
-
-Index: meson-0.47.2/mesonbuild/environment.py
-===================================================================
---- meson-0.47.2.orig/mesonbuild/environment.py
-+++ meson-0.47.2/mesonbuild/environment.py
-@@ -75,6 +75,7 @@ from .compilers import (
- build_filename = 'meson.build'
- 
- known_cpu_families = (
-+    'allarch',
-     'aarch64',
-     'arm',
-     'e2k',
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 7ffd6c5..11fd9ed 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,4 +1,4 @@
-From 3ac4e58c5494bd7e603a325b5b5c2b8075849fee Mon Sep 17 00:00:00 2001
+From 1afbf5ccff56e582229c8f673f50aedf2b24117e 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] gtkdoc: fix issues that arise when cross-compiling
@@ -16,70 +16,21 @@
 Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
 
 ---
- mesonbuild/modules/gnome.py        | 18 +++++++++++++++---
- mesonbuild/scripts/gtkdochelper.py |  9 +++++++--
- 2 files changed, 22 insertions(+), 5 deletions(-)
+ mesonbuild/modules/gnome.py | 4 ++++
+ 1 file changed, 4 insertions(+)
 
 diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
-index cb69641..727eb6a 100644
+index bf49770..7c5a363 100644
 --- a/mesonbuild/modules/gnome.py
 +++ b/mesonbuild/modules/gnome.py
-@@ -792,6 +792,10 @@ This will become a hard error in the future.''')
+@@ -972,6 +972,10 @@ This will become a hard error in the future.''')
                  '--mode=' + mode]
          if namespace:
              args.append('--namespace=' + namespace)
 +        gtkdoc_exe_wrapper = state.environment.cross_info.config["properties"].get('gtkdoc_exe_wrapper', None)
 +        if gtkdoc_exe_wrapper is not None:
-+            args.append('--gtkdoc-exe-wrapper=' + gtkdoc_exe_wrapper)
++            args.append('--run=' + gtkdoc_exe_wrapper)
 +
          args += self._unpack_args('--htmlargs=', 'html_args', kwargs)
          args += self._unpack_args('--scanargs=', 'scan_args', kwargs)
          args += self._unpack_args('--scanobjsargs=', 'scanobjs_args', kwargs)
-diff --git a/mesonbuild/scripts/gtkdochelper.py b/mesonbuild/scripts/gtkdochelper.py
-index 948dc5a..9c5bd19 100644
---- a/mesonbuild/scripts/gtkdochelper.py
-+++ b/mesonbuild/scripts/gtkdochelper.py
-@@ -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, 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, 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))
-@@ -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,
--                 gobject_typesfile, scanobjs_args, ld, cc, ldflags, cflags,
-+                 gobject_typesfile, scanobjs_args, gtkdoc_exe_wrapper, ld, cc, ldflags, cflags,
-                  html_assets, content_files, ignore_headers, namespace,
-                  expand_content_files, mode):
-     print("Building documentation for %s" % module)
-@@ -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,
-+                                                              '--run=' + gtkdoc_exe_wrapper,
-+                                                              '--cc=' + cc,
-+                                                              '--ld=' + ld,
-                                                               '--cflags=' + cflags,
-                                                               '--ldflags=' + ldflags,
-                                                               '--cc=' + cc,
-@@ -238,6 +242,7 @@ def run(args):
-         mkdbargs,
-         options.gobject_typesfile,
-         scanobjsargs,
-+        options.gtkdoc_exe_wrapper,
-         options.ld,
-         options.cc,
-         options.ldflags,
diff --git a/poky/meta/recipes-devtools/meson/meson/0001-modules-windows-split-WINDRES-env-variable.patch b/poky/meta/recipes-devtools/meson/meson/0001-modules-windows-split-WINDRES-env-variable.patch
new file mode 100644
index 0000000..c334e6d
--- /dev/null
+++ b/poky/meta/recipes-devtools/meson/meson/0001-modules-windows-split-WINDRES-env-variable.patch
@@ -0,0 +1,26 @@
+From 5293d0f5067b2aeefe9ce3c175c972de367589bc Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Wed, 13 Feb 2019 17:43:54 +0100
+Subject: [PATCH] modules/windows: split WINDRES env variable
+
+As it may contain not just the binary, but also the arguments to it.
+
+Upstream-Status: Pending
+Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+---
+ mesonbuild/modules/windows.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/mesonbuild/modules/windows.py b/mesonbuild/modules/windows.py
+index d185d89..dbaeb9b 100644
+--- a/mesonbuild/modules/windows.py
++++ b/mesonbuild/modules/windows.py
+@@ -56,7 +56,7 @@ class WindowsModule(ExtensionModule):
+             if 'WINDRES' in os.environ:
+                 # Pick-up env var WINDRES if set. This is often used for
+                 # specifying an arch-specific windres.
+-                rescomp = ExternalProgram('windres', command=os.environ.get('WINDRES'), silent=True)
++                rescomp = ExternalProgram('windres', command=os.environ.get('WINDRES').split(), silent=True)
+ 
+         if not rescomp or not rescomp.found():
+             # Take windres from the config file after the environment, which is
diff --git a/poky/meta/recipes-devtools/meson/meson/0001-python-module-do-not-manipulate-the-environment-when.patch b/poky/meta/recipes-devtools/meson/meson/0001-python-module-do-not-manipulate-the-environment-when.patch
index 6072985..bf715d1 100644
--- a/poky/meta/recipes-devtools/meson/meson/0001-python-module-do-not-manipulate-the-environment-when.patch
+++ b/poky/meta/recipes-devtools/meson/meson/0001-python-module-do-not-manipulate-the-environment-when.patch
@@ -1,4 +1,4 @@
-From 45426f06689a520fc47f81ee29b49d509f11ba58 Mon Sep 17 00:00:00 2001
+From 3cb2c811dc6d4890342afa5b709cd30cf7b8f3ca Mon Sep 17 00:00:00 2001
 From: Alexander Kanavin <alex.kanavin@gmail.com>
 Date: Mon, 19 Nov 2018 14:24:26 +0100
 Subject: [PATCH] python module: do not manipulate the environment when calling
@@ -6,38 +6,38 @@
 
 Upstream-Status: Inappropriate [oe-core specific]
 Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+
 ---
- mesonbuild/modules/python.py | 14 --------------
- 1 file changed, 14 deletions(-)
+ mesonbuild/modules/python.py | 12 ------------
+ 1 file changed, 12 deletions(-)
 
 diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py
-index 1195d8a..df81da4 100644
+index 9cfbd6f..3ff687a 100644
 --- a/mesonbuild/modules/python.py
 +++ b/mesonbuild/modules/python.py
-@@ -67,26 +67,12 @@ class PythonDependency(ExternalDependency):
-         if DependencyMethods.PKGCONFIG in self.methods and not python_holder.is_pypy:
-             pkg_version = self.variables.get('LDVERSION') or self.version
-             pkg_libdir = self.variables.get('LIBPC')
--            old_pkg_libdir = os.environ.get('PKG_CONFIG_LIBDIR')
--            old_pkg_path = os.environ.get('PKG_CONFIG_PATH')
--
--            os.environ.pop('PKG_CONFIG_PATH', None)
--
--            if pkg_libdir:
--                os.environ['PKG_CONFIG_LIBDIR'] = pkg_libdir
+@@ -75,11 +75,6 @@ class PythonDependency(ExternalDependency):
+                 old_pkg_libdir = os.environ.get('PKG_CONFIG_LIBDIR')
+                 old_pkg_path = os.environ.get('PKG_CONFIG_PATH')
  
-             try:
-                 self.pkgdep = PkgConfigDependency('python-{}'.format(pkg_version), environment, kwargs)
-             except Exception:
-                 pass
- 
--            if old_pkg_path is not None:
--                os.environ['PKG_CONFIG_PATH'] = old_pkg_path
+-                os.environ.pop('PKG_CONFIG_PATH', None)
 -
--            if old_pkg_libdir is not None:
--                os.environ['PKG_CONFIG_LIBDIR'] = old_pkg_libdir
--            else:
--                os.environ.pop('PKG_CONFIG_LIBDIR', None)
+-                if pkg_libdir:
+-                    os.environ['PKG_CONFIG_LIBDIR'] = pkg_libdir
+-
+                 try:
+                     self.pkgdep = PkgConfigDependency('python-{}'.format(pkg_version), environment, kwargs)
+                     mlog.debug('Found "python-{}" via pkgconfig lookup in LIBPC ({})'.format(pkg_version, pkg_libdir))
+@@ -88,13 +83,6 @@ class PythonDependency(ExternalDependency):
+                     mlog.debug('"python-{}" could not be found in LIBPC ({})'.format(pkg_version, pkg_libdir))
+                     mlog.debug(e)
  
-         if self.pkgdep and self.pkgdep.found():
-             self.compile_args = self.pkgdep.get_compile_args()
+-                if old_pkg_path is not None:
+-                    os.environ['PKG_CONFIG_PATH'] = old_pkg_path
+-
+-                if old_pkg_libdir is not None:
+-                    os.environ['PKG_CONFIG_LIBDIR'] = old_pkg_libdir
+-                else:
+-                    os.environ.pop('PKG_CONFIG_LIBDIR', None)
+             else:
+                 mlog.debug('"python-{}" could not be found in LIBPC ({}), this is likely due to a relocated python installation'.format(pkg_version, pkg_libdir))
+ 
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
deleted file mode 100644
index ca56a6a..0000000
--- a/poky/meta/recipes-devtools/meson/meson/0002-Make-CPU-family-warnings-fatal.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-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-Support-building-allarch-recipes-again.patch b/poky/meta/recipes-devtools/meson/meson/0002-Support-building-allarch-recipes-again.patch
new file mode 100644
index 0000000..81548cd
--- /dev/null
+++ b/poky/meta/recipes-devtools/meson/meson/0002-Support-building-allarch-recipes-again.patch
@@ -0,0 +1,26 @@
+From f8419d5f279f1fb9b5e7eead4f1579bce7cb0e4e 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 5fcf9df..b4fc0dc 100644
+--- a/mesonbuild/environment.py
++++ b/mesonbuild/environment.py
+@@ -72,6 +72,7 @@ from .compilers import (
+ build_filename = 'meson.build'
+ 
+ known_cpu_families = (
++    'allarch',
+     'aarch64',
+     'arc',
+     'arm',
diff --git a/poky/meta/recipes-devtools/meson/meson/0002-environment.py-detect-windows-also-if-the-system-str.patch b/poky/meta/recipes-devtools/meson/meson/0002-environment.py-detect-windows-also-if-the-system-str.patch
new file mode 100644
index 0000000..1be5d66
--- /dev/null
+++ b/poky/meta/recipes-devtools/meson/meson/0002-environment.py-detect-windows-also-if-the-system-str.patch
@@ -0,0 +1,25 @@
+From 7bf4c2c02eb7fe1bf24b23e3ba2d7df36495e0aa Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Wed, 13 Feb 2019 17:45:09 +0100
+Subject: [PATCH] environment.py: detect windows also if the system string
+ contains 'mingw'
+
+Upstream-Status: Pending
+Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+---
+ mesonbuild/environment.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
+index b4fc0dc..845077e 100644
+--- a/mesonbuild/environment.py
++++ b/mesonbuild/environment.py
+@@ -1247,7 +1247,7 @@ class MachineInfo:
+         """
+         Machine is windows?
+         """
+-        return self.system == 'windows'
++        return self.system == 'windows' or 'mingw' in self.system
+ 
+     def is_cygwin(self):
+         """
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 f32267d..61b26bb 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,4 +1,4 @@
-From 0b860cb8a22ae876b6088939dbabca216bc29431 Mon Sep 17 00:00:00 2001
+From 9ccaed380780178c4dab3a681f652ac7cd27452d 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] gobject-introspection: determine g-ir-scanner and
@@ -12,28 +12,29 @@
 Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
 
 ---
- mesonbuild/modules/gnome.py | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
+ mesonbuild/modules/gnome.py | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
-index b29bab9..dc4c401 100644
+index 7c5a363..0002498 100644
 --- a/mesonbuild/modules/gnome.py
 +++ b/mesonbuild/modules/gnome.py
-@@ -393,8 +393,6 @@ class GnomeModule(ExtensionModule):
-             raise MesonException('Gir takes one argument')
+@@ -744,15 +744,15 @@ class GnomeModule(ExtensionModule):
          if kwargs.get('install_dir'):
              raise MesonException('install_dir is not supported with generate_gir(), see "install_dir_gir" and "install_dir_typelib"')
+ 
 -        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
-@@ -405,6 +403,8 @@ class GnomeModule(ExtensionModule):
-                 self.gir_dep = PkgConfigDependency('gobject-introspection-1.0',
-                                                    state.environment,
-                                                    {'native': True})
-+            giscanner = os.environ['PKG_CONFIG_SYSROOT_DIR'] + self.gir_dep.get_pkgconfig_variable('g_ir_scanner', {})
-+            gicompiler = os.environ['PKG_CONFIG_SYSROOT_DIR'] + self.gir_dep.get_pkgconfig_variable('g_ir_compiler', {})
-             pkgargs = self.gir_dep.get_compile_args()
-         except Exception:
-             raise MesonException('gobject-introspection dependency was not found, gir cannot be generated.')
+-
+         girtargets = [self._unwrap_gir_target(arg, state) for arg in args]
+ 
+         if len(girtargets) > 1 and any([isinstance(el, build.Executable) for el in girtargets]):
+             raise MesonException('generate_gir only accepts a single argument when one of the arguments is an executable')
+ 
+         self.gir_dep, pkgargs = self._get_gir_dep(state)
++        giscanner = os.environ['PKG_CONFIG_SYSROOT_DIR'] + self.gir_dep.get_pkgconfig_variable('g_ir_scanner', {})
++        gicompiler = os.environ['PKG_CONFIG_SYSROOT_DIR'] + self.gir_dep.get_pkgconfig_variable('g_ir_compiler', {})
++
+ 
+         ns = kwargs.pop('namespace')
+         nsversion = kwargs.pop('nsversion')
diff --git a/poky/meta/recipes-devtools/meson/meson/cross-libdir.patch b/poky/meta/recipes-devtools/meson/meson/cross-libdir.patch
new file mode 100644
index 0000000..7395fdb
--- /dev/null
+++ b/poky/meta/recipes-devtools/meson/meson/cross-libdir.patch
@@ -0,0 +1,35 @@
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+From ce24f0d6a9be22ba61d80cd254e0409de2eaffd7 Mon Sep 17 00:00:00 2001
+From: Jussi Pakkanen <jpakkane@gmail.com>
+Date: Thu, 27 Dec 2018 23:43:35 +0200
+Subject: [PATCH] Default libdir is "lib" when cross compiling. Closes #2535.
+
+---
+diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
+index ff810683..9ee23a69 100644
+--- a/mesonbuild/coredata.py
++++ b/mesonbuild/coredata.py
+@@ -298,6 +298,7 @@ class CoreData:
+         # Only to print a warning if it changes between Meson invocations.
+         self.pkgconf_envvar = os.environ.get('PKG_CONFIG_PATH', '')
+         self.config_files = self.__load_config_files(options.native_file)
++        self.libdir_cross_fixup()
+ 
+     @staticmethod
+     def __load_config_files(filenames):
+@@ -309,6 +310,13 @@ class CoreData:
+                      for f in filenames]
+         return filenames
+ 
++    def libdir_cross_fixup(self):
++        # By default set libdir to "lib" when cross compiling since
++        # getting the "system default" is always wrong on multiarch
++        # platforms as it gets a value like lib/x86_64-linux-gnu.
++        if self.cross_files:
++            self.builtins['libdir'].value = 'lib'
++
+     def sanitize_prefix(self, prefix):
+         if not os.path.isabs(prefix):
+             raise MesonException('prefix value {!r} must be an absolute path'
diff --git a/poky/meta/recipes-devtools/meson/meson/cross-prop-default.patch b/poky/meta/recipes-devtools/meson/meson/cross-prop-default.patch
new file mode 100644
index 0000000..772395e
--- /dev/null
+++ b/poky/meta/recipes-devtools/meson/meson/cross-prop-default.patch
@@ -0,0 +1,23 @@
+meson.build files that use cc.run() in native builds can silently fallback to
+meson.get_cross_property() in cross builds without an exe-wrapper, but there's
+no way to know that this is happening.
+
+As the defaults may be pessimistic (for example, disabling the support for a
+feature that should be enabled) emit a warning when the default is used, so that
+the recipe can explicitly set the cross property as relevant.
+
+Upstream-Status: Submitted [https://github.com/mesonbuild/meson/pull/5071]
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
+index 3c3cfae0..10e741ae 100644
+--- a/mesonbuild/interpreter.py
++++ b/mesonbuild/interpreter.py
+@@ -1890,6 +1890,7 @@ class MesonMain(InterpreterObject):
+             return props[propname]
+         except Exception:
+             if len(args) == 2:
++                mlog.warning('Cross property %s is using default value %s' % (propname, args[1]))
+                 return args[1]
+             raise InterpreterException('Unknown cross property: %s.' % propname)
+ 
diff --git a/poky/meta/recipes-devtools/meson/meson/gi-flags.patch b/poky/meta/recipes-devtools/meson/meson/gi-flags.patch
deleted file mode 100644
index 9a4c296..0000000
--- a/poky/meta/recipes-devtools/meson/meson/gi-flags.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-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
deleted file mode 100644
index ecf3489..0000000
--- a/poky/meta/recipes-devtools/meson/meson/gtkdoc-flags.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-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/many-cross.patch b/poky/meta/recipes-devtools/meson/meson/many-cross.patch
new file mode 100644
index 0000000..d04c28b
--- /dev/null
+++ b/poky/meta/recipes-devtools/meson/meson/many-cross.patch
@@ -0,0 +1,207 @@
+mesonbuild: allow multiple --cross-file options
+
+Just like --native-file, allow multiple --cross-file options.  This is mostly
+unifying the logic between cross_files and config_files.
+
+Upstream-Status: Backport [will be in 0.50.1]
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
+index 40402513..4b9bcb59 100644
+--- a/mesonbuild/backend/backends.py
++++ b/mesonbuild/backend/backends.py
+@@ -726,8 +726,7 @@ class Backend:
+         deps = [os.path.join(self.build_to_src, df)
+                 for df in self.interpreter.get_build_def_files()]
+         if self.environment.is_cross_build():
+-            deps.append(os.path.join(self.build_to_src,
+-                                     self.environment.coredata.cross_file))
++            deps.extend(self.environment.coredata.cross_files)
+         deps.append('meson-private/coredata.dat')
+         if os.path.exists(os.path.join(self.environment.get_source_dir(), 'meson_options.txt')):
+             deps.append(os.path.join(self.build_to_src, 'meson_options.txt'))
+diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
+index c3f5a745..ff810683 100644
+--- a/mesonbuild/coredata.py
++++ b/mesonbuild/coredata.py
+@@ -201,8 +201,8 @@ class UserFeatureOption(UserComboOption):
+         return self.value == 'auto'
+ 
+ 
+-def load_configs(filenames):
+-    """Load native files."""
++def load_configs(filenames, subdir):
++    """Load configuration files from a named subdirectory."""
+     def gen():
+         for f in filenames:
+             f = os.path.expanduser(os.path.expandvars(f))
+@@ -215,7 +215,7 @@ def load_configs(filenames):
+                     os.environ.get('XDG_DATA_HOME', os.path.expanduser('~/.local/share')),
+                 ] + os.environ.get('XDG_DATA_DIRS', '/usr/local/share:/usr/share').split(':')
+                 for path in paths:
+-                    path_to_try = os.path.join(path, 'meson', 'native', f)
++                    path_to_try = os.path.join(path, 'meson', subdir, f)
+                     if os.path.isfile(path_to_try):
+                         yield path_to_try
+                         break
+@@ -291,7 +291,7 @@ class CoreData:
+         self.compiler_options = {}
+         self.base_options = {}
+         self.external_preprocess_args = {} # CPPFLAGS only
+-        self.cross_file = self.__load_cross_file(options.cross_file)
++        self.cross_files = self.__load_config_files(options.cross_file)
+         self.compilers = OrderedDict()
+         self.cross_compilers = OrderedDict()
+         self.deps = OrderedDict()
+@@ -301,52 +301,14 @@ class CoreData:
+ 
+     @staticmethod
+     def __load_config_files(filenames):
++        # Need to try and make the passed filenames absolute because when the
++        # files are parsed later we'll have chdir()d.
+         if not filenames:
+             return []
+         filenames = [os.path.abspath(os.path.expanduser(os.path.expanduser(f)))
+                      for f in filenames]
+         return filenames
+ 
+-    @staticmethod
+-    def __load_cross_file(filename):
+-        """Try to load the cross file.
+-
+-        If the filename is None return None. If the filename is an absolute
+-        (after resolving variables and ~), return that absolute path. Next,
+-        check if the file is relative to the current source dir. If the path
+-        still isn't resolved do the following:
+-            Windows:
+-                - Error
+-            *:
+-                - $XDG_DATA_HOME/meson/cross (or ~/.local/share/meson/cross if
+-                  undefined)
+-                - $XDG_DATA_DIRS/meson/cross (or
+-                  /usr/local/share/meson/cross:/usr/share/meson/cross if undefined)
+-                - Error
+-
+-        Non-Windows follows the Linux path and will honor XDG_* if set. This
+-        simplifies the implementation somewhat.
+-        """
+-        if filename is None:
+-            return None
+-        filename = os.path.expanduser(os.path.expandvars(filename))
+-        if os.path.isabs(filename):
+-            return filename
+-        path_to_try = os.path.abspath(filename)
+-        if os.path.isfile(path_to_try):
+-            return path_to_try
+-        if sys.platform != 'win32':
+-            paths = [
+-                os.environ.get('XDG_DATA_HOME', os.path.expanduser('~/.local/share')),
+-            ] + os.environ.get('XDG_DATA_DIRS', '/usr/local/share:/usr/share').split(':')
+-            for path in paths:
+-                path_to_try = os.path.join(path, 'meson', 'cross', filename)
+-                if os.path.isfile(path_to_try):
+-                    return path_to_try
+-            raise MesonException('Cannot find specified cross file: ' + filename)
+-
+-        raise MesonException('Cannot find specified cross file: ' + filename)
+-
+     def sanitize_prefix(self, prefix):
+         if not os.path.isabs(prefix):
+             raise MesonException('prefix value {!r} must be an absolute path'
+@@ -558,8 +520,8 @@ def read_cmd_line_file(build_dir, options):
+     options.cmd_line_options = d
+ 
+     properties = config['properties']
+-    if options.cross_file is None:
+-        options.cross_file = properties.get('cross_file', None)
++    if not options.cross_file:
++        options.cross_file = ast.literal_eval(properties.get('cross_file', '[]'))
+     if not options.native_file:
+         # This will be a string in the form: "['first', 'second', ...]", use
+         # literal_eval to get it into the list of strings.
+@@ -570,7 +532,7 @@ def write_cmd_line_file(build_dir, options):
+     config = CmdLineFileParser()
+ 
+     properties = {}
+-    if options.cross_file is not None:
++    if options.cross_file:
+         properties['cross_file'] = options.cross_file
+     if options.native_file:
+         properties['native_file'] = options.native_file
+diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
+index 6d86daf9..406ab8b8 100644
+--- a/mesonbuild/environment.py
++++ b/mesonbuild/environment.py
+@@ -355,8 +355,8 @@ class Environment:
+         self.machines = MachineInfos()
+         # Will be fully initialized later using compilers later.
+         self.machines.detect_build()
+-        if self.coredata.cross_file:
+-            self.cross_info = CrossBuildInfo(self.coredata.cross_file)
++        if self.coredata.cross_files:
++            self.cross_info = CrossBuildInfo(self.coredata.cross_files)
+             if 'exe_wrapper' in self.cross_info.config['binaries']:
+                 from .dependencies import ExternalProgram
+                 self.exe_wrapper = ExternalProgram.from_bin_list(
+@@ -373,7 +373,7 @@ class Environment:
+ 
+         if self.coredata.config_files:
+             self.config_info = coredata.ConfigData(
+-                coredata.load_configs(self.coredata.config_files))
++                coredata.load_configs(self.coredata.config_files, 'native'))
+         else:
+             self.config_info = coredata.ConfigData()
+ 
+@@ -1113,13 +1113,8 @@ class CrossBuildInfo:
+     def ok_type(self, i):
+         return isinstance(i, (str, int, bool))
+ 
+-    def parse_datafile(self, filename):
+-        config = configparser.ConfigParser()
+-        try:
+-            with open(filename, 'r') as f:
+-                config.read_file(f, filename)
+-        except FileNotFoundError:
+-            raise EnvironmentException('File not found: %s.' % filename)
++    def parse_datafile(self, filenames):
++        config = coredata.load_configs(filenames, 'cross')
+         # This is a bit hackish at the moment.
+         for s in config.sections():
+             self.config[s] = {}
+diff --git a/mesonbuild/msetup.py b/mesonbuild/msetup.py
+index 56a0e9a7..f0a1ae19 100644
+--- a/mesonbuild/msetup.py
++++ b/mesonbuild/msetup.py
+@@ -27,7 +27,9 @@ from .mesonlib import MesonException
+ 
+ def add_arguments(parser):
+     coredata.register_builtin_arguments(parser)
+-    parser.add_argument('--cross-file', default=None,
++    parser.add_argument('--cross-file',
++                        default=[],
++                        action='append',
+                         help='File describing cross compilation environment.')
+     parser.add_argument('--native-file',
+                         default=[],
+diff --git a/run_unittests.py b/run_unittests.py
+index e6874b25..1d247291 100755
+--- a/run_unittests.py
++++ b/run_unittests.py
+@@ -529,7 +529,7 @@ class InternalTests(unittest.TestCase):
+         config.write(configfile)
+         configfile.flush()
+         configfile.close()
+-        detected_value = mesonbuild.environment.CrossBuildInfo(configfile.name).need_exe_wrapper()
++        detected_value = mesonbuild.environment.CrossBuildInfo((configfile.name,)).need_exe_wrapper()
+         os.unlink(configfilename)
+ 
+         desired_value = not detected_value
+@@ -541,7 +541,7 @@ class InternalTests(unittest.TestCase):
+         configfilename = configfile.name
+         config.write(configfile)
+         configfile.close()
+-        forced_value = mesonbuild.environment.CrossBuildInfo(configfile.name).need_exe_wrapper()
++        forced_value = mesonbuild.environment.CrossBuildInfo((configfile.name,)).need_exe_wrapper()
+         os.unlink(configfilename)
+ 
+         self.assertEqual(forced_value, desired_value)
diff --git a/poky/meta/recipes-devtools/meson/meson/meson-setup.py b/poky/meta/recipes-devtools/meson/meson/meson-setup.py
index a9749ea..808e2a0 100755
--- a/poky/meta/recipes-devtools/meson/meson/meson-setup.py
+++ b/poky/meta/recipes-devtools/meson/meson/meson-setup.py
@@ -1,62 +1,31 @@
 #!/usr/bin/env python3
 
 import os
+import string
 import sys
 
-def bail(msg):
-    print(msg, file=sys.stderr)
-    sys.exit(1)
+class Template(string.Template):
+    delimiter = "@"
 
-_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
+class Environ():
+    def __getitem__(self, name):
+        val = os.environ[name]
+        val = ["'%s'" % x for x in val.split()]
+        val = ', '.join(val)
+        val = '[%s]' % val
+        return val
 
-    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')
+    print("Not in environment setup, bailing")
+    sys.exit(1)
 
-cross_file = os.path.join(sysroot, 'usr/share/meson/meson.cross')
-tmp_cross_file = '%s.tmp' % cross_file
+template_file = os.path.join(sysroot, 'usr/share/meson/meson.cross.template')
+cross_file = os.path.join(sysroot, 'usr/share/meson/%smeson.cross' % os.environ["TARGET_PREFIX"])
 
-# 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)
+with open(template_file) as in_file:
+    template = in_file.read()
+    output = Template(template).substitute(Environ())
+    with open(cross_file, "w") as out_file:
+        out_file.write(output)
diff --git a/poky/meta/recipes-devtools/meson/meson/meson-wrapper b/poky/meta/recipes-devtools/meson/meson/meson-wrapper
index b2e00da..d4ffe60 100755
--- a/poky/meta/recipes-devtools/meson/meson/meson-wrapper
+++ b/poky/meta/recipes-devtools/meson/meson/meson-wrapper
@@ -10,5 +10,5 @@
 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" \
+     --cross-file "${OECORE_NATIVE_SYSROOT}/usr/share/meson/${TARGET_PREFIX}meson.cross" \
      "$@"
diff --git a/poky/meta/recipes-devtools/meson/meson_0.47.2.bb b/poky/meta/recipes-devtools/meson/meson_0.49.2.bb
similarity index 97%
rename from poky/meta/recipes-devtools/meson/meson_0.47.2.bb
rename to poky/meta/recipes-devtools/meson/meson_0.49.2.bb
index 897fa14..de9b905 100644
--- a/poky/meta/recipes-devtools/meson/meson_0.47.2.bb
+++ b/poky/meta/recipes-devtools/meson/meson_0.49.2.bb
@@ -1,3 +1,4 @@
 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
deleted file mode 100644
index 53503aa..0000000
--- a/poky/meta/recipes-devtools/meson/nativesdk-meson_0.47.2.bb
+++ /dev/null
@@ -1,74 +0,0 @@
-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}"
diff --git a/poky/meta/recipes-devtools/meson/nativesdk-meson_0.49.2.bb b/poky/meta/recipes-devtools/meson/nativesdk-meson_0.49.2.bb
new file mode 100644
index 0000000..1549357
--- /dev/null
+++ b/poky/meta/recipes-devtools/meson/nativesdk-meson_0.49.2.bb
@@ -0,0 +1,71 @@
+include meson.inc
+
+inherit nativesdk
+inherit siteinfo
+
+SRC_URI += "file://meson-setup.py \
+            file://meson-wrapper"
+
+def meson_endian(prefix, d):
+    arch, os = d.getVar(prefix + "_ARCH"), d.getVar(prefix + "_OS")
+    sitedata = siteinfo_data_for_machine(arch, os, d)
+    if "endian-little" in sitedata:
+        return "little"
+    elif "endian-big" in sitedata:
+        return "big"
+    else:
+        bb.fatal("Cannot determine endianism for %s-%s" % (arch, os))
+
+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}"
+
+# The cross file 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.
+do_install_append() {
+    install -d ${D}${datadir}/meson
+    cat >${D}${datadir}/meson/meson.cross.template <<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_endian("SDK", d)}'
+EOF
+
+    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 \
+    nativesdk-python3-setuptools \
+    "
+
+FILES_${PN} += "${datadir}/meson ${SDKPATHNATIVE}"