summaryrefslogtreecommitdiffstats
path: root/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.78.1.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-gnome/gobject-introspection/gobject-introspection_1.78.1.bb')
-rw-r--r--meta/recipes-gnome/gobject-introspection/gobject-introspection_1.78.1.bb193
1 files changed, 193 insertions, 0 deletions
diff --git a/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.78.1.bb b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.78.1.bb
new file mode 100644
index 0000000000..2c6fb7aaa3
--- /dev/null
+++ b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.78.1.bb
@@ -0,0 +1,193 @@
1SUMMARY = "Middleware layer between GObject-using C libraries and language bindings"
2DESCRIPTION = "GObject Introspection is a project for providing machine \
3readable introspection data of the API of C libraries. This introspection \
4data can be used in several different use cases, for example automatic code \
5generation for bindings, API verification and documentation generation."
6HOMEPAGE = "https://wiki.gnome.org/action/show/Projects/GObjectIntrospection"
7BUGTRACKER = "https://gitlab.gnome.org/GNOME/gobject-introspection/issues"
8SECTION = "libs"
9LICENSE = "LGPL-2.0-or-later & GPL-2.0-or-later & MIT"
10LIC_FILES_CHKSUM = "file://COPYING;md5=c434e8128a68bedd59b80b2ac1eb1c4a \
11 file://tools/compiler.c;endline=20;md5=fc5007fc20022720e6c0b0cdde41fabd \
12 file://giscanner/sourcescanner.c;endline=22;md5=194d6e0c1d00662f32d030ce44de8d39 \
13 file://girepository/giregisteredtypeinfo.c;endline=21;md5=661847611ae6979465415f31a759ba27 \
14 "
15
16SRC_URI = "${GNOME_MIRROR}/${BPN}/${@oe.utils.trim_version("${PV}", 2)}/${BPN}-${PV}.tar.xz \
17 "
18
19SRC_URI[sha256sum] = "bd7babd99af7258e76819e45ba4a6bc399608fe762d83fde3cac033c50841bb4"
20
21SRC_URI:append:class-native = " file://0001-Relocate-the-repository-directory-for-native-builds.patch"
22
23inherit meson pkgconfig gtk-doc python3targetconfig qemu gobject-introspection-data upstream-version-is-even multilib_script
24
25GTKDOC_MESON_OPTION = "gtk_doc"
26
27MULTILIB_SCRIPTS = "${PN}:${bindir}/g-ir-annotation-tool ${PN}:${bindir}/g-ir-scanner"
28
29DEPENDS += " libffi zlib glib-2.0 python3 flex-native bison-native"
30
31# target build needs qemu to run temporary introspection binaries created
32# on the fly by g-ir-scanner and a native version of itself to run
33# native versions of its own tools during build.
34DEPENDS:append:class-target = " gobject-introspection-native qemu-native"
35
36# needed for writing out the qemu wrapper script
37export STAGING_DIR_HOST
38export B
39
40PACKAGECONFIG ?= ""
41PACKAGECONFIG[doctool] = "-Ddoctool=enabled,-Ddoctool=disabled,python3-mako,"
42
43# Configure target build to use native tools of itself and to use a qemu wrapper
44# and optionally to generate introspection data
45EXTRA_OEMESON:class-target = " \
46 -Dgi_cross_use_prebuilt_gi=true \
47 -Dgi_cross_binary_wrapper=${B}/g-ir-scanner-qemuwrapper \
48 -Dgi_cross_ldd_wrapper=${B}/g-ir-scanner-lddwrapper \
49 -Dgi_cross_pkgconfig_sysroot_path=${PKG_CONFIG_SYSROOT_DIR} \
50 ${@bb.utils.contains('GI_DATA_ENABLED', 'True', '-Dbuild_introspection_data=true', '-Dbuild_introspection_data=false', d)} \
51 ${@'-Dgir_dir_prefix=${libdir}' if d.getVar('MULTILIBS') else ''} \
52"
53
54do_configure:prepend:class-native() {
55 # Tweak the native python scripts so that they don't refer to the
56 # full path of native python binary (the solution is taken from glib-2.0 recipe)
57 # This removes the risk of exceeding Linux kernel's shebang line limit (128 bytes)
58 sed -i -e '1s,#!.*,#!${USRBINPATH}/env python3,' ${S}/tools/g-ir-tool-template.in
59}
60
61do_configure:prepend:class-target() {
62 # Write out a qemu wrapper that will be given to gi-scanner so that it
63 # can run target helper binaries through that.
64 qemu_binary="${@qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['\\$GIR_EXTRA_LIBS_PATH','.libs','$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}"
65 cat > ${B}/g-ir-scanner-qemuwrapper << EOF
66#!/bin/sh
67# Use a modules directory which doesn't exist so we don't load random things
68# which may then get deleted (or their dependencies) and potentially segfault
69export GIO_MODULE_DIR=${STAGING_LIBDIR}/gio/modules-dummy
70
71$qemu_binary "\$@"
72if [ \$? -ne 0 ]; then
73 echo "If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the recipe should help."
74 echo "(typically like this: GIR_EXTRA_LIBS_PATH=\"$""{B}/something/.libs\" )"
75 exit 1
76fi
77EOF
78 chmod +x ${B}/g-ir-scanner-qemuwrapper
79
80 # Write out a wrapper for g-ir-scanner itself, which will be used when building introspection files
81 # for glib-based packages. This wrapper calls the native version of the scanner, and tells it to use
82 # a qemu wrapper for running transient target binaries produced by the scanner, and an include directory
83 # from the target sysroot.
84 cat > ${B}/g-ir-scanner-wrapper << EOF
85#!/bin/sh
86# This prevents g-ir-scanner from writing cache data to user's HOME dir
87export GI_SCANNER_DISABLE_CACHE=1
88
89g-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 --add-include-path=${STAGING_LIBDIR}/gir-1.0 "\$@"
90EOF
91 chmod +x ${B}/g-ir-scanner-wrapper
92
93 # Write out a wrapper for g-ir-compiler, which runs the target version of it through qemu.
94 # g-ir-compiler writes out the raw content of a C struct to disk, and therefore is architecture dependent.
95 cat > ${B}/g-ir-compiler-wrapper << EOF
96#!/bin/sh
97${STAGING_BINDIR}/g-ir-scanner-qemuwrapper ${STAGING_BINDIR}/g-ir-compiler "\$@"
98EOF
99 chmod +x ${B}/g-ir-compiler-wrapper
100
101 # Write out a wrapper to use instead of ldd, which does not work when a binary is built
102 # for a different architecture
103 cat > ${B}/g-ir-scanner-lddwrapper << EOF
104#!/bin/sh
105\$OBJDUMP -p "\$@"
106EOF
107 chmod +x ${B}/g-ir-scanner-lddwrapper
108
109 # Also tweak the target python scripts so that they don't refer to the
110 # native version of python binary (the solution is taken from glib-2.0 recipe)
111 sed -i -e '1s,#!.*,#!${USRBINPATH}/env python3,' ${S}/tools/g-ir-tool-template.in
112}
113
114do_compile:prepend() {
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
119do_install:prepend() {
120 # This prevents g-ir-scanner from writing cache data to $HOME
121 export GI_SCANNER_DISABLE_CACHE=1
122}
123
124# Our wrappers need to be available system-wide, because they will be used
125# to build introspection files for all other gobject-based packages
126do_install:append:class-target() {
127 install -d ${D}${bindir}/
128 install ${B}/g-ir-scanner-qemuwrapper ${D}${bindir}/
129 install ${B}/g-ir-scanner-wrapper ${D}${bindir}/
130 install ${B}/g-ir-compiler-wrapper ${D}${bindir}/
131 install ${B}/g-ir-scanner-lddwrapper ${D}${bindir}/
132}
133
134# we need target versions of introspection tools in sysroot so that they can be run via qemu
135# when building introspection files in other packages
136SYSROOT_DIRS:append:class-target = " ${bindir}"
137
138SYSROOT_PREPROCESS_FUNCS:append:class-target = " gi_binaries_sysroot_preprocess"
139gi_binaries_sysroot_preprocess() {
140 # Tweak the binary names in the introspection pkgconfig file, so that it
141 # picks up our wrappers which do the cross-compile and qemu magic.
142 sed -i \
143 -e "s|g_ir_scanner=.*|g_ir_scanner=${bindir}/g-ir-scanner-wrapper|" \
144 -e "s|g_ir_compiler=.*|g_ir_compiler=${bindir}/g-ir-compiler-wrapper|" \
145 ${SYSROOT_DESTDIR}${libdir}/pkgconfig/gobject-introspection-1.0.pc
146}
147
148SYSROOT_PREPROCESS_FUNCS:append = " gi_ldsoconf_sysroot_preprocess"
149gi_ldsoconf_sysroot_preprocess () {
150 mkdir -p ${SYSROOT_DESTDIR}${bindir}
151 dest=${SYSROOT_DESTDIR}${bindir}/postinst-ldsoconf-${PN}
152 echo "#!/bin/sh" > $dest
153 echo "mkdir -p ${STAGING_DIR_TARGET}${sysconfdir}" >> $dest
154 echo "echo ${base_libdir} >> ${STAGING_DIR_TARGET}${sysconfdir}/ld.so.conf" >> $dest
155 echo "echo ${libdir} >> ${STAGING_DIR_TARGET}${sysconfdir}/ld.so.conf" >> $dest
156 chmod 755 $dest
157}
158
159# Remove wrapper files from the package, only used for cross-compiling
160PACKAGE_PREPROCESS_FUNCS += "gi_package_preprocess"
161gi_package_preprocess() {
162 rm -f ${PKGD}${bindir}/g-ir-scanner-qemuwrapper
163 rm -f ${PKGD}${bindir}/g-ir-scanner-wrapper
164 rm -f ${PKGD}${bindir}/g-ir-compiler-wrapper
165 rm -f ${PKGD}${bindir}/g-ir-scanner-lddwrapper
166}
167
168SSTATE_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}"
169
170# .typelib files are needed at runtime and so they go to the main package
171FILES:${PN}:append = " ${libdir}/girepository-*/*.typelib"
172
173# .gir files go to dev package, as they're needed for developing (but not for running)
174# things that depends on introspection.
175FILES:${PN}-dev:append = " ${datadir}/gir-*/*.gir ${libdir}/gir-*/*.gir"
176FILES:${PN}-dev:append = " ${datadir}/gir-*/*.rnc"
177
178# These are used by gobject-based packages
179# to generate transient introspection binaries
180FILES:${PN}-dev:append = " ${datadir}/gobject-introspection-1.0/gdump.c \
181 ${datadir}/gobject-introspection-1.0/Makefile.introspection"
182
183# These are used by dependent packages (e.g. pygobject) to build their
184# testsuites.
185FILES:${PN}-dev:append = " ${datadir}/gobject-introspection-1.0/tests/*.c \
186 ${datadir}/gobject-introspection-1.0/tests/*.h"
187
188FILES:${PN}-dbg += "${libdir}/gobject-introspection/giscanner/.debug/"
189FILES:${PN}-staticdev += "${libdir}/gobject-introspection/giscanner/*.a"
190
191RDEPENDS:${PN} = "python3-pickle python3-xml"
192
193BBCLASSEXTEND = "native"