[virt-tools-list] [libosinfo] Let there be Vala bindings!

Daniel P. Berrange berrange at redhat.com
Wed Oct 5 14:19:54 UTC 2011


On Wed, Oct 05, 2011 at 05:14:52PM +0300, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>
> 
> Generate Vala bindings if vapigen tool is available, unless explicitly
> asked not to.
> ---
>  configure.ac       |   18 ++++++++++++++++++
>  libosinfo.spec.in  |   20 +++++++++++++++++++-
>  osinfo/Makefile.am |   16 +++++++++++++++-
>  3 files changed, 52 insertions(+), 2 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index eeaad45..886186d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -93,6 +93,24 @@ if test "x$enable_introspection" != "xno" ; then
>  fi
>  AM_CONDITIONAL([WITH_GOBJECT_INTROSPECTION], [test "x$enable_introspection" = "xyes"])
>  
> +AC_ARG_ENABLE([vala],
> +              AS_HELP_STRING([--enable-vala], [enable Vala binding generation]),
> +              [], [enable_vala=check])
> +if test "x$enable_introspection" = "xyes" ; then
> +        if test "x$enable_vala" != "xno" ; then
> +                AC_PATH_PROG(VAPIGEN, vapigen, no)
> +                if test "x$VAPIGEN" != "xno"; then
> +                        if test "x$enable_vala" == "xcheck" ; then
> +                                enable_vala=yes
> +                                AC_SUBST(VAPIGEN)
> +                        fi
> +                else
> +                        AC_MSG_ERROR([Cannot find the "vapigen" binary in your PATH])
> +                fi
> +        fi
> +fi
> +AM_CONDITIONAL([WITH_VALA], [test "x$enable_vala" = "xyes"])
> +
>  AC_ARG_ENABLE([udev],
>          AS_HELP_STRING([--enable-udev], [enable Udev support]),
>          [], [enable_udev=no])
> diff --git a/libosinfo.spec.in b/libosinfo.spec.in
> index f1b8cac..da9572d 100644
> --- a/libosinfo.spec.in
> +++ b/libosinfo.spec.in
> @@ -22,6 +22,8 @@ URL: https://fedorahosted.org/libosinfo/
>  BuildRequires: glib2-devel
>  BuildRequires: check-devel
>  BuildRequires: libxml2-devel >= 2.6.0
> +BuildRequires: vala
> +BuildRequires: vala-tools
>  %if %{with_gir}
>  BuildRequires: gobject-introspection-devel
>  %if 0%{?fedora} < 14
> @@ -49,6 +51,18 @@ combination.
>  
>  Libraries, includes, etc. to compile with the libosinfo library
>  
> +%package vala
> +Summary: Vala bindings
> +Group: Development/Libraries
> +Requires: %{name}-devel = %{version}-%{release}
> +
> +%description vala
> +libosinfo is a library that allows virtualization provisioning tools to
> +determine the optimal device settings for a hypervisor/operating system
> +combination.
> +
> +This package provides the Vala bindings for libosinfo library.
> +
>  %prep
>  %setup -q
>  
> @@ -59,7 +73,7 @@ Libraries, includes, etc. to compile with the libosinfo library
>  %define gir_arg --enable-introspection=no
>  %endif
>  
> -%configure %{gir_arg} --enable-udev=yes
> +%configure %{gir_arg} --enable-vala=yes --enable-udev=yes
>  %__make %{?_smp_mflags} V=1
>  
>  chmod a-x examples/*.js examples/*.py
> @@ -114,6 +128,10 @@ rm -fr %{buildroot}
>  %endif
>  %{_datadir}/gtk-doc/html/Libosinfo
>  
> +%files vala
> +%defattr(-, root, root)
> +%{_datadir}/vala/vapi/libosinfo-1.0.vapi
> +
>  %changelog
>  * Wed Aug 25 2010 Daniel P. Berrange <berrange at redhat.com> - 0.2.0-1
>  - Initial package
> diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am
> index a40fc98..3cffb7b 100644
> --- a/osinfo/Makefile.am
> +++ b/osinfo/Makefile.am
> @@ -128,6 +128,20 @@ typelibs_DATA = Libosinfo-1.0.typelib
>  		--includedir=$(girdir) \
>  		-o $@ $<
>  
> -CLEANFILES = $(gir_DATA) $(typelibs_DATA) $(wildcard *.gcno)
> +if WITH_VALA
> +vapidir = $(datadir)/vala/vapi
> +vapi_DATA = libosinfo-1.0.vapi
> +
> +libosinfo-1.0.vapi: Libosinfo-1.0.gir Libosinfo-1.0.typelib
> +	$(AM_V_GEN)$(VAPIGEN) \
> +		--vapidir=. \
> +		--pkg gobject-2.0 \
> +		--pkg gio-2.0 \
> +		--library libosinfo-1.0 \
> +		Libosinfo-1.0.gir
> +
> +endif # WITH_VALA
> +
> +CLEANFILES = $(gir_DATA) $(typelibs_DATA) $(vapi_DATA) $(wildcard *.gcno)

ACK


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the virt-tools-list mailing list