summaryrefslogtreecommitdiffstats
path: root/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.46.0.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-gnome/gobject-introspection/gobject-introspection_1.46.0.bb')
-rw-r--r--meta/recipes-gnome/gobject-introspection/gobject-introspection_1.46.0.bb159
1 files changed, 159 insertions, 0 deletions
diff --git a/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.46.0.bb b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.46.0.bb
new file mode 100644
index 0000000000..d51e607c09
--- /dev/null
+++ b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.46.0.bb
@@ -0,0 +1,159 @@
1HOMEPAGE = "http://gnome.org"
2BUGTRACKER = "https://bugzilla.gnome.org/"
3SECTION = "libs"
4LICENSE = "LGPLv2+ & GPLv2+"
5LIC_FILES_CHKSUM = "file://COPYING;md5=90d577535a3898e1ae5dbf0ae3509a8c \
6 file://tools/compiler.c;endline=20;md5=fc5007fc20022720e6c0b0cdde41fabd \
7 file://giscanner/sourcescanner.c;endline=22;md5=194d6e0c1d00662f32d030ce44de8d39 \
8 file://girepository/giregisteredtypeinfo.c;endline=21;md5=661847611ae6979465415f31a759ba27"
9
10SRC_URI = "${GNOME_MIRROR}/${BPN}/1.46/${BPN}-${PV}.tar.xz \
11 file://0001-Prefix-pkg-config-paths-with-PKG_CONFIG_SYSROOT_DIR-.patch \
12 file://0001-giscanner-add-use-binary-wrapper-option.patch \
13 file://0001-giscanner-add-a-use-ldd-wrapper-option.patch \
14 file://0001-configure.ac-add-host-gi-gi-cross-wrapper-and-gi-ldd.patch \
15 "
16SRC_URI[md5sum] = "adb40a31c7c80b65b0f4c8fd71b493dc"
17SRC_URI[sha256sum] = "6658bd3c2b8813eb3e2511ee153238d09ace9d309e4574af27443d87423e4233"
18
19inherit autotools pkgconfig gtk-doc pythonnative qemu
20BBCLASSEXTEND = "native"
21
22# necessary to let the call for python-config from configure.ac succeed
23export BUILD_SYS
24export HOST_SYS
25export STAGING_INCDIR
26export STAGING_LIBDIR
27
28# needed for writing out the qemu wrapper script
29export STAGING_DIR_HOST
30export B
31
32DEPENDS_append = " libffi zlib glib-2.0 python"
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).
39DEPENDS_class-target_append = " gobject-introspection-native qemu-native prelink-native"
40
41SSTATE_SCAN_FILES += "g-ir-scanner-qemuwrapper g-ir-scanner-wrapper g-ir-compiler-wrapper g-ir-scanner-lddwrapper Gio-2.0.gir"
42
43do_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
50do_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$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 python,' ${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 --enable-gi-cross-wrapper=${B}/g-ir-scanner-qemuwrapper \
103 --enable-gi-ldd-wrapper=${B}/g-ir-scanner-lddwrapper \
104 ${@bb.utils.contains('COMBINED_FEATURES', 'gobject-introspection-data', '--enable-introspection-data', '--disable-introspection-data', d)} \
105 "
106
107
108do_compile_prepend_class-target() {
109 # This prevents g-ir-scanner from writing cache data to $HOME
110 export GI_SCANNER_DISABLE_CACHE=1
111
112 # Needed to run g-ir unit tests, which won't be able to find the built libraries otherwise
113 export GIR_EXTRA_LIBS_PATH=$B/.libs
114}
115
116# Our wrappers need to be available system-wide, because they will be used
117# to build introspection files for all other gobject-based packages
118do_install_append_class-target() {
119 install -d ${D}${bindir}/
120 install ${B}/g-ir-scanner-qemuwrapper ${D}${bindir}/
121 install ${B}/g-ir-scanner-wrapper ${D}${bindir}/
122 install ${B}/g-ir-compiler-wrapper ${D}${bindir}/
123 install ${B}/g-ir-scanner-lddwrapper ${D}${bindir}/
124}
125
126# .typelib files are needed at runtime and so they go to the main package
127FILES_${PN}_append = " ${libdir}/girepository-*/*.typelib"
128
129# .gir files go to dev package, as they're needed for developing (but not for running)
130# things that depends on introspection.
131FILES_${PN}-dev_append = " ${datadir}/gir-*/*.gir"
132
133# These are used by gobject-based packages
134# to generate transient introspection binaries
135FILES_${PN}-dev_append = " ${datadir}/gobject-introspection-1.0/gdump.c \
136 ${datadir}/gobject-introspection-1.0/Makefile.introspection"
137
138# These are used by dependent packages (e.g. pygobject) to build their
139# testsuites.
140FILES_${PN}-dev_append = " ${datadir}/gobject-introspection-1.0/tests/*.c \
141 ${datadir}/gobject-introspection-1.0/tests/*.h"
142
143FILES_${PN}-dbg += "${libdir}/gobject-introspection/giscanner/.debug/"
144FILES_${PN}-staticdev += "${libdir}/gobject-introspection/giscanner/*.a"
145
146# we need target versions of introspection tools in sysroot so that they can be run via qemu
147# when building introspection files in other packages
148SYSROOT_PREPROCESS_FUNCS_append_class-target += "gi_binaries_sysroot_preprocess"
149
150gi_binaries_sysroot_preprocess() {
151 sysroot_stage_dir ${D}${bindir} ${SYSROOT_DESTDIR}${bindir}
152
153 # Also, tweak the binary names in introspection pkgconfig file, so that it picks up our
154 # wrappers which do the cross-compile and qemu magic.
155 sed -i \
156 -e "s|g_ir_scanner=.*|g_ir_scanner=${bindir}/g-ir-scanner-wrapper|" \
157 -e "s|g_ir_compiler=.*|g_ir_compiler=${bindir}/g-ir-compiler-wrapper|" \
158 ${SYSROOT_DESTDIR}${libdir}/pkgconfig/gobject-introspection-1.0.pc
159}