<div dir="ltr">This series was just ran on the autobuilder and there's a few failures:<div><br></div><div><a href="http://errors.yoctoproject.org/Errors/Latest//?filter=21d01e923239ab32116bf526cc2c5afee9052476&type=commit">http://errors.yoctoproject.org/Errors/Latest//?filter=21d01e923239ab32116bf526cc2c5afee9052476&type=commit</a><br></div><div><br></div><div>Anyone interested in getting Meson merged into oe-core is welcome to work with Alex to resolve these.</div><div><br></div><div>Ross</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 15 November 2017 at 11:08, Alexander Kanavin <span dir="ltr"><<a href="mailto:alexander.kanavin@linux.intel.com" target="_blank">alexander.kanavin@linux.intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The original recipe has been provided and improved by:<br>
<br>
Ross Burton <<a href="mailto:ross.burton@intel.com">ross.burton@intel.com</a>><br>
Ricardo Ribalda Delgado <<a href="mailto:ricardo.ribalda@gmail.com">ricardo.ribalda@gmail.com</a>><br>
Adam C. Foltzer <<a href="mailto:acfoltzer@galois.com">acfoltzer@galois.com</a>><br>
Peter Kjellerstedt <<a href="mailto:peter.kjellerstedt@axis.com">peter.kjellerstedt@axis.com</a>><br>
Linus Svensson <<a href="mailto:linussn@axis.com">linussn@axis.com</a>><br>
<br>
I have added a couple patches to fix up gtk-doc and<br>
gobject-introspection in cross-compilation environments.<br>
<br>
Signed-off-by: Alexander Kanavin <<a href="mailto:alexander.kanavin@linux.intel.com">alexander.kanavin@linux.<wbr>intel.com</a>><br>
---<br>
meta/classes/meson.bbclass | 103 +++++++++++++++++++<br>
...ix-issues-that-arise-when-<wbr>cross-compiling.patch | 113 +++++++++++++++++++++<br>
...rospection-determine-g-ir-<wbr>scanner-and-g-i.patch | 41 ++++++++<br>
meta/recipes-devtools/meson/<a href="http://meson_0.43.0.bb" rel="noreferrer" target="_blank">me<wbr>son_0.43.0.bb</a> | 19 ++++<br>
4 files changed, 276 insertions(+)<br>
create mode 100644 meta/classes/meson.bbclass<br>
create mode 100644 meta/recipes-devtools/meson/<wbr>meson/0001-gtkdoc-fix-issues-<wbr>that-arise-when-cross-<wbr>compiling.patch<br>
create mode 100644 meta/recipes-devtools/meson/<wbr>meson/0002-gobject-<wbr>introspection-determine-g-ir-<wbr>scanner-and-g-i.patch<br>
create mode 100644 meta/recipes-devtools/meson/<a href="http://meson_0.43.0.bb" rel="noreferrer" target="_blank">me<wbr>son_0.43.0.bb</a><br>
<br>
diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass<br>
new file mode 100644<br>
index 00000000000..f6cf24c33a7<br>
--- /dev/null<br>
+++ b/meta/classes/meson.bbclass<br>
@@ -0,0 +1,103 @@<br>
+inherit python3native<br>
+<br>
+DEPENDS_append = " meson-native ninja-native"<br>
+<br>
+# As Meson enforces out-of-tree builds we can just use cleandirs<br>
+B = "${WORKDIR}/build"<br>
+do_configure[cleandirs] = "${B}"<br>
+<br>
+# Where the meson.build build configuration is<br>
+MESON_SOURCEPATH = "${S}"<br>
+<br>
+# These variables in the environment override meson's *native* tools settings.<br>
+# We have to unset them, so that meson doesn't pick up the cross tools and<br>
+# use them for native builds.<br>
+unset CC<br>
+unset CXX<br>
+unset AR<br>
+<br>
+def noprefix(var, d):<br>
+ return d.getVar(var, True).replace(d.getVar('<wbr>prefix', True) + '/', '', 1)<br>
+<br>
+MESONOPTS = " --prefix ${prefix} \<br>
+ --bindir ${@noprefix('bindir', d)} \<br>
+ --sbindir ${@noprefix('sbindir', d)} \<br>
+ --datadir ${@noprefix('datadir', d)} \<br>
+ --libdir ${@noprefix('libdir', d)} \<br>
+ --libexecdir ${@noprefix('libexecdir', d)} \<br>
+ --includedir ${@noprefix('includedir', d)} \<br>
+ --mandir ${@noprefix('mandir', d)} \<br>
+ --infodir ${@noprefix('infodir', d)} \<br>
+ --sysconfdir ${sysconfdir} \<br>
+ --localstatedir ${localstatedir} \<br>
+ --sharedstatedir ${sharedstatedir}"<br>
+<br>
+MESON_C_ARGS = "${TARGET_CC_ARCH}${TOOLCHAIN_<wbr>OPTIONS}"<br>
+MESON_LINK_ARGS = "${MESON_C_ARGS} ${LDFLAGS}"<br>
+<br>
+MESON_HOST_ENDIAN = "${@bb.utils.contains('<wbr>SITEINFO_ENDIANNESS', 'be', 'big', 'little', d)}"<br>
+MESON_TARGET_ENDIAN = "${@bb.utils.contains('TUNE_<wbr>FEATURES', 'bigendian', 'big', 'little', d)}"<br>
+<br>
+EXTRA_OEMESON += "${PACKAGECONFIG_CONFARGS}"<br>
+<br>
+MESON_CROSS_FILE = ""<br>
+MESON_CROSS_FILE_class-target = "--cross-file ${WORKDIR}/meson.cross"<br>
+<br>
+def meson_array(var, d):<br>
+ return "', '".join(d.getVar(var, True).split()).join(("'", "'"))<br>
+<br>
+addtask write_config before do_configure<br>
+do_write_config[vardeps] += "MESON_C_ARGS TOOLCHAIN_OPTIONS"<br>
+do_write_config() {<br>
+ # This needs to be Py to split the args into single-element lists<br>
+ cat >${WORKDIR}/meson.cross <<EOF<br>
+[binaries]<br>
+c = '${HOST_PREFIX}gcc'<br>
+cpp = '${HOST_PREFIX}g++'<br>
+ar = '${HOST_PREFIX}ar'<br>
+ld = '${HOST_PREFIX}ld'<br>
+strip = '${HOST_PREFIX}strip'<br>
+readelf = '${HOST_PREFIX}readelf'<br>
+pkgconfig = 'pkg-config'<br>
+<br>
+[properties]<br>
+needs_exe_wrapper = true<br>
+c_args = [${@meson_array('MESON_C_ARGS'<wbr>, d)}]<br>
+c_link_args = [${@meson_array('MESON_LINK_<wbr>ARGS', d)}]<br>
+cpp_args = [${@meson_array('MESON_C_ARGS'<wbr>, d)}]<br>
+cpp_link_args = [${@meson_array('MESON_LINK_<wbr>ARGS', d)}]<br>
+gtkdoc_exe_wrapper = '${B}/gtkdoc-qemuwrapper'<br>
+<br>
+[host_machine]<br>
+system = '${HOST_OS}'<br>
+cpu_family = '${HOST_ARCH}'<br>
+cpu = '${HOST_ARCH}'<br>
+endian = '${MESON_HOST_ENDIAN}'<br>
+<br>
+[target_machine]<br>
+system = '${TARGET_OS}'<br>
+cpu_family = '${TARGET_ARCH}'<br>
+cpu = '${TARGET_ARCH}'<br>
+endian = '${MESON_TARGET_ENDIAN}'<br>
+EOF<br>
+}<br>
+<br>
+CONFIGURE_FILES = "meson.build"<br>
+<br>
+meson_do_configure() {<br>
+ if ! meson ${MESONOPTS} "${MESON_SOURCEPATH}" "${B}" ${MESON_CROSS_FILE} ${EXTRA_OEMESON}; then<br>
+ cat ${B}/meson-logs/meson-log.txt<br>
+ bbfatal_log meson failed<br>
+ fi<br>
+}<br>
+<br>
+do_compile[progress] = "outof:^\[(\d+)/(\d+)\]\s+"<br>
+meson_do_compile() {<br>
+ ninja ${PARALLEL_MAKE}<br>
+}<br>
+<br>
+meson_do_install() {<br>
+ DESTDIR='${D}' ninja ${PARALLEL_MAKEINST} install<br>
+}<br>
+<br>
+EXPORT_FUNCTIONS do_configure do_compile do_install<br>
diff --git a/meta/recipes-devtools/meson/<wbr>meson/0001-gtkdoc-fix-issues-<wbr>that-arise-when-cross-<wbr>compiling.patch b/meta/recipes-devtools/meson/<wbr>meson/0001-gtkdoc-fix-issues-<wbr>that-arise-when-cross-<wbr>compiling.patch<br>
new file mode 100644<br>
index 00000000000..ca3d7095066<br>
--- /dev/null<br>
+++ b/meta/recipes-devtools/meson/<wbr>meson/0001-gtkdoc-fix-issues-<wbr>that-arise-when-cross-<wbr>compiling.patch<br>
@@ -0,0 +1,113 @@<br>
+From 15e054dce6ff11d2cb219c8c09a31b<wbr>26f0e58b62 Mon Sep 17 00:00:00 2001<br>
+From: Alexander Kanavin <<a href="mailto:alex.kanavin@gmail.com">alex.kanavin@gmail.com</a>><br>
+Date: Fri, 4 Aug 2017 16:16:41 +0300<br>
+Subject: [PATCH 1/3] gtkdoc: fix issues that arise when cross-compiling<br>
+<br>
+Specifically:<br>
+1) Make it possible to specify a wrapper for executing binaries<br>
+(usually, some kind of target hardware emulator, such as qemu)<br>
+2) Explicitly provide CC and LD via command line, as otherwise gtk-doc will<br>
+try to guess them, incorrectly.<br>
+3) If things break down, print the full command with arguments,<br>
+not just the binary name.<br>
+4) Correctly determine the compiler/linker executables and cross-options when cross-compiling<br>
+<br>
+Upstream-Status: Pending<br>
+Signed-off-by: Alexander Kanavin <<a href="mailto:alex.kanavin@gmail.com">alex.kanavin@gmail.com</a>><br>
+<br>
+---<br>
+ mesonbuild/modules/gnome.py | 18 +++++++++++++++---<br>
+ mesonbuild/scripts/<wbr>gtkdochelper.py | 9 +++++++--<br>
+ 2 files changed, 22 insertions(+), 5 deletions(-)<br>
+<br>
+diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py<br>
+index 6ec7040..4cfaefd 100644<br>
+--- a/mesonbuild/modules/gnome.py<br>
++++ b/mesonbuild/modules/gnome.py<br>
+@@ -713,6 +713,10 @@ class GnomeModule(ExtensionModule):<br>
+ '--mode=' + mode]<br>
+ if namespace:<br>
+ args.append('--namespace=' + namespace)<br>
++ gtkdoc_exe_wrapper = state.environment.cross_info.<wbr>config["properties"].get('<wbr>gtkdoc_exe_wrapper', None)<br>
++ if gtkdoc_exe_wrapper is not None:<br>
++ args.append('--gtkdoc-exe-<wbr>wrapper=' + gtkdoc_exe_wrapper)<br>
++<br>
+ args += self._unpack_args('--htmlargs=<wbr>', 'html_args', kwargs)<br>
+ args += self._unpack_args('--scanargs=<wbr>', 'scan_args', kwargs)<br>
+ args += self._unpack_args('--<wbr>scanobjsargs=', 'scanobjs_args', kwargs)<br>
+@@ -741,14 +745,22 @@ class GnomeModule(ExtensionModule):<br>
+ raise MesonException(<br>
+ 'Gir include dirs should be include_directories().')<br>
+ cflags.update(get_include_<wbr>args(inc_dirs))<br>
++<br>
++ cross_c_args = " ".join(state.environment.<wbr>cross_info.config["properties"<wbr>].get('c_args', ""))<br>
++ cross_link_args = " ".join(state.environment.<wbr>cross_info.config["properties"<wbr>].get('c_link_args', ""))<br>
++<br>
+ if cflags:<br>
+- args += ['--cflags=%s' % ' '.join(cflags)]<br>
++ args += ['--cflags=%s %s' % (cross_c_args,' '.join(cflags))]<br>
+ if ldflags:<br>
+- args += ['--ldflags=%s' % ' '.join(ldflags)]<br>
++ args += ['--ldflags=%s %s' % (cross_link_args, ' '.join(ldflags))]<br>
+ compiler = state.environment.coredata.<wbr>compilers.get('c')<br>
+- if compiler:<br>
++ cross_compiler = state.environment.coredata.<wbr>cross_compilers.get('c')<br>
++ if compiler and not state.environment.is_cross_<wbr>build():<br>
+ args += ['--cc=%s' % ' '.join(compiler.get_exelist())<wbr>]<br>
+ args += ['--ld=%s' % ' '.join(compiler.get_linker_<wbr>exelist())]<br>
++ elif cross_compiler and state.environment.is_cross_<wbr>build():<br>
++ args += ['--cc=%s' % ' '.join(cross_compiler.get_<wbr>exelist())]<br>
++ args += ['--ld=%s' % ' '.join(cross_compiler.get_<wbr>linker_exelist())]<br>
+<br>
+ return args<br>
+<br>
+diff --git a/mesonbuild/scripts/<wbr>gtkdochelper.py b/mesonbuild/scripts/<wbr>gtkdochelper.py<br>
+index a2cbf5a..19331bd 100644<br>
+--- a/mesonbuild/scripts/<wbr>gtkdochelper.py<br>
++++ b/mesonbuild/scripts/<wbr>gtkdochelper.py<br>
+@@ -44,13 +44,14 @@ parser.add_argument('--ignore-<wbr>headers', dest='ignore_headers', default='')<br>
+ parser.add_argument('--<wbr>namespace', dest='namespace', default='')<br>
+ parser.add_argument('--mode', dest='mode', default='')<br>
+ parser.add_argument('--<wbr>installdir', dest='install_dir')<br>
++parser.add_argument('--<wbr>gtkdoc-exe-wrapper', dest='gtkdoc_exe_wrapper')<br>
+<br>
+ def gtkdoc_run_check(cmd, cwd):<br>
+ # Put stderr into stdout since we want to print it out anyway.<br>
+ # This preserves the order of messages.<br>
+ p, out = Popen_safe(cmd, cwd=cwd, stderr=subprocess.STDOUT)[0:2]<br>
+ if p.returncode != 0:<br>
+- err_msg = ["{!r} failed with status {:d}".format(cmd[0], p.returncode)]<br>
++ err_msg = ["{!r} failed with status {:d}".format(cmd, p.returncode)]<br>
+ if out:<br>
+ err_msg.append(out)<br>
+ raise MesonException('\n'.join(err_<wbr>msg))<br>
+@@ -58,7 +59,7 @@ def gtkdoc_run_check(cmd, cwd):<br>
+ def build_gtkdoc(source_root, build_root, doc_subdir, src_subdirs,<br>
+ main_file, module,<br>
+ html_args, scan_args, fixxref_args, mkdb_args,<br>
+- gobject_typesfile, scanobjs_args, ld, cc, ldflags, cflags,<br>
++ gobject_typesfile, scanobjs_args, gtkdoc_exe_wrapper, ld, cc, ldflags, cflags,<br>
+ html_assets, content_files, ignore_headers, namespace,<br>
+ expand_content_files, mode):<br>
+ print("Building documentation for %s" % module)<br>
+@@ -111,6 +112,9 @@ def build_gtkdoc(source_root, build_root, doc_subdir, src_subdirs,<br>
+ if gobject_typesfile:<br>
+ scanobjs_cmd = ['gtkdoc-scangobj'] + scanobjs_args + ['--types=' + gobject_typesfile,<br>
+ '--module=' + module,<br>
++ '--run=' + gtkdoc_exe_wrapper,<br>
++ '--cc=' + cc,<br>
++ '--ld=' + ld,<br>
+ '--cflags=' + cflags,<br>
+ '--ldflags=' + ldflags]<br>
+<br>
+@@ -206,6 +210,7 @@ def run(args):<br>
+ mkdbargs,<br>
+ options.gobject_typesfile,<br>
+ scanobjsargs,<br>
++ options.gtkdoc_exe_wrapper,<br>
+ options.ld,<br>
+ options.cc,<br>
+ options.ldflags,<br>
+--<br>
+2.14.1<br>
+<br>
diff --git a/meta/recipes-devtools/meson/<wbr>meson/0002-gobject-<wbr>introspection-determine-g-ir-<wbr>scanner-and-g-i.patch b/meta/recipes-devtools/meson/<wbr>meson/0002-gobject-<wbr>introspection-determine-g-ir-<wbr>scanner-and-g-i.patch<br>
new file mode 100644<br>
index 00000000000..f00b9b2a2d1<br>
--- /dev/null<br>
+++ b/meta/recipes-devtools/meson/<wbr>meson/0002-gobject-<wbr>introspection-determine-g-ir-<wbr>scanner-and-g-i.patch<br>
@@ -0,0 +1,41 @@<br>
+From 84cb251a33190ec82faeaad321518a<wbr>f4b309c55e Mon Sep 17 00:00:00 2001<br>
+From: Alexander Kanavin <<a href="mailto:alex.kanavin@gmail.com">alex.kanavin@gmail.com</a>><br>
+Date: Fri, 4 Aug 2017 16:18:47 +0300<br>
+Subject: [PATCH 2/2] gobject-introspection: determine g-ir-scanner and<br>
+ g-ir-compiler paths from pkgconfig<br>
+<br>
+Do not hardcode the name of those binaries; gobject-introspection<br>
+provides them via pkgconfig, and they can be set to something else<br>
+(for example when cross-compiling).<br>
+<br>
+Upstream-Status: Pending<br>
+Signed-off-by: Alexander Kanavin <<a href="mailto:alex.kanavin@gmail.com">alex.kanavin@gmail.com</a>><br>
+---<br>
+ mesonbuild/modules/gnome.py | 4 ++--<br>
+ 1 file changed, 2 insertions(+), 2 deletions(-)<br>
+<br>
+diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py<br>
+index ba7e4cd..00472af 100644<br>
+--- a/mesonbuild/modules/gnome.py<br>
++++ b/mesonbuild/modules/gnome.py<br>
+@@ -380,8 +380,6 @@ class GnomeModule(ExtensionModule):<br>
+ raise MesonException('Gir takes one argument')<br>
+ if kwargs.get('install_dir'):<br>
+ raise MesonException('install_dir is not supported with generate_gir(), see "install_dir_gir" and "install_dir_typelib"')<br>
+- giscanner = find_program('g-ir-scanner', 'Gir')<br>
+- gicompiler = find_program('g-ir-compiler', 'Gir')<br>
+ girtarget = args[0]<br>
+ while hasattr(girtarget, 'held_object'):<br>
+ girtarget = girtarget.held_object<br>
+@@ -392,6 +390,8 @@ class GnomeModule(ExtensionModule):<br>
+ self.gir_dep = PkgConfigDependency('gobject-<wbr>introspection-1.0',<br>
+ state.environment,<br>
+ {'native': True})<br>
++ giscanner = os.environ['PKG_CONFIG_<wbr>SYSROOT_DIR'] + self.gir_dep.get_pkgconfig_<wbr>variable('g_ir_scanner')<br>
++ gicompiler = os.environ['PKG_CONFIG_<wbr>SYSROOT_DIR'] + self.gir_dep.get_pkgconfig_<wbr>variable('g_ir_compiler')<br>
+ pkgargs = self.gir_dep.get_compile_args(<wbr>)<br>
+ except Exception:<br>
+ raise MesonException('gobject-<wbr>introspection dependency was not found, gir cannot be generated.')<br>
+--<br>
+2.13.2<br>
+<br>
diff --git a/meta/recipes-devtools/meson/<a href="http://meson_0.43.0.bb" rel="noreferrer" target="_blank"><wbr>meson_0.43.0.bb</a> b/meta/recipes-devtools/meson/<a href="http://meson_0.43.0.bb" rel="noreferrer" target="_blank"><wbr>meson_0.43.0.bb</a><br>
new file mode 100644<br>
index 00000000000..bbb48d9197c<br>
--- /dev/null<br>
+++ b/meta/recipes-devtools/meson/<a href="http://meson_0.43.0.bb" rel="noreferrer" target="_blank"><wbr>meson_0.43.0.bb</a><br>
@@ -0,0 +1,19 @@<br>
+HOMEPAGE = "<a href="http://mesonbuild.com" rel="noreferrer" target="_blank">http://mesonbuild.com</a>"<br>
+SUMMARY = "A high performance build system"<br>
+<br>
+LICENSE = "Apache-2.0"<br>
+LIC_FILES_CHKSUM = "file://COPYING;md5=<wbr>3b83ef96387f14655fc854ddc3c6bd<wbr>57"<br>
+<br>
+SRC_URI = "<a href="https://github.com/mesonbuild/meson/releases/download/${PV}/${BP}.tar.gz" rel="noreferrer" target="_blank">https://github.com/<wbr>mesonbuild/meson/releases/<wbr>download/${PV}/${BP}.tar.gz</a> \<br>
+ file://0001-gtkdoc-fix-issues-<wbr>that-arise-when-cross-<wbr>compiling.patch \<br>
+ file://0002-gobject-<wbr>introspection-determine-g-ir-<wbr>scanner-and-g-i.patch \<br>
+ "<br>
+SRC_URI[md5sum] = "<wbr>b0d389cc5937928c2f5114656dc5a9<wbr>9a"<br>
+SRC_URI[sha256sum] = "<wbr>c513eca90e0d70bf14cd1eaafea2fa<wbr>91cf40a73326a7ff61f08a00504805<wbr>7340"<br>
+UPSTREAM_CHECK_URI = "<a href="https://github.com/mesonbuild/meson/releases" rel="noreferrer" target="_blank">https://github.com/<wbr>mesonbuild/meson/releases</a>"<br>
+<br>
+inherit setuptools3<br>
+<br>
+RDEPENDS_${PN} = "ninja python3-core python3-modules"<br>
+<br>
+BBCLASSEXTEND = "native"<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.15.0<br>
<br>
--<br>
______________________________<wbr>_________________<br>
Openembedded-core mailing list<br>
<a href="mailto:Openembedded-core@lists.openembedded.org">Openembedded-core@lists.<wbr>openembedded.org</a><br>
<a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/<wbr>mailman/listinfo/openembedded-<wbr>core</a><br>
</font></span></blockquote></div><br></div>