From 235455d9a7f5055ac731666c0433dd459004c3bb Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Wed, 9 Mar 2016 17:01:53 +0200 Subject: vala: enable the use of vapigen by packages with vala support Now that gobject-introspection is supported, generation of .vapi files for develeloping Vala code against gobject-based libraries should be supported as well. (From OE-Core rev: 1e2739169fe0db8c6727f3c17dc79e3846033d62) Signed-off-by: Alexander Kanavin Signed-off-by: Richard Purdie --- meta/recipes-devtools/vala/vala.inc | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'meta/recipes-devtools/vala/vala.inc') diff --git a/meta/recipes-devtools/vala/vala.inc b/meta/recipes-devtools/vala/vala.inc index 43f9bb3c3c..2a8875f011 100644 --- a/meta/recipes-devtools/vala/vala.inc +++ b/meta/recipes-devtools/vala/vala.inc @@ -3,6 +3,9 @@ DESCRIPTION = "Vala is a C#-like language dedicated to ease GObject programming. Vala compiles to plain C and has no runtime environment nor penalities whatsoever." SECTION = "devel" DEPENDS = "bison-native flex-native libxslt-native glib-2.0" + +# vala-native contains a native version of vapigen, which we use instead of the target one +DEPENDS_append_class-target = " vala-native" BBCLASSEXTEND = "native" HOMEPAGE = "http://vala-project.org" LICENSE = "LGPLv2.1" @@ -15,3 +18,34 @@ inherit autotools pkgconfig upstream-version-is-even FILES_${PN} += "${datadir}/${BPN}-${SHRT_VER}/vapi ${libdir}/${BPN}-${SHRT_VER}/" FILES_${PN}-doc += "${datadir}/devhelp" + +do_configure_prepend_class-target() { + # Write out a vapigen wrapper that will be provided by pkg-config file installed in target sysroot + # The wrapper will call a native vapigen + cat > ${B}/vapigen-wrapper << EOF +#!/bin/sh +vapigen-${SHRT_VER} "\$@" +EOF + chmod +x ${B}/vapigen-wrapper +} + +# Vapigen wrapper needs to be available system-wide, because it will be used +# to build vapi files from all other packages with vala support +do_install_append_class-target() { + install -d ${D}${bindir}/ + install ${B}/vapigen-wrapper ${D}${bindir}/ +} + + +SYSROOT_PREPROCESS_FUNCS_append_class-target += "vapigen_sysroot_preprocess" + +vapigen_sysroot_preprocess() { + # Put vapigen wrapper into target sysroot so that it can be used when building vapi files. + sysroot_stage_dir ${D}${bindir} ${SYSROOT_DESTDIR}${bindir} + + # Also, tweak the vapigen name in vapigen pkgconfig file, so that it picks up our + # wrapper. + sed -i \ + -e "s|vapigen=.*|vapigen=${bindir}/vapigen-wrapper|" \ + ${SYSROOT_DESTDIR}${datadir}/pkgconfig/vapigen-${SHRT_VER}.pc +} -- cgit v1.2.3-54-g00ecf