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 | |
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')
5 files changed, 560 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 | |||
diff --git a/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.46.0.bb b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.46.0.bb new file mode 100644 index 0000000000..d51e607c09 --- /dev/null +++ b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.46.0.bb | |||
@@ -0,0 +1,159 @@ | |||
1 | HOMEPAGE = "http://gnome.org" | ||
2 | BUGTRACKER = "https://bugzilla.gnome.org/" | ||
3 | SECTION = "libs" | ||
4 | LICENSE = "LGPLv2+ & GPLv2+" | ||
5 | LIC_FILES_CHKSUM = "file://COPYING;md5=90d577535a3898e1ae5dbf0ae3509a8c \ | ||
6 | file://tools/compiler.c;endline=20;md5=fc5007fc20022720e6c0b0cdde41fabd \ | ||
7 | file://giscanner/sourcescanner.c;endline=22;md5=194d6e0c1d00662f32d030ce44de8d39 \ | ||
8 | file://girepository/giregisteredtypeinfo.c;endline=21;md5=661847611ae6979465415f31a759ba27" | ||
9 | |||
10 | SRC_URI = "${GNOME_MIRROR}/${BPN}/1.46/${BPN}-${PV}.tar.xz \ | ||
11 | file://0001-Prefix-pkg-config-paths-with-PKG_CONFIG_SYSROOT_DIR-.patch \ | ||
12 | file://0001-giscanner-add-use-binary-wrapper-option.patch \ | ||
13 | file://0001-giscanner-add-a-use-ldd-wrapper-option.patch \ | ||
14 | file://0001-configure.ac-add-host-gi-gi-cross-wrapper-and-gi-ldd.patch \ | ||
15 | " | ||
16 | SRC_URI[md5sum] = "adb40a31c7c80b65b0f4c8fd71b493dc" | ||
17 | SRC_URI[sha256sum] = "6658bd3c2b8813eb3e2511ee153238d09ace9d309e4574af27443d87423e4233" | ||
18 | |||
19 | inherit autotools pkgconfig gtk-doc pythonnative qemu | ||
20 | BBCLASSEXTEND = "native" | ||
21 | |||
22 | # necessary to let the call for python-config from configure.ac succeed | ||
23 | export BUILD_SYS | ||
24 | export HOST_SYS | ||
25 | export STAGING_INCDIR | ||
26 | export STAGING_LIBDIR | ||
27 | |||
28 | # needed for writing out the qemu wrapper script | ||
29 | export STAGING_DIR_HOST | ||
30 | export B | ||
31 | |||
32 | DEPENDS_append = " libffi zlib glib-2.0 python" | ||
33 | |||
34 | # target build needs qemu to run temporary introspection binaries created | ||
35 | # on the fly by g-ir-scanner and a native version of itself to run | ||
36 | # native versions of its own tools during build. | ||
37 | # Also prelink-rtld is used to find out library dependencies of introspection binaries | ||
38 | # (standard ldd doesn't work when cross-compiling). | ||
39 | DEPENDS_class-target_append = " gobject-introspection-native qemu-native prelink-native" | ||
40 | |||
41 | SSTATE_SCAN_FILES += "g-ir-scanner-qemuwrapper g-ir-scanner-wrapper g-ir-compiler-wrapper g-ir-scanner-lddwrapper Gio-2.0.gir" | ||
42 | |||
43 | do_configure_prepend_class-native() { | ||
44 | # Tweak the native python scripts so that they don't refer to the | ||
45 | # full path of native python binary (the solution is taken from glib-2.0 recipe) | ||
46 | # This removes the risk of exceeding Linux kernel's shebang line limit (128 bytes) | ||
47 | sed -i -e '1s,#!.*,#!${USRBINPATH}/env nativepython,' ${S}/tools/g-ir-tool-template.in | ||
48 | } | ||
49 | |||
50 | do_configure_prepend_class-target() { | ||
51 | # Write out a qemu wrapper that will be given to gi-scanner so that it | ||
52 | # can run target helper binaries through that. | ||
53 | qemu_binary="${@qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['\$GIR_EXTRA_LIBS_PATH','.libs','$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}" | ||
54 | cat > ${B}/g-ir-scanner-qemuwrapper << EOF | ||
55 | #!/bin/sh | ||
56 | $qemu_binary "\$@" | ||
57 | if [ \$? -ne 0 ]; then | ||
58 | echo "If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the recipe should help." | ||
59 | echo "(typically like this: GIR_EXTRA_LIBS_PATH=\"$""{B}/something/.libs\" )" | ||
60 | exit 1 | ||
61 | fi | ||
62 | EOF | ||
63 | chmod +x ${B}/g-ir-scanner-qemuwrapper | ||
64 | |||
65 | # Write out a wrapper for g-ir-scanner itself, which will be used when building introspection files | ||
66 | # for glib-based packages. This wrapper calls the native version of the scanner, and tells it to use | ||
67 | # a qemu wrapper for running transient target binaries produced by the scanner, and an include directory | ||
68 | # from the target sysroot. | ||
69 | cat > ${B}/g-ir-scanner-wrapper << EOF | ||
70 | #!/bin/sh | ||
71 | # This prevents g-ir-scanner from writing cache data to $HOME | ||
72 | export GI_SCANNER_DISABLE_CACHE=1 | ||
73 | |||
74 | g-ir-scanner --use-binary-wrapper=${STAGING_BINDIR}/g-ir-scanner-qemuwrapper --use-ldd-wrapper=${STAGING_BINDIR}/g-ir-scanner-lddwrapper --add-include-path=${STAGING_DATADIR}/gir-1.0 "\$@" | ||
75 | EOF | ||
76 | chmod +x ${B}/g-ir-scanner-wrapper | ||
77 | |||
78 | # Write out a wrapper for g-ir-compiler, which runs the target version of it through qemu. | ||
79 | # g-ir-compiler writes out the raw content of a C struct to disk, and therefore is architecture dependent. | ||
80 | cat > ${B}/g-ir-compiler-wrapper << EOF | ||
81 | #!/bin/sh | ||
82 | ${STAGING_BINDIR}/g-ir-scanner-qemuwrapper ${STAGING_BINDIR}/g-ir-compiler "\$@" | ||
83 | EOF | ||
84 | chmod +x ${B}/g-ir-compiler-wrapper | ||
85 | |||
86 | # Write out a wrapper to use instead of ldd, which does not work when a binary is built | ||
87 | # for a different architecture | ||
88 | cat > ${B}/g-ir-scanner-lddwrapper << EOF | ||
89 | #!/bin/sh | ||
90 | prelink-rtld --root=$STAGING_DIR_HOST "\$@" | ||
91 | EOF | ||
92 | chmod +x ${B}/g-ir-scanner-lddwrapper | ||
93 | |||
94 | # Also tweak the target python scripts so that they don't refer to the | ||
95 | # native version of python binary (the solution is taken from glib-2.0 recipe) | ||
96 | sed -i -e '1s,#!.*,#!${USRBINPATH}/env python,' ${S}/tools/g-ir-tool-template.in | ||
97 | } | ||
98 | |||
99 | # Configure target build to use native tools of itself and to use a qemu wrapper | ||
100 | # and optionally to generate introspection data | ||
101 | EXTRA_OECONF_class-target += "--enable-host-gi \ | ||
102 | --enable-gi-cross-wrapper=${B}/g-ir-scanner-qemuwrapper \ | ||
103 | --enable-gi-ldd-wrapper=${B}/g-ir-scanner-lddwrapper \ | ||
104 | ${@bb.utils.contains('COMBINED_FEATURES', 'gobject-introspection-data', '--enable-introspection-data', '--disable-introspection-data', d)} \ | ||
105 | " | ||
106 | |||
107 | |||
108 | do_compile_prepend_class-target() { | ||
109 | # This prevents g-ir-scanner from writing cache data to $HOME | ||
110 | export GI_SCANNER_DISABLE_CACHE=1 | ||
111 | |||
112 | # Needed to run g-ir unit tests, which won't be able to find the built libraries otherwise | ||
113 | export GIR_EXTRA_LIBS_PATH=$B/.libs | ||
114 | } | ||
115 | |||
116 | # Our wrappers need to be available system-wide, because they will be used | ||
117 | # to build introspection files for all other gobject-based packages | ||
118 | do_install_append_class-target() { | ||
119 | install -d ${D}${bindir}/ | ||
120 | install ${B}/g-ir-scanner-qemuwrapper ${D}${bindir}/ | ||
121 | install ${B}/g-ir-scanner-wrapper ${D}${bindir}/ | ||
122 | install ${B}/g-ir-compiler-wrapper ${D}${bindir}/ | ||
123 | install ${B}/g-ir-scanner-lddwrapper ${D}${bindir}/ | ||
124 | } | ||
125 | |||
126 | # .typelib files are needed at runtime and so they go to the main package | ||
127 | FILES_${PN}_append = " ${libdir}/girepository-*/*.typelib" | ||
128 | |||
129 | # .gir files go to dev package, as they're needed for developing (but not for running) | ||
130 | # things that depends on introspection. | ||
131 | FILES_${PN}-dev_append = " ${datadir}/gir-*/*.gir" | ||
132 | |||
133 | # These are used by gobject-based packages | ||
134 | # to generate transient introspection binaries | ||
135 | FILES_${PN}-dev_append = " ${datadir}/gobject-introspection-1.0/gdump.c \ | ||
136 | ${datadir}/gobject-introspection-1.0/Makefile.introspection" | ||
137 | |||
138 | # These are used by dependent packages (e.g. pygobject) to build their | ||
139 | # testsuites. | ||
140 | FILES_${PN}-dev_append = " ${datadir}/gobject-introspection-1.0/tests/*.c \ | ||
141 | ${datadir}/gobject-introspection-1.0/tests/*.h" | ||
142 | |||
143 | FILES_${PN}-dbg += "${libdir}/gobject-introspection/giscanner/.debug/" | ||
144 | FILES_${PN}-staticdev += "${libdir}/gobject-introspection/giscanner/*.a" | ||
145 | |||
146 | # we need target versions of introspection tools in sysroot so that they can be run via qemu | ||
147 | # when building introspection files in other packages | ||
148 | SYSROOT_PREPROCESS_FUNCS_append_class-target += "gi_binaries_sysroot_preprocess" | ||
149 | |||
150 | gi_binaries_sysroot_preprocess() { | ||
151 | sysroot_stage_dir ${D}${bindir} ${SYSROOT_DESTDIR}${bindir} | ||
152 | |||
153 | # Also, tweak the binary names in introspection pkgconfig file, so that it picks up our | ||
154 | # wrappers which do the cross-compile and qemu magic. | ||
155 | sed -i \ | ||
156 | -e "s|g_ir_scanner=.*|g_ir_scanner=${bindir}/g-ir-scanner-wrapper|" \ | ||
157 | -e "s|g_ir_compiler=.*|g_ir_compiler=${bindir}/g-ir-compiler-wrapper|" \ | ||
158 | ${SYSROOT_DESTDIR}${libdir}/pkgconfig/gobject-introspection-1.0.pc | ||
159 | } | ||