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