1 From a28cc8413b68bec5b4cf2ee5f37b40a8965490a5 Mon Sep 17 00:00:00 2001
2 From: Alexander Kanavin <alex.kanavin@gmail.com>
3 Date: Mon, 19 Oct 2015 18:29:21 +0300
4 Subject: [PATCH] configure.ac: add host-gi, gi-cross-wrapper, gi-ldd-wrapper
5 and introspection-data options
7 With the first option, gobject-introspection tools (g-ir-doc-tool and g-ir-scanner)
8 that are already installed in the host system will be used for building the source tree.
10 With the second option, g-ir-scanner will be instructed to use an executable
11 wrapper to run binaries it's producing, and g-ir-compiler will be run
12 through the same wrapper (host system's g-ir-compiler cannot be used because
13 it's producing architecture-specific output).
15 With the third option, giscanner will be instructed to use a special ldd
16 command instead of system's ldd (which does not work when the binary to inspect
17 is compiled for a different architecture).
19 With the fourth option, it is possible to disable building of introspection data
20 (.gir and .typelib files), which may be difficult or impossible in cross-compilation
21 environments, because of lack of emulation (or native hardware) for the target architecture
22 on which the target binaries can be run.
24 These options are useful when cross-compiling for a different target architecture.
26 Upstream-Status: Pending [review on oe-core list]
27 Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
31 common.mk | 39 +++++++++++++++++++++++++++++++++++++++
32 configure.ac | 42 ++++++++++++++++++++++++++++++++++++++++++
33 tests/Makefile.am | 5 ++++-
34 4 files changed, 87 insertions(+), 1 deletion(-)
36 diff --git a/Makefile.am b/Makefile.am
37 index 44ed115..2a1fa56 100644
40 @@ -21,7 +21,9 @@ include Makefile-cmph.am
41 include Makefile-girepository.am
42 include Makefile-giscanner.am
43 include Makefile-examples.am
44 +if BUILD_INTROSPECTION_DATA
45 include Makefile-gir.am
47 include Makefile-tools.am
49 ## Process this file with automake to produce Makefile.in
50 diff --git a/common.mk b/common.mk
51 index e26c637..9f3a65f 100644
59 +INTROSPECTION_SCANNER = \
60 + env PATH="$(PATH)" \
63 + PYTHONPATH=$(top_builddir):$(top_srcdir) \
64 + UNINSTALLED_INTROSPECTION_BUILDDIR=$(top_builddir) \
67 INTROSPECTION_SCANNER = \
68 env PATH=".libs:$(PATH)" \
70 @@ -14,9 +23,24 @@ INTROSPECTION_SCANNER = \
71 UNINSTALLED_INTROSPECTION_SRCDIR=$(top_srcdir) \
72 UNINSTALLED_INTROSPECTION_BUILDDIR=$(top_builddir) \
73 $(top_builddir)/g-ir-scanner
77 +CROSS_WRAPPER_ARG = --use-binary-wrapper=$(GI_CROSS_WRAPPER)
83 +LDD_WRAPPER_ARG = --use-ldd-wrapper=$(GI_LDD_WRAPPER)
88 INTROSPECTION_SCANNER_ARGS = \
90 + $(CROSS_WRAPPER_ARG) \
91 + $(LDD_WRAPPER_ARG) \
93 --add-include-path=$(srcdir) \
94 --add-include-path=$(top_srcdir)/gir \
95 @@ -24,9 +48,15 @@ INTROSPECTION_SCANNER_ARGS = \
96 --add-include-path=$(top_builddir) \
97 --add-include-path=$(top_builddir)/gir
100 +INTROSPECTION_COMPILER = \
101 + env PATH=".libs:$(PATH)" \
102 + $(GI_CROSS_WRAPPER) $(top_builddir)/.libs/g-ir-compiler$(EXEEXT)
104 INTROSPECTION_COMPILER = \
105 env PATH=".libs:$(PATH)" \
106 $(top_builddir)/g-ir-compiler$(EXEEXT)
109 INTROSPECTION_COMPILER_ARGS = \
110 --includedir=$(srcdir) \
111 @@ -35,6 +65,14 @@ INTROSPECTION_COMPILER_ARGS = \
112 --includedir=$(top_builddir) \
113 --includedir=$(top_builddir)/gir
116 +INTROSPECTION_DOCTOOL = \
117 + env PATH="$(PATH)" \
119 + PYTHONPATH=$(top_builddir):$(top_srcdir) \
120 + UNINSTALLED_INTROSPECTION_BUILDDIR=$(top_builddir) \
123 INTROSPECTION_DOCTOOL = \
124 env PATH=".libs:$(PATH)" \
126 @@ -42,6 +80,7 @@ INTROSPECTION_DOCTOOL = \
127 UNINSTALLED_INTROSPECTION_SRCDIR=$(top_srcdir) \
128 UNINSTALLED_INTROSPECTION_BUILDDIR=$(top_builddir) \
129 $(top_builddir)/g-ir-doc-tool
132 INTROSPECTION_DOCTOOL_ARGS = \
133 --add-include-path=$(srcdir) \
134 diff --git a/configure.ac b/configure.ac
135 index d48e6c3..ed5f8a2 100644
138 @@ -367,6 +367,48 @@ dnl
139 AM_CONDITIONAL(MSVC_BASE_NO_TOOLSET_SET, [test x$MSVC_BASE_TOOLSET = x])
140 AM_CONDITIONAL(MSVC_NO_TOOLSET_SET, [test x$MSVC_TOOLSET = x])
142 +AC_ARG_ENABLE([host-gi],
143 +[AS_HELP_STRING([--enable-host-gi],[Use gobject introspection tools installed in the host system (useful when cross-compiling)])],
144 +[case "${enableval}" in
145 + yes) host_gi=true ;;
146 + no) host_gi=false ;;
147 + *) AC_MSG_ERROR([bad value ${enableval} for --enable-host-gi]) ;;
148 +esac],[host_gi=false])
149 +AM_CONDITIONAL([USE_HOST_GI], [test x$host_gi = xtrue])
151 +AC_ARG_ENABLE([gi-cross-wrapper],
152 +[AS_HELP_STRING([--enable-gi-cross-wrapper=path],[Use a wrapper to run gicompiler and binaries produced by giscanner (useful when cross-compiling)])],
154 +GI_CROSS_WRAPPER="${enableval}"
160 +AC_SUBST(GI_CROSS_WRAPPER)
161 +AM_CONDITIONAL([USE_CROSS_WRAPPER], [test x$use_wrapper = xtrue])
163 +AC_ARG_ENABLE([gi-ldd-wrapper],
164 +[AS_HELP_STRING([--enable-gi-ldd-wrapper=path],[Use a ldd wrapper instead of system's ldd command in giscanner (useful when cross-compiling)])],
166 +GI_LDD_WRAPPER="${enableval}"
167 +use_ldd_wrapper=true
170 +use_ldd_wrapper=false
172 +AC_SUBST(GI_LDD_WRAPPER)
173 +AM_CONDITIONAL([USE_LDD_WRAPPER], [test x$use_ldd_wrapper = xtrue])
175 +AC_ARG_ENABLE([introspection-data],
176 +[AS_HELP_STRING([--enable-introspection-data],[Build introspection data (.gir and .typelib files) in addition to library and tools])],
177 +[case "${enableval}" in
178 + yes) introspection_data=true ;;
179 + no) introspection_data=false ;;
180 + *) AC_MSG_ERROR([bad value ${enableval} for --enable-introspection-data]) ;;
181 +esac],[introspection_data=true])
182 +AM_CONDITIONAL([BUILD_INTROSPECTION_DATA], [test x$introspection_data = xtrue])
187 diff --git a/tests/Makefile.am b/tests/Makefile.am
188 index 4bdb9c3..10b0f27 100644
189 --- a/tests/Makefile.am
190 +++ b/tests/Makefile.am
192 include $(top_srcdir)/common.mk
194 -SUBDIRS = . scanner repository offsets warn
195 +SUBDIRS = . scanner repository warn
196 +if BUILD_INTROSPECTION_DATA