2 # Copyright (C) 2012 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Building libraries (libtool and static) from Vala sources.
18 # And use of vapi files to call C code from Vala.
20 required="valac cc pkg-config libtoolize GNUmake"
23 cat >> configure.ac << 'END'
29 AM_PROG_VALAC([0.7.3])
30 PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.4])
34 cat > Makefile.am << 'END'
35 lib_LIBRARIES = libmu.a
36 lib_LTLIBRARIES = src/libzardoz.la
37 libmu_a_SOURCES = mu.vala mu2.c mu.vapi mu2.h
38 libmu_a_CPPFLAGS = -DOKOKIMDEFINED=1
39 libmu_a_VALAFLAGS = --profile=posix --vapidir=$(srcdir)
40 AM_CFLAGS = $(GOBJECT_CFLAGS)
41 src_libzardoz_la_LIBADD = $(GOBJECT_LIBS)
42 src_libzardoz_la_SOURCES = src/zardoz-foo.vala src/zardoz-bar.vala
43 src/zardoz-bar.vala: src/zardoz-foo.vala
44 sed 's/Foo/Bar/g' $< >$@
52 grep PKG_CHECK_MODULES configure && skip_ "pkg-config m4 macros not found"
69 [CCode (cheader_filename = "mu2.h", cname = "mu2")]
73 cat > mu.vala << 'END'
76 stdout.printf ("mumumu\n");
82 cat > src/zardoz-foo.vala << 'END'
85 public static void zap () {
86 stdout.printf ("FooFooFoo!\n");
93 test -f src/libzardoz.la
95 $FGREP "FooFooFoo" src/zardoz-foo.c
96 $FGREP "BarBarBar" src/zardoz-bar.c
97 test -f libmu_a_vala.stamp
98 test -f src_libzardoz_la_vala.stamp