summaryrefslogtreecommitdiffstats
path: root/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.52.1.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-gnome/gobject-introspection/gobject-introspection_1.52.1.bb')
-rw-r--r--meta/recipes-gnome/gobject-introspection/gobject-introspection_1.52.1.bb179
1 files changed, 179 insertions, 0 deletions
diff --git a/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.52.1.bb b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.52.1.bb
new file mode 100644
index 0000000000..605f02eb0e
--- /dev/null
+++ b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.52.1.bb
@@ -0,0 +1,179 @@
1SUMMARY = "Middleware layer between GObject-using C libraries and language bindings"
2HOMEPAGE = "https://wiki.gnome.org/action/show/Projects/GObjectIntrospection"
3BUGTRACKER = "https://bugzilla.gnome.org/"
4SECTION = "libs"
5LICENSE = "LGPLv2+ & GPLv2+"
6LIC_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
11SRC_URI = "${GNOME_MIRROR}/${BPN}/1.52/${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 "
18SRC_URI[md5sum] = "34157073991f9eeb0ed953351b65eb61"
19SRC_URI[sha256sum] = "2ed0c38d52fe1aa6fc4def0c868fe481cb87b532fc694756b26d6cfab29faff4"
20
21inherit autotools pkgconfig gtk-doc python3native qemu gobject-introspection-data upstream-version-is-even
22BBCLASSEXTEND = "native"
23
24# needed for writing out the qemu wrapper script
25export STAGING_DIR_HOST
26export B
27
28DEPENDS_append = " libffi zlib glib-2.0 python3 flex-native bison-native"
29
30# target build needs qemu to run temporary introspection binaries created
31# on the fly by g-ir-scanner and a native version of itself to run
32# native versions of its own tools during build.
33# Also prelink-rtld is used to find out library dependencies of introspection binaries
34# (standard ldd doesn't work when cross-compiling).
35DEPENDS_class-target_append = " gobject-introspection-native qemu-native prelink-native"
36
37SSTATE_SCAN_FILES += "g-ir-scanner-qemuwrapper g-ir-scanner-wrapper g-ir-compiler-wrapper g-ir-scanner-lddwrapper Gio-2.0.gir postinst-ldsoconf-${PN}"
38
39do_configure_prepend_class-native() {
40 # Tweak the native python scripts so that they don't refer to the
41 # full path of native python binary (the solution is taken from glib-2.0 recipe)
42 # This removes the risk of exceeding Linux kernel's shebang line limit (128 bytes)
43 sed -i -e '1s,#!.*,#!${USRBINPATH}/env python3,' ${S}/tools/g-ir-tool-template.in
44}
45
46do_configure_prepend_class-target() {
47 # Write out a qemu wrapper that will be given to gi-scanner so that it
48 # can run target helper binaries through that.
49 qemu_binary="${@qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['\$GIR_EXTRA_LIBS_PATH','.libs','$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}"
50 cat > ${B}/g-ir-scanner-qemuwrapper << EOF
51#!/bin/sh
52# Use a modules directory which doesn't exist so we don't load random things
53# which may then get deleted (or their dependencies) and potentially segfault
54export GIO_MODULE_DIR=${STAGING_LIBDIR}/gio/modules-dummy
55
56$qemu_binary "\$@"
57if [ \$? -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
61fi
62EOF
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
72export GI_SCANNER_DISABLE_CACHE=1
73
74g-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 "\$@"
75EOF
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 "\$@"
83EOF
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
90prelink-rtld --root=$STAGING_DIR_HOST "\$@"
91EOF
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 python3,' ${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
101EXTRA_OECONF_class-target += "--enable-host-gi \
102 --disable-static \
103 --enable-gi-cross-wrapper=${B}/g-ir-scanner-qemuwrapper \
104 --enable-gi-ldd-wrapper=${B}/g-ir-scanner-lddwrapper \
105 ${@bb.utils.contains('GI_DATA_ENABLED', 'True', '--enable-introspection-data', '--disable-introspection-data', d)} \
106 "
107
108PACKAGECONFIG ?= ""
109PACKAGECONFIG[doctool] = "--enable-doctool,--disable-doctool,python3-mako,"
110
111do_compile_prepend() {
112 # This prevents g-ir-scanner from writing cache data to $HOME
113 export GI_SCANNER_DISABLE_CACHE=1
114
115 # Needed to run g-ir unit tests, which won't be able to find the built libraries otherwise
116 export GIR_EXTRA_LIBS_PATH=$B/.libs
117}
118
119# Our wrappers need to be available system-wide, because they will be used
120# to build introspection files for all other gobject-based packages
121do_install_append_class-target() {
122 install -d ${D}${bindir}/
123 install ${B}/g-ir-scanner-qemuwrapper ${D}${bindir}/
124 install ${B}/g-ir-scanner-wrapper ${D}${bindir}/
125 install ${B}/g-ir-compiler-wrapper ${D}${bindir}/
126 install ${B}/g-ir-scanner-lddwrapper ${D}${bindir}/
127}
128
129# .typelib files are needed at runtime and so they go to the main package
130FILES_${PN}_append = " ${libdir}/girepository-*/*.typelib"
131
132# .gir files go to dev package, as they're needed for developing (but not for running)
133# things that depends on introspection.
134FILES_${PN}-dev_append = " ${datadir}/gir-*/*.gir"
135
136# These are used by gobject-based packages
137# to generate transient introspection binaries
138FILES_${PN}-dev_append = " ${datadir}/gobject-introspection-1.0/gdump.c \
139 ${datadir}/gobject-introspection-1.0/Makefile.introspection"
140
141# These are used by dependent packages (e.g. pygobject) to build their
142# testsuites.
143FILES_${PN}-dev_append = " ${datadir}/gobject-introspection-1.0/tests/*.c \
144 ${datadir}/gobject-introspection-1.0/tests/*.h"
145
146FILES_${PN}-dbg += "${libdir}/gobject-introspection/giscanner/.debug/"
147FILES_${PN}-staticdev += "${libdir}/gobject-introspection/giscanner/*.a"
148
149# we need target versions of introspection tools in sysroot so that they can be run via qemu
150# when building introspection files in other packages
151SYSROOT_DIRS_append_class-target = " ${bindir}"
152
153SYSROOT_PREPROCESS_FUNCS_append_class-target = " gi_binaries_sysroot_preprocess"
154gi_binaries_sysroot_preprocess() {
155 # Tweak the binary names in the introspection pkgconfig file, so that it
156 # picks up our wrappers which do the cross-compile and qemu magic.
157 sed -i \
158 -e "s|g_ir_scanner=.*|g_ir_scanner=${bindir}/g-ir-scanner-wrapper|" \
159 -e "s|g_ir_compiler=.*|g_ir_compiler=${bindir}/g-ir-compiler-wrapper|" \
160 ${SYSROOT_DESTDIR}${libdir}/pkgconfig/gobject-introspection-1.0.pc
161}
162
163# Need to ensure ld.so.conf exists so prelink-native works
164# both before we build and if we install from sstate
165do_configure[prefuncs] += "gobject_introspection_preconfigure"
166python gobject_introspection_preconfigure () {
167 oe.utils.write_ld_so_conf(d)
168}
169
170SYSROOT_PREPROCESS_FUNCS_append = " gi_ldsoconf_sysroot_preprocess"
171gi_ldsoconf_sysroot_preprocess () {
172 mkdir -p ${SYSROOT_DESTDIR}${bindir}
173 dest=${SYSROOT_DESTDIR}${bindir}/postinst-ldsoconf-${PN}
174 echo "#!/bin/sh" > $dest
175 echo "mkdir -p ${STAGING_DIR_TARGET}${sysconfdir}" >> $dest
176 echo "echo ${base_libdir} >> ${STAGING_DIR_TARGET}${sysconfdir}/ld.so.conf" >> $dest
177 echo "echo ${libdir} >> ${STAGING_DIR_TARGET}${sysconfdir}/ld.so.conf" >> $dest
178 chmod 755 $dest
179}