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