From f7c8f07aaa4ccf469d51bf466773b7c489423dbe Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Fri, 4 Aug 2017 16:23:37 +0300 Subject: meson: fix gtk-doc and gobject-introspection This requires adding a couple of patches to meson, and setting the gtkdoc wrapper in build configuration. Signed-off-by: Alexander Kanavin --- meta-oe/classes/meson.bbclass | 1 + ...ix-issues-that-arise-when-cross-compiling.patch | 85 ++++++++++++++++++++++ ...rospection-determine-g-ir-scanner-and-g-i.patch | 41 +++++++++++ meta-oe/recipes-devtools/meson/meson_0.41.1.bb | 5 +- 4 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 meta-oe/recipes-devtools/meson/meson/0001-gtkdoc-fix-issues-that-arise-when-cross-compiling.patch create mode 100644 meta-oe/recipes-devtools/meson/meson/0002-gobject-introspection-determine-g-ir-scanner-and-g-i.patch diff --git a/meta-oe/classes/meson.bbclass b/meta-oe/classes/meson.bbclass index 6f520b870d..575889d4fe 100644 --- a/meta-oe/classes/meson.bbclass +++ b/meta-oe/classes/meson.bbclass @@ -59,6 +59,7 @@ c_args = [${@meson_array('MESON_C_ARGS', d)}] c_link_args = [${@meson_array('MESON_LINK_ARGS', d)}] cpp_args = [${@meson_array('MESON_C_ARGS', d)}] cpp_link_args = [${@meson_array('MESON_LINK_ARGS', d)}] +gtkdoc_exe_wrapper = '${B}/gtkdoc-qemuwrapper' [host_machine] system = '${HOST_OS}' diff --git a/meta-oe/recipes-devtools/meson/meson/0001-gtkdoc-fix-issues-that-arise-when-cross-compiling.patch b/meta-oe/recipes-devtools/meson/meson/0001-gtkdoc-fix-issues-that-arise-when-cross-compiling.patch new file mode 100644 index 0000000000..3e11022416 --- /dev/null +++ b/meta-oe/recipes-devtools/meson/meson/0001-gtkdoc-fix-issues-that-arise-when-cross-compiling.patch @@ -0,0 +1,85 @@ +From bf04732803910a7cd15be1016b62c60ae42c1366 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Fri, 4 Aug 2017 16:16:41 +0300 +Subject: [PATCH 1/2] gtkdoc: fix issues that arise when cross-compiling + +Specifically: +1) Make it possible to specify a wrapper for executing binaries +(usually, some kind of target hardware emulator, such as qemu) +2) Explicitly provide CC and LD, as otherwise gtk-doc will +try to guess them, incorrectly. +3) If things break down, print the full command with arguments, +not just the binary name. + +Upstream-Status: Pending +Signed-off-by: Alexander Kanavin +--- + mesonbuild/modules/gnome.py | 4 ++++ + mesonbuild/scripts/gtkdochelper.py | 9 +++++++-- + 2 files changed, 11 insertions(+), 2 deletions(-) + +diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py +index 6ec7040..ba7e4cd 100644 +--- a/mesonbuild/modules/gnome.py ++++ b/mesonbuild/modules/gnome.py +@@ -713,6 +713,10 @@ class GnomeModule(ExtensionModule): + '--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 += 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 a2cbf5a..19331bd 100644 +--- a/mesonbuild/scripts/gtkdochelper.py ++++ b/mesonbuild/scripts/gtkdochelper.py +@@ -44,13 +44,14 @@ 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. + # This preserves the order of messages. + p, out = Popen_safe(cmd, cwd=cwd, 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): + 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) +@@ -111,6 +112,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] + +@@ -206,6 +210,7 @@ def run(args): + mkdbargs, + options.gobject_typesfile, + scanobjsargs, ++ options.gtkdoc_exe_wrapper, + options.ld, + options.cc, + options.ldflags, +-- +2.13.2 + diff --git a/meta-oe/recipes-devtools/meson/meson/0002-gobject-introspection-determine-g-ir-scanner-and-g-i.patch b/meta-oe/recipes-devtools/meson/meson/0002-gobject-introspection-determine-g-ir-scanner-and-g-i.patch new file mode 100644 index 0000000000..f00b9b2a2d --- /dev/null +++ b/meta-oe/recipes-devtools/meson/meson/0002-gobject-introspection-determine-g-ir-scanner-and-g-i.patch @@ -0,0 +1,41 @@ +From 84cb251a33190ec82faeaad321518af4b309c55e Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Fri, 4 Aug 2017 16:18:47 +0300 +Subject: [PATCH 2/2] gobject-introspection: determine g-ir-scanner and + g-ir-compiler paths from pkgconfig + +Do not hardcode the name of those binaries; gobject-introspection +provides them via pkgconfig, and they can be set to something else +(for example when cross-compiling). + +Upstream-Status: Pending +Signed-off-by: Alexander Kanavin +--- + mesonbuild/modules/gnome.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py +index ba7e4cd..00472af 100644 +--- a/mesonbuild/modules/gnome.py ++++ b/mesonbuild/modules/gnome.py +@@ -380,8 +380,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') + girtarget = args[0] + while hasattr(girtarget, 'held_object'): + girtarget = girtarget.held_object +@@ -392,6 +390,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.') +-- +2.13.2 + diff --git a/meta-oe/recipes-devtools/meson/meson_0.41.1.bb b/meta-oe/recipes-devtools/meson/meson_0.41.1.bb index 191fd453a9..66ea10e112 100644 --- a/meta-oe/recipes-devtools/meson/meson_0.41.1.bb +++ b/meta-oe/recipes-devtools/meson/meson_0.41.1.bb @@ -4,7 +4,10 @@ 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}/${BP}.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 \ + " SRC_URI[md5sum] = "394b838952d78138b3873b7a745538c1" SRC_URI[sha256sum] = "3d160b0514ff3d25f0a47975c6f70fd82b76c589876d10413efc5e01df43e0c2" -- cgit 1.2.3-korg