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