]> code.ossystems Code Review - openembedded-core.git/blob
6afefabc734002b047b606bb89370896a09a09d1
[openembedded-core.git] /
1 From c6e4f83c373b577166a7e46130ce8ff025ee8515 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
6
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.
9
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).
14
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).
18
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.
23
24 These options are useful when cross-compiling for a different target architecture.
25
26 Upstream-Status: Pending [review on oe-core list]
27 Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
28
29 ---
30  Makefile.am       |  2 ++
31  common.mk         | 39 +++++++++++++++++++++++++++++++++++++++
32  configure.ac      | 42 ++++++++++++++++++++++++++++++++++++++++++
33  tests/Makefile.am |  5 ++++-
34  4 files changed, 87 insertions(+), 1 deletion(-)
35
36 diff --git a/Makefile.am b/Makefile.am
37 index 437c673..1eb3545 100644
38 --- a/Makefile.am
39 +++ b/Makefile.am
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
46 +endif
47  include Makefile-tools.am
48  include Makefile-msvcproj.am
49  
50 diff --git a/common.mk b/common.mk
51 index e26c637..9f3a65f 100644
52 --- a/common.mk
53 +++ b/common.mk
54 @@ -6,6 +6,15 @@
55  # module itself.
56  #
57  
58 +if USE_HOST_GI
59 +INTROSPECTION_SCANNER = \
60 +    env PATH="$(PATH)" \
61 +        LPATH=.libs \
62 +        CC="$(CC)" \
63 +        PYTHONPATH=$(top_builddir):$(top_srcdir) \
64 +        UNINSTALLED_INTROSPECTION_BUILDDIR=$(top_builddir) \
65 +        g-ir-scanner
66 +else
67  INTROSPECTION_SCANNER = \
68      env PATH=".libs:$(PATH)" \
69          LPATH=.libs \
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
74 +endif
75 +
76 +if USE_CROSS_WRAPPER
77 +CROSS_WRAPPER_ARG = --use-binary-wrapper=$(GI_CROSS_WRAPPER)
78 +else
79 +CROSS_WRAPPER_ARG =
80 +endif
81 +
82 +if USE_LDD_WRAPPER
83 +LDD_WRAPPER_ARG = --use-ldd-wrapper=$(GI_LDD_WRAPPER)
84 +else
85 +LDD_WRAPPER_ARG =
86 +endif
87  
88  INTROSPECTION_SCANNER_ARGS = \
89      --verbose \
90 +    $(CROSS_WRAPPER_ARG) \
91 +    $(LDD_WRAPPER_ARG) \
92      -I$(top_srcdir) \
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
98  
99 +if USE_CROSS_WRAPPER
100 +INTROSPECTION_COMPILER = \
101 +    env PATH=".libs:$(PATH)" \
102 +        $(GI_CROSS_WRAPPER) $(top_builddir)/.libs/g-ir-compiler$(EXEEXT)
103 +else
104  INTROSPECTION_COMPILER = \
105      env PATH=".libs:$(PATH)" \
106          $(top_builddir)/g-ir-compiler$(EXEEXT)
107 +endif
108  
109  INTROSPECTION_COMPILER_ARGS = \
110      --includedir=$(srcdir) \
111 @@ -35,6 +65,14 @@ INTROSPECTION_COMPILER_ARGS = \
112      --includedir=$(top_builddir) \
113      --includedir=$(top_builddir)/gir
114  
115 +if USE_HOST_GI
116 +INTROSPECTION_DOCTOOL = \
117 +    env PATH="$(PATH)" \
118 +        LPATH=.libs \
119 +        PYTHONPATH=$(top_builddir):$(top_srcdir) \
120 +        UNINSTALLED_INTROSPECTION_BUILDDIR=$(top_builddir) \
121 +        g-ir-doc-tool
122 +else
123  INTROSPECTION_DOCTOOL = \
124      env PATH=".libs:$(PATH)" \
125          LPATH=.libs \
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
130 +endif
131  
132  INTROSPECTION_DOCTOOL_ARGS = \
133      --add-include-path=$(srcdir) \
134 diff --git a/configure.ac b/configure.ac
135 index b11596b..d78ae52 100644
136 --- a/configure.ac
137 +++ b/configure.ac
138 @@ -347,6 +347,48 @@ fi
139  
140  AC_SUBST(EXTRA_LINK_FLAGS)
141  
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])
150 +
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)])],
153 +[
154 +GI_CROSS_WRAPPER="${enableval}"
155 +use_wrapper=true
156 +],[
157 +GI_CROSS_WRAPPER=""
158 +use_wrapper=false
159 +])
160 +AC_SUBST(GI_CROSS_WRAPPER)
161 +AM_CONDITIONAL([USE_CROSS_WRAPPER], [test x$use_wrapper = xtrue])
162 +
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)])],
165 +[
166 +GI_LDD_WRAPPER="${enableval}"
167 +use_ldd_wrapper=true
168 +],[
169 +GI_LDD_WRAPPER=""
170 +use_ldd_wrapper=false
171 +])
172 +AC_SUBST(GI_LDD_WRAPPER)
173 +AM_CONDITIONAL([USE_LDD_WRAPPER], [test x$use_ldd_wrapper = xtrue])
174 +
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])
183 +
184  AC_CONFIG_FILES([
185  Makefile
186  tests/Makefile
187 diff --git a/tests/Makefile.am b/tests/Makefile.am
188 index bdd0fa7..75dd3c9 100644
189 --- a/tests/Makefile.am
190 +++ b/tests/Makefile.am
191 @@ -1,6 +1,9 @@
192  include $(top_srcdir)/common.mk
193  
194 -SUBDIRS = . scanner repository offsets warn
195 +SUBDIRS = . scanner repository warn
196 +if BUILD_INTROSPECTION_DATA
197 +SUBDIRS += offsets
198 +endif
199  
200  EXTRA_DIST=
201  BUILT_SOURCES=
202 -- 
203 2.6.2
204