blob: 7ffd6c54cb098a877294d719445aa401ba8598df [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From 3ac4e58c5494bd7e603a325b5b5c2b8075849fee Mon Sep 17 00:00:00 2001
Brad Bishop316dfdd2018-06-25 12:45:53 -04002From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Fri, 4 Aug 2017 16:16:41 +0300
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08004Subject: [PATCH] gtkdoc: fix issues that arise when cross-compiling
Brad Bishop316dfdd2018-06-25 12:45:53 -04005
6Specifically:
71) Make it possible to specify a wrapper for executing binaries
8(usually, some kind of target hardware emulator, such as qemu)
92) Explicitly provide CC and LD via command line, as otherwise gtk-doc will
10try to guess them, incorrectly.
113) If things break down, print the full command with arguments,
12not just the binary name.
134) Correctly determine the compiler/linker executables and cross-options when cross-compiling
14
15Upstream-Status: Pending
16Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
17
18---
19 mesonbuild/modules/gnome.py | 18 +++++++++++++++---
20 mesonbuild/scripts/gtkdochelper.py | 9 +++++++--
21 2 files changed, 22 insertions(+), 5 deletions(-)
22
23diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080024index cb69641..727eb6a 100644
Brad Bishop316dfdd2018-06-25 12:45:53 -040025--- a/mesonbuild/modules/gnome.py
26+++ b/mesonbuild/modules/gnome.py
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080027@@ -792,6 +792,10 @@ This will become a hard error in the future.''')
Brad Bishop316dfdd2018-06-25 12:45:53 -040028 '--mode=' + mode]
29 if namespace:
30 args.append('--namespace=' + namespace)
31+ gtkdoc_exe_wrapper = state.environment.cross_info.config["properties"].get('gtkdoc_exe_wrapper', None)
32+ if gtkdoc_exe_wrapper is not None:
33+ args.append('--gtkdoc-exe-wrapper=' + gtkdoc_exe_wrapper)
34+
35 args += self._unpack_args('--htmlargs=', 'html_args', kwargs)
36 args += self._unpack_args('--scanargs=', 'scan_args', kwargs)
37 args += self._unpack_args('--scanobjsargs=', 'scanobjs_args', kwargs)
Brad Bishop316dfdd2018-06-25 12:45:53 -040038diff --git a/mesonbuild/scripts/gtkdochelper.py b/mesonbuild/scripts/gtkdochelper.py
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080039index 948dc5a..9c5bd19 100644
Brad Bishop316dfdd2018-06-25 12:45:53 -040040--- a/mesonbuild/scripts/gtkdochelper.py
41+++ b/mesonbuild/scripts/gtkdochelper.py
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080042@@ -45,6 +45,7 @@ parser.add_argument('--ignore-headers', dest='ignore_headers', default='')
Brad Bishop316dfdd2018-06-25 12:45:53 -040043 parser.add_argument('--namespace', dest='namespace', default='')
44 parser.add_argument('--mode', dest='mode', default='')
45 parser.add_argument('--installdir', dest='install_dir')
46+parser.add_argument('--gtkdoc-exe-wrapper', dest='gtkdoc_exe_wrapper')
47
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080048 def gtkdoc_run_check(cmd, cwd, library_paths=None):
49 if library_paths is None:
50@@ -64,7 +65,7 @@ def gtkdoc_run_check(cmd, cwd, library_paths=None):
Brad Bishop316dfdd2018-06-25 12:45:53 -040051 # This preserves the order of messages.
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080052 p, out = Popen_safe(cmd, cwd=cwd, env=env, stderr=subprocess.STDOUT)[0:2]
Brad Bishop316dfdd2018-06-25 12:45:53 -040053 if p.returncode != 0:
54- err_msg = ["{!r} failed with status {:d}".format(cmd[0], p.returncode)]
55+ err_msg = ["{!r} failed with status {:d}".format(cmd, p.returncode)]
56 if out:
57 err_msg.append(out)
58 raise MesonException('\n'.join(err_msg))
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080059@@ -74,7 +75,7 @@ def gtkdoc_run_check(cmd, cwd, library_paths=None):
Brad Bishop316dfdd2018-06-25 12:45:53 -040060 def build_gtkdoc(source_root, build_root, doc_subdir, src_subdirs,
61 main_file, module,
62 html_args, scan_args, fixxref_args, mkdb_args,
63- gobject_typesfile, scanobjs_args, ld, cc, ldflags, cflags,
64+ gobject_typesfile, scanobjs_args, gtkdoc_exe_wrapper, ld, cc, ldflags, cflags,
65 html_assets, content_files, ignore_headers, namespace,
66 expand_content_files, mode):
67 print("Building documentation for %s" % module)
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080068@@ -135,6 +136,9 @@ def build_gtkdoc(source_root, build_root, doc_subdir, src_subdirs,
Brad Bishop316dfdd2018-06-25 12:45:53 -040069 if gobject_typesfile:
70 scanobjs_cmd = ['gtkdoc-scangobj'] + scanobjs_args + ['--types=' + gobject_typesfile,
71 '--module=' + module,
72+ '--run=' + gtkdoc_exe_wrapper,
73+ '--cc=' + cc,
74+ '--ld=' + ld,
75 '--cflags=' + cflags,
76 '--ldflags=' + ldflags,
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080077 '--cc=' + cc,
78@@ -238,6 +242,7 @@ def run(args):
Brad Bishop316dfdd2018-06-25 12:45:53 -040079 mkdbargs,
80 options.gobject_typesfile,
81 scanobjsargs,
82+ options.gtkdoc_exe_wrapper,
83 options.ld,
84 options.cc,
85 options.ldflags,