summaryrefslogtreecommitdiffstats
path: root/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.56.1.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-gnome/gobject-introspection/gobject-introspection_1.56.1.bb')
-rw-r--r--meta/recipes-gnome/gobject-introspection/gobject-introspection_1.56.1.bb191
1 files changed, 191 insertions, 0 deletions
diff --git a/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.56.1.bb b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.56.1.bb
new file mode 100644
index 0000000000..8d05566949
--- /dev/null
+++ b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.56.1.bb
@@ -0,0 +1,191 @@
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=6317a809f70ed9848fa5673121908586 \
7 file://tools/compiler.c;md5=fc5007fc20022720e6c0b0cdde41fabd;endline=20 \
8 file://giscanner/sourcescanner.c;md5=194d6e0c1d00662f32d030ce44de8d39;endline=22 \
9 file://girepository/giregisteredtypeinfo.c;md5=661847611ae6979465415f31a759ba27;endline=21 \
10 "
11
12SRC_URI = "${GNOME_MIRROR}/${BPN}/${@oe.utils.trim_version("${PV}", 2)}/${BPN}-${PV}.tar.xz \
13 file://0001-Revert-an-incomplete-upstream-attempt-at-cross-compi.patch \
14 file://0002-configure.ac-add-host-gi-gi-cross-wrapper-gi-ldd-wra.patch \
15 file://0003-giscanner-add-use-binary-wrapper-option.patch \
16 file://0004-giscanner-add-a-use-ldd-wrapper-option.patch \
17 file://0005-Prefix-pkg-config-paths-with-PKG_CONFIG_SYSROOT_DIR-.patch \
18 file://0001-giscanner-add-a-lib-dirs-envvar-option.patch \
19 "
20SRC_URI[md5sum] = "62e5f5685b8d9752fdeaf17c057d53d1"
21SRC_URI[sha256sum] = "5b2875ccff99ff7baab63a34b67f8c920def240e178ff50add809e267d9ea24b"
22
23inherit autotools pkgconfig gtk-doc python3native qemu gobject-introspection-data upstream-version-is-even
24BBCLASSEXTEND = "native"
25
26# needed for writing out the qemu wrapper script
27export STAGING_DIR_HOST
28export B
29
30DEPENDS_append = " libffi zlib glib-2.0 python3 flex-native bison-native"
31
32# target build needs qemu to run temporary introspection binaries created
33# on the fly by g-ir-scanner and a native version of itself to run
34# native versions of its own tools during build.
35# Also prelink-rtld is used to find out library dependencies of introspection binaries
36# (standard ldd doesn't work when cross-compiling).
37DEPENDS_class-target_append = " gobject-introspection-native qemu-native prelink-native"
38
39SSTATE_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}"
40
41do_configure_prepend_class-native() {
42 # Tweak the native python scripts so that they don't refer to the
43 # full path of native python binary (the solution is taken from glib-2.0 recipe)
44 # This removes the risk of exceeding Linux kernel's shebang line limit (128 bytes)
45 sed -i -e '1s,#!.*,#!${USRBINPATH}/env python3,' ${S}/tools/g-ir-tool-template.in
46}
47
48do_configure_prepend_class-target() {
49 # Write out a qemu wrapper that will be given to gi-scanner so that it
50 # can run target helper binaries through that.
51 qemu_binary="${@qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['\$GIR_EXTRA_LIBS_PATH','.libs','$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}"
52 cat > ${B}/g-ir-scanner-qemuwrapper << EOF
53#!/bin/sh
54# Use a modules directory which doesn't exist so we don't load random things
55# which may then get deleted (or their dependencies) and potentially segfault
56export GIO_MODULE_DIR=${STAGING_LIBDIR}/gio/modules-dummy
57
58$qemu_binary "\$@"
59if [ \$? -ne 0 ]; then
60 echo "If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the recipe should help."
61 echo "(typically like this: GIR_EXTRA_LIBS_PATH=\"$""{B}/something/.libs\" )"
62 exit 1
63fi
64EOF
65 chmod +x ${B}/g-ir-scanner-qemuwrapper
66
67 # Write out a wrapper for g-ir-scanner itself, which will be used when building introspection files
68 # for glib-based packages. This wrapper calls the native version of the scanner, and tells it to use
69 # a qemu wrapper for running transient target binaries produced by the scanner, and an include directory
70 # from the target sysroot.
71 cat > ${B}/g-ir-scanner-wrapper << EOF
72#!/bin/sh
73# This prevents g-ir-scanner from writing cache data to $HOME
74export GI_SCANNER_DISABLE_CACHE=1
75
76g-ir-scanner --lib-dirs-envvar=GIR_EXTRA_LIBS_PATH --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 "\$@"
77EOF
78 chmod +x ${B}/g-ir-scanner-wrapper
79
80 # Write out a wrapper for g-ir-compiler, which runs the target version of it through qemu.
81 # g-ir-compiler writes out the raw content of a C struct to disk, and therefore is architecture dependent.
82 cat > ${B}/g-ir-compiler-wrapper << EOF
83#!/bin/sh
84${STAGING_BINDIR}/g-ir-scanner-qemuwrapper ${STAGING_BINDIR}/g-ir-compiler "\$@"
85EOF
86 chmod +x ${B}/g-ir-compiler-wrapper
87
88 # Write out a wrapper to use instead of ldd, which does not work when a binary is built
89 # for a different architecture
90 cat > ${B}/g-ir-scanner-lddwrapper << EOF
91#!/bin/sh
92prelink-rtld --root=$STAGING_DIR_HOST "\$@"
93EOF
94 chmod +x ${B}/g-ir-scanner-lddwrapper
95
96 # Also tweak the target python scripts so that they don't refer to the
97 # native version of python binary (the solution is taken from glib-2.0 recipe)
98 sed -i -e '1s,#!.*,#!${USRBINPATH}/env python3,' ${S}/tools/g-ir-tool-template.in
99}
100
101# Configure target build to use native tools of itself and to use a qemu wrapper
102# and optionally to generate introspection data
103EXTRA_OECONF_class-target += "--enable-host-gi \
104 --disable-static \
105 --enable-gi-cross-wrapper=${B}/g-ir-scanner-qemuwrapper \
106 --enable-gi-ldd-wrapper=${B}/g-ir-scanner-lddwrapper \
107 ${@bb.utils.contains('GI_DATA_ENABLED', 'True', '--enable-introspection-data', '--disable-introspection-data', d)} \
108 "
109
110PACKAGECONFIG ?= ""
111PACKAGECONFIG[doctool] = "--enable-doctool,--disable-doctool,python3-mako,"
112
113do_compile_prepend() {
114 # This prevents g-ir-scanner from writing cache data to $HOME
115 export GI_SCANNER_DISABLE_CACHE=1
116
117 # Needed to run g-ir unit tests, which won't be able to find the built libraries otherwise
118 export GIR_EXTRA_LIBS_PATH=$B/.libs
119}
120
121# Our wrappers need to be available system-wide, because they will be used
122# to build introspection files for all other gobject-based packages
123do_install_append_class-target() {
124 install -d ${D}${bindir}/
125 install ${B}/g-ir-scanner-qemuwrapper ${D}${bindir}/
126 install ${B}/g-ir-scanner-wrapper ${D}${bindir}/
127 install ${B}/g-ir-compiler-wrapper ${D}${bindir}/
128 install ${B}/g-ir-scanner-lddwrapper ${D}${bindir}/
129}
130
131# .typelib files are needed at runtime and so they go to the main package
132FILES_${PN}_append = " ${libdir}/girepository-*/*.typelib"
133
134# .gir files go to dev package, as they're needed for developing (but not for running)
135# things that depends on introspection.
136FILES_${PN}-dev_append = " ${datadir}/gir-*/*.gir"
137FILES_${PN}-dev_append = " ${datadir}/gir-*/*.rnc"
138
139# These are used by gobject-based packages
140# to generate transient introspection binaries
141FILES_${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.
146FILES_${PN}-dev_append = " ${datadir}/gobject-introspection-1.0/tests/*.c \
147 ${datadir}/gobject-introspection-1.0/tests/*.h"
148
149FILES_${PN}-dbg += "${libdir}/gobject-introspection/giscanner/.debug/"
150FILES_${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
154SYSROOT_DIRS_append_class-target = " ${bindir}"
155
156SYSROOT_PREPROCESS_FUNCS_append_class-target = " gi_binaries_sysroot_preprocess"
157gi_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}
165
166# Need to ensure ld.so.conf exists so prelink-native works
167# both before we build and if we install from sstate
168do_configure[prefuncs] += "gobject_introspection_preconfigure"
169python gobject_introspection_preconfigure () {
170 oe.utils.write_ld_so_conf(d)
171}
172
173SYSROOT_PREPROCESS_FUNCS_append = " gi_ldsoconf_sysroot_preprocess"
174gi_ldsoconf_sysroot_preprocess () {
175 mkdir -p ${SYSROOT_DESTDIR}${bindir}
176 dest=${SYSROOT_DESTDIR}${bindir}/postinst-ldsoconf-${PN}
177 echo "#!/bin/sh" > $dest
178 echo "mkdir -p ${STAGING_DIR_TARGET}${sysconfdir}" >> $dest
179 echo "echo ${base_libdir} >> ${STAGING_DIR_TARGET}${sysconfdir}/ld.so.conf" >> $dest
180 echo "echo ${libdir} >> ${STAGING_DIR_TARGET}${sysconfdir}/ld.so.conf" >> $dest
181 chmod 755 $dest
182}
183
184# Remove wrapper files from the package, only used for cross-compiling
185PACKAGE_PREPROCESS_FUNCS += "gi_package_preprocess"
186gi_package_preprocess() {
187 rm -f ${PKGD}${bindir}/g-ir-scanner-qemuwrapper
188 rm -f ${PKGD}${bindir}/g-ir-scanner-wrapper
189 rm -f ${PKGD}${bindir}/g-ir-compiler-wrapper
190 rm -f ${PKGD}${bindir}/g-ir-scanner-lddwrapper
191}