diff options
Diffstat (limited to 'meta/recipes-gnome/gobject-introspection/gobject-introspection_1.48.0.bb')
-rw-r--r-- | meta/recipes-gnome/gobject-introspection/gobject-introspection_1.48.0.bb | 164 |
1 files changed, 164 insertions, 0 deletions
diff --git a/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.48.0.bb b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.48.0.bb new file mode 100644 index 0000000000..f368814deb --- /dev/null +++ b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.48.0.bb | |||
@@ -0,0 +1,164 @@ | |||
1 | SUMMARY = "Middleware layer between GObject-using C libraries and language bindings" | ||
2 | HOMEPAGE = "https://wiki.gnome.org/action/show/Projects/GObjectIntrospection" | ||
3 | BUGTRACKER = "https://bugzilla.gnome.org/" | ||
4 | SECTION = "libs" | ||
5 | LICENSE = "LGPLv2+ & GPLv2+" | ||
6 | LIC_FILES_CHKSUM = "file://COPYING;md5=90d577535a3898e1ae5dbf0ae3509a8c \ | ||
7 | file://tools/compiler.c;endline=20;md5=fc5007fc20022720e6c0b0cdde41fabd \ | ||
8 | file://giscanner/sourcescanner.c;endline=22;md5=194d6e0c1d00662f32d030ce44de8d39 \ | ||
9 | file://girepository/giregisteredtypeinfo.c;endline=21;md5=661847611ae6979465415f31a759ba27" | ||
10 | |||
11 | SRC_URI = "${GNOME_MIRROR}/${BPN}/1.48/${BPN}-${PV}.tar.xz \ | ||
12 | file://0001-Revert-an-incomplete-upstream-attempt-at-cross-compi.patch \ | ||
13 | file://0002-configure.ac-add-host-gi-gi-cross-wrapper-gi-ldd-wra.patch \ | ||
14 | file://0003-giscanner-add-use-binary-wrapper-option.patch \ | ||
15 | file://0004-giscanner-add-a-use-ldd-wrapper-option.patch \ | ||
16 | file://0005-Prefix-pkg-config-paths-with-PKG_CONFIG_SYSROOT_DIR-.patch \ | ||
17 | " | ||
18 | SRC_URI[md5sum] = "01301fa9019667d48e927353e08bc218" | ||
19 | SRC_URI[sha256sum] = "fa275aaccdbfc91ec0bc9a6fd0562051acdba731e7d584b64a277fec60e75877" | ||
20 | |||
21 | inherit autotools pkgconfig gtk-doc pythonnative qemu gobject-introspection-data | ||
22 | BBCLASSEXTEND = "native" | ||
23 | |||
24 | # necessary to let the call for python-config from configure.ac succeed | ||
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 flex-native bison-native" | ||
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 | # Use a modules directory which doesn't exist so we don't load random things | ||
57 | # which may then get deleted (or their dependencies) and potentially segfault | ||
58 | export GIO_MODULE_DIR=${STAGING_LIBDIR}/gio/modules-dummy | ||
59 | |||
60 | $qemu_binary "\$@" | ||
61 | if [ \$? -ne 0 ]; then | ||
62 | echo "If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the recipe should help." | ||
63 | echo "(typically like this: GIR_EXTRA_LIBS_PATH=\"$""{B}/something/.libs\" )" | ||
64 | exit 1 | ||
65 | fi | ||
66 | EOF | ||
67 | chmod +x ${B}/g-ir-scanner-qemuwrapper | ||
68 | |||
69 | # Write out a wrapper for g-ir-scanner itself, which will be used when building introspection files | ||
70 | # for glib-based packages. This wrapper calls the native version of the scanner, and tells it to use | ||
71 | # a qemu wrapper for running transient target binaries produced by the scanner, and an include directory | ||
72 | # from the target sysroot. | ||
73 | cat > ${B}/g-ir-scanner-wrapper << EOF | ||
74 | #!/bin/sh | ||
75 | # This prevents g-ir-scanner from writing cache data to $HOME | ||
76 | export GI_SCANNER_DISABLE_CACHE=1 | ||
77 | |||
78 | 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 "\$@" | ||
79 | EOF | ||
80 | chmod +x ${B}/g-ir-scanner-wrapper | ||
81 | |||
82 | # Write out a wrapper for g-ir-compiler, which runs the target version of it through qemu. | ||
83 | # g-ir-compiler writes out the raw content of a C struct to disk, and therefore is architecture dependent. | ||
84 | cat > ${B}/g-ir-compiler-wrapper << EOF | ||
85 | #!/bin/sh | ||
86 | ${STAGING_BINDIR}/g-ir-scanner-qemuwrapper ${STAGING_BINDIR}/g-ir-compiler "\$@" | ||
87 | EOF | ||
88 | chmod +x ${B}/g-ir-compiler-wrapper | ||
89 | |||
90 | # Write out a wrapper to use instead of ldd, which does not work when a binary is built | ||
91 | # for a different architecture | ||
92 | cat > ${B}/g-ir-scanner-lddwrapper << EOF | ||
93 | #!/bin/sh | ||
94 | prelink-rtld --root=$STAGING_DIR_HOST "\$@" | ||
95 | EOF | ||
96 | chmod +x ${B}/g-ir-scanner-lddwrapper | ||
97 | |||
98 | # Also tweak the target python scripts so that they don't refer to the | ||
99 | # native version of python binary (the solution is taken from glib-2.0 recipe) | ||
100 | sed -i -e '1s,#!.*,#!${USRBINPATH}/env python,' ${S}/tools/g-ir-tool-template.in | ||
101 | } | ||
102 | |||
103 | # Configure target build to use native tools of itself and to use a qemu wrapper | ||
104 | # and optionally to generate introspection data | ||
105 | EXTRA_OECONF_class-target += "--enable-host-gi \ | ||
106 | --enable-gi-cross-wrapper=${B}/g-ir-scanner-qemuwrapper \ | ||
107 | --enable-gi-ldd-wrapper=${B}/g-ir-scanner-lddwrapper \ | ||
108 | ${@bb.utils.contains('GI_DATA_ENABLED', 'True', '--enable-introspection-data', '--disable-introspection-data', d)} \ | ||
109 | " | ||
110 | |||
111 | PACKAGECONFIG ?= "" | ||
112 | PACKAGECONFIG[doctool] = "--enable-doctool,--disable-doctool,python-mako," | ||
113 | |||
114 | do_compile_prepend_class-target() { | ||
115 | # This prevents g-ir-scanner from writing cache data to $HOME | ||
116 | export GI_SCANNER_DISABLE_CACHE=1 | ||
117 | |||
118 | # Needed to run g-ir unit tests, which won't be able to find the built libraries otherwise | ||
119 | export GIR_EXTRA_LIBS_PATH=$B/.libs | ||
120 | } | ||
121 | |||
122 | # Our wrappers need to be available system-wide, because they will be used | ||
123 | # to build introspection files for all other gobject-based packages | ||
124 | do_install_append_class-target() { | ||
125 | install -d ${D}${bindir}/ | ||
126 | install ${B}/g-ir-scanner-qemuwrapper ${D}${bindir}/ | ||
127 | install ${B}/g-ir-scanner-wrapper ${D}${bindir}/ | ||
128 | install ${B}/g-ir-compiler-wrapper ${D}${bindir}/ | ||
129 | install ${B}/g-ir-scanner-lddwrapper ${D}${bindir}/ | ||
130 | } | ||
131 | |||
132 | # .typelib files are needed at runtime and so they go to the main package | ||
133 | FILES_${PN}_append = " ${libdir}/girepository-*/*.typelib" | ||
134 | |||
135 | # .gir files go to dev package, as they're needed for developing (but not for running) | ||
136 | # things that depends on introspection. | ||
137 | FILES_${PN}-dev_append = " ${datadir}/gir-*/*.gir" | ||
138 | |||
139 | # These are used by gobject-based packages | ||
140 | # to generate transient introspection binaries | ||
141 | FILES_${PN}-dev_append = " ${datadir}/gobject-introspection-1.0/gdump.c \ | ||
142 | ${datadir}/gobject-introspection-1.0/Makefile.introspection" | ||
143 | |||
144 | # These are used by dependent packages (e.g. pygobject) to build their | ||
145 | # testsuites. | ||
146 | FILES_${PN}-dev_append = " ${datadir}/gobject-introspection-1.0/tests/*.c \ | ||
147 | ${datadir}/gobject-introspection-1.0/tests/*.h" | ||
148 | |||
149 | FILES_${PN}-dbg += "${libdir}/gobject-introspection/giscanner/.debug/" | ||
150 | FILES_${PN}-staticdev += "${libdir}/gobject-introspection/giscanner/*.a" | ||
151 | |||
152 | # we need target versions of introspection tools in sysroot so that they can be run via qemu | ||
153 | # when building introspection files in other packages | ||
154 | SYSROOT_DIRS_append_class-target = " ${bindir}" | ||
155 | |||
156 | SYSROOT_PREPROCESS_FUNCS_append_class-target = " gi_binaries_sysroot_preprocess" | ||
157 | gi_binaries_sysroot_preprocess() { | ||
158 | # Tweak the binary names in the introspection pkgconfig file, so that it | ||
159 | # picks up our wrappers which do the cross-compile and qemu magic. | ||
160 | sed -i \ | ||
161 | -e "s|g_ir_scanner=.*|g_ir_scanner=${bindir}/g-ir-scanner-wrapper|" \ | ||
162 | -e "s|g_ir_compiler=.*|g_ir_compiler=${bindir}/g-ir-compiler-wrapper|" \ | ||
163 | ${SYSROOT_DESTDIR}${libdir}/pkgconfig/gobject-introspection-1.0.pc | ||
164 | } | ||