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