diff options
author | Alexander Kanavin <alexander.kanavin@linux.intel.com> | 2016-03-09 17:01:50 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-03-12 22:11:43 +0000 |
commit | 10e99777da87aa1223a212a8e11551ef93f09660 (patch) | |
tree | aa3f19be594d5c244ca0ca9d6a1a32c78df68abf /meta/recipes-gnome/gobject-introspection/gobject-introspection | |
parent | 3c66619d50921a17b911f99f095baac3a049cad3 (diff) | |
download | poky-10e99777da87aa1223a212a8e11551ef93f09660.tar.gz |
gobject-introspection: add the recipe
The recipe has comments that explain what is going on and why.
Also, there are patches necessary to make it work in Yocto cross-compilation environment;
they will be submitted upstream.
(From OE-Core rev: c54c5fc63c05d416f3733a742fc94f7a169adc8b)
Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-gnome/gobject-introspection/gobject-introspection')
4 files changed, 401 insertions, 0 deletions
diff --git a/meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-Prefix-pkg-config-paths-with-PKG_CONFIG_SYSROOT_DIR-.patch b/meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-Prefix-pkg-config-paths-with-PKG_CONFIG_SYSROOT_DIR-.patch new file mode 100644 index 0000000000..5026d81772 --- /dev/null +++ b/meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-Prefix-pkg-config-paths-with-PKG_CONFIG_SYSROOT_DIR-.patch | |||
@@ -0,0 +1,97 @@ | |||
1 | From a57604e205e6535acd9989444ad1f5f5038f4fba Mon Sep 17 00:00:00 2001 | ||
2 | From: Alexander Kanavin <alex.kanavin@gmail.com> | ||
3 | Date: Thu, 8 Oct 2015 18:30:35 +0300 | ||
4 | Subject: [PATCH 1/4] Prefix pkg-config paths with PKG_CONFIG_SYSROOT_DIR | ||
5 | environment variable | ||
6 | |||
7 | This environment variable sets the location of sysroot directory in cross-compilation | ||
8 | environments; if the variable is not set, the prefix will be empty. | ||
9 | |||
10 | Upstream-Status: Pending [review on oe-core list] | ||
11 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | ||
12 | |||
13 | --- | ||
14 | Makefile-gir.am | 18 +++++++++--------- | ||
15 | m4/introspection.m4 | 8 ++++---- | ||
16 | 2 files changed, 13 insertions(+), 13 deletions(-) | ||
17 | |||
18 | diff --git a/Makefile-gir.am b/Makefile-gir.am | ||
19 | index 9aca664..09b9360 100644 | ||
20 | --- a/Makefile-gir.am | ||
21 | +++ b/Makefile-gir.am | ||
22 | @@ -55,8 +55,8 @@ else | ||
23 | endif | ||
24 | |||
25 | # glib | ||
26 | -GLIB_INCLUDEDIR=$(shell "${PKG_CONFIG}" --variable=includedir glib-2.0)/glib-2.0 | ||
27 | -GLIB_LIBDIR=$(shell "${PKG_CONFIG}" --variable=libdir glib-2.0) | ||
28 | +GLIB_INCLUDEDIR=$(PKG_CONFIG_SYSROOT_DIR)$(shell "${PKG_CONFIG}" --variable=includedir glib-2.0)/glib-2.0 | ||
29 | +GLIB_LIBDIR=$(PKG_CONFIG_SYSROOT_DIR)$(shell "${PKG_CONFIG}" --variable=libdir glib-2.0) | ||
30 | |||
31 | GLIB_LIBRARY=glib-2.0 | ||
32 | |||
33 | @@ -92,8 +92,8 @@ GLib-2.0.gir: g-ir-scanner g-ir-compiler$(EXEEXT) | ||
34 | gir/DBusGLib-1.0.typelib: GObject-2.0.gir | ||
35 | |||
36 | # gobject | ||
37 | -GOBJECT_INCLUDEDIR=$(shell "${PKG_CONFIG}" --variable=includedir gobject-2.0)/glib-2.0 | ||
38 | -GOBJECT_LIBDIR=$(shell "${PKG_CONFIG}" --variable=libdir gobject-2.0) | ||
39 | +GOBJECT_INCLUDEDIR=$(PKG_CONFIG_SYSROOT_DIR)$(shell "${PKG_CONFIG}" --variable=includedir gobject-2.0)/glib-2.0 | ||
40 | +GOBJECT_LIBDIR=$(PKG_CONFIG_SYSROOT_DIR)$(shell "${PKG_CONFIG}" --variable=libdir gobject-2.0) | ||
41 | |||
42 | GOBJECT_LIBRARY=gobject-2.0 | ||
43 | |||
44 | @@ -120,8 +120,8 @@ GObject_2_0_gir_FILES = \ | ||
45 | BUILT_GIRSOURCES += GObject-2.0.gir | ||
46 | |||
47 | # gmodule | ||
48 | -GMODULE_INCLUDEDIR=$(shell "${PKG_CONFIG}" --variable=includedir gmodule-2.0)/glib-2.0 | ||
49 | -GMODULE_LIBDIR=$(shell "${PKG_CONFIG}" --variable=libdir gmodule-2.0) | ||
50 | +GMODULE_INCLUDEDIR=$(PKG_CONFIG_SYSROOT_DIR)$(shell "${PKG_CONFIG}" --variable=includedir gmodule-2.0)/glib-2.0 | ||
51 | +GMODULE_LIBDIR=$(PKG_CONFIG_SYSROOT_DIR)$(shell "${PKG_CONFIG}" --variable=libdir gmodule-2.0) | ||
52 | |||
53 | GMODULE_LIBRARY=gmodule-2.0 | ||
54 | |||
55 | @@ -146,13 +146,13 @@ GModule_2_0_gir_FILES = $(GLIB_INCLUDEDIR)/gmodule.h \ | ||
56 | BUILT_GIRSOURCES += GModule-2.0.gir | ||
57 | |||
58 | # gio | ||
59 | -GIO_INCLUDEDIR=$(shell "${PKG_CONFIG}" --variable=includedir gio-2.0)/glib-2.0 | ||
60 | -GIO_LIBDIR=$(shell "${PKG_CONFIG}" --variable=libdir gio-2.0) | ||
61 | +GIO_INCLUDEDIR=$(PKG_CONFIG_SYSROOT_DIR)$(shell "${PKG_CONFIG}" --variable=includedir gio-2.0)/glib-2.0 | ||
62 | +GIO_LIBDIR=$(PKG_CONFIG_SYSROOT_DIR)$(shell "${PKG_CONFIG}" --variable=libdir gio-2.0) | ||
63 | |||
64 | GIO_LIBRARY=gio-2.0 | ||
65 | |||
66 | if HAVE_GIO_UNIX | ||
67 | -GIO_UNIX_HDRS=$(shell "${PKG_CONFIG}" --variable=includedir gio-unix-2.0)/gio-unix-2.0/gio/*.h | ||
68 | +GIO_UNIX_HDRS=$(PKG_CONFIG_SYSROOT_DIR)$(shell "${PKG_CONFIG}" --variable=includedir gio-unix-2.0)/gio-unix-2.0/gio/*.h | ||
69 | GIO_UNIX_PACKAGES = gio-unix-2.0 | ||
70 | else | ||
71 | GIO_UNIX_HDRS= | ||
72 | diff --git a/m4/introspection.m4 b/m4/introspection.m4 | ||
73 | index d89c3d9..b562266 100644 | ||
74 | --- a/m4/introspection.m4 | ||
75 | +++ b/m4/introspection.m4 | ||
76 | @@ -56,14 +56,14 @@ m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL], | ||
77 | INTROSPECTION_GIRDIR= | ||
78 | INTROSPECTION_TYPELIBDIR= | ||
79 | if test "x$found_introspection" = "xyes"; then | ||
80 | - INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0` | ||
81 | - INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0` | ||
82 | - INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0` | ||
83 | + INTROSPECTION_SCANNER=$PKG_CONFIG_SYSROOT_DIR`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0` | ||
84 | + INTROSPECTION_COMPILER=$PKG_CONFIG_SYSROOT_DIR`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0` | ||
85 | + INTROSPECTION_GENERATE=$PKG_CONFIG_SYSROOT_DIR`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0` | ||
86 | INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0` | ||
87 | INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)" | ||
88 | INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0` | ||
89 | INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0` | ||
90 | - INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection | ||
91 | + INTROSPECTION_MAKEFILE=$PKG_CONFIG_SYSROOT_DIR`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection | ||
92 | fi | ||
93 | AC_SUBST(INTROSPECTION_SCANNER) | ||
94 | AC_SUBST(INTROSPECTION_COMPILER) | ||
95 | -- | ||
96 | 2.7.0 | ||
97 | |||
diff --git a/meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-configure.ac-add-host-gi-gi-cross-wrapper-and-gi-ldd.patch b/meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-configure.ac-add-host-gi-gi-cross-wrapper-and-gi-ldd.patch new file mode 100644 index 0000000000..6afefabc73 --- /dev/null +++ b/meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-configure.ac-add-host-gi-gi-cross-wrapper-and-gi-ldd.patch | |||
@@ -0,0 +1,204 @@ | |||
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 | |||
diff --git a/meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-giscanner-add-a-use-ldd-wrapper-option.patch b/meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-giscanner-add-a-use-ldd-wrapper-option.patch new file mode 100644 index 0000000000..f923dcccf8 --- /dev/null +++ b/meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-giscanner-add-a-use-ldd-wrapper-option.patch | |||
@@ -0,0 +1,48 @@ | |||
1 | From 291a92f200981a772b2d03739dffb5926a82c5a5 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alexander Kanavin <alex.kanavin@gmail.com> | ||
3 | Date: Fri, 30 Oct 2015 16:28:46 +0200 | ||
4 | Subject: [PATCH 1/2] giscanner: add a --use-ldd-wrapper option | ||
5 | |||
6 | This is useful in cross-compile environments where system's ldd | ||
7 | command does not work on binaries built for a different architecture | ||
8 | |||
9 | Upstream-Status: Pending [review in oe-core] | ||
10 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | ||
11 | |||
12 | --- | ||
13 | giscanner/scannermain.py | 3 +++ | ||
14 | giscanner/shlibs.py | 4 +++- | ||
15 | 2 files changed, 6 insertions(+), 1 deletion(-) | ||
16 | |||
17 | diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py | ||
18 | index e37d3e3..b8fff5f 100755 | ||
19 | --- a/giscanner/scannermain.py | ||
20 | +++ b/giscanner/scannermain.py | ||
21 | @@ -121,6 +121,9 @@ def _get_option_parser(): | ||
22 | parser.add_option("", "--use-binary-wrapper", | ||
23 | action="store", dest="wrapper", default=None, | ||
24 | help="wrapper to use for running programs (useful when cross-compiling)") | ||
25 | + parser.add_option("", "--use-ldd-wrapper", | ||
26 | + action="store", dest="ldd_wrapper", default=None, | ||
27 | + help="wrapper to use instead of ldd (useful when cross-compiling)") | ||
28 | parser.add_option("", "--program-arg", | ||
29 | action="append", dest="program_args", default=[], | ||
30 | help="extra arguments to program") | ||
31 | diff --git a/giscanner/shlibs.py b/giscanner/shlibs.py | ||
32 | index 1ad75ee..41117c6 100644 | ||
33 | --- a/giscanner/shlibs.py | ||
34 | +++ b/giscanner/shlibs.py | ||
35 | @@ -100,7 +100,9 @@ def _resolve_non_libtool(options, binary, libraries): | ||
36 | args.extend(libtool) | ||
37 | args.append('--mode=execute') | ||
38 | platform_system = platform.system() | ||
39 | - if platform_system == 'Darwin': | ||
40 | + if options.ldd_wrapper: | ||
41 | + args.extend([options.ldd_wrapper, binary.args[0]]) | ||
42 | + elif platform_system == 'Darwin': | ||
43 | args.extend(['otool', '-L', binary.args[0]]) | ||
44 | else: | ||
45 | args.extend(['ldd', binary.args[0]]) | ||
46 | -- | ||
47 | 2.1.4 | ||
48 | |||
diff --git a/meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-giscanner-add-use-binary-wrapper-option.patch b/meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-giscanner-add-use-binary-wrapper-option.patch new file mode 100644 index 0000000000..e1241a9499 --- /dev/null +++ b/meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-giscanner-add-use-binary-wrapper-option.patch | |||
@@ -0,0 +1,52 @@ | |||
1 | From 2322f36056265f809aaffb74fcf5ac0c83129752 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alexander Kanavin <alex.kanavin@gmail.com> | ||
3 | Date: Mon, 19 Oct 2015 18:26:40 +0300 | ||
4 | Subject: [PATCH 2/4] giscanner: add --use-binary-wrapper option | ||
5 | |||
6 | With this option, giscanner will use a wrapper executable to run | ||
7 | binaries it's producing, instead of running them directly. This | ||
8 | is useful when binaries are cross-compiled and cannot be run directly, | ||
9 | but they can be run using for example QEMU emulation. | ||
10 | |||
11 | Upstream-Status: Pending [review on oe-core list] | ||
12 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | ||
13 | |||
14 | --- | ||
15 | giscanner/scannermain.py | 14 ++++++++++++++ | ||
16 | 1 file changed, 14 insertions(+) | ||
17 | |||
18 | diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py | ||
19 | index b36284d..e37d3e3 100755 | ||
20 | --- a/giscanner/scannermain.py | ||
21 | +++ b/giscanner/scannermain.py | ||
22 | @@ -118,6 +118,9 @@ def _get_option_parser(): | ||
23 | parser.add_option("", "--program", | ||
24 | action="store", dest="program", default=None, | ||
25 | help="program to execute") | ||
26 | + parser.add_option("", "--use-binary-wrapper", | ||
27 | + action="store", dest="wrapper", default=None, | ||
28 | + help="wrapper to use for running programs (useful when cross-compiling)") | ||
29 | parser.add_option("", "--program-arg", | ||
30 | action="append", dest="program_args", default=[], | ||
31 | help="extra arguments to program") | ||
32 | @@ -406,6 +409,17 @@ def create_binary(transformer, options, args): | ||
33 | gdump_parser.get_error_quark_functions()) | ||
34 | |||
35 | shlibs = resolve_shlibs(options, binary, options.libraries) | ||
36 | + if options.wrapper: | ||
37 | + # The wrapper needs the binary itself, not the libtool wrapper script, | ||
38 | + # so we check if libtool has sneaked the binary into .libs subdirectory | ||
39 | + # and adjust the path accordingly | ||
40 | + import os.path | ||
41 | + dir_name, binary_name = os.path.split(binary.args[0]) | ||
42 | + libtool_binary = os.path.join(dir_name, '.libs', binary_name) | ||
43 | + if os.path.exists(libtool_binary): | ||
44 | + binary.args[0] = libtool_binary | ||
45 | + # Then prepend the wrapper to the command line to execute | ||
46 | + binary.args = [options.wrapper] + binary.args | ||
47 | gdump_parser.set_introspection_binary(binary) | ||
48 | gdump_parser.parse() | ||
49 | return shlibs | ||
50 | -- | ||
51 | 2.1.4 | ||
52 | |||