4 # Copyright (C) 2006-2008 Jürg Billeter
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 # Jürg Billeter <j@bitron.ch>
24 topbuilddir
=$builddir/..
25 srcdir
=$PWD/`dirname $0`
27 vapidir
=$topsrcdir/vapi
29 export G_DEBUG
=fatal_warnings
31 VALAC
=$topbuilddir/compiler
/valac
32 VALAFLAGS
="--vapidir $vapidir"
34 CFLAGS
="-O0 -g3 -I$topsrcdir -I$topbuilddir"
39 function testheader
() {
40 if [ "$1" = "Packages:" ]; then
43 for pkg
in $PACKAGES; do
44 if [ "$pkg" = "dbus-glib-1" ]; then
45 echo 'eval `dbus-launch --sh-syntax`' >> prepare
46 echo 'trap "kill $DBUS_SESSION_BUS_PID" INT TERM EXIT' >> prepare
52 function sourceheader
() {
53 if [ "$1" = "Program:" ]; then
55 SOURCEFILE
=$PROGRAM.vala
59 function sourceend
() {
60 if [ -n "$PROGRAM" ]; then
61 echo "$VALAC $VALAFLAGS $(echo $PACKAGES | xargs -n 1 -r echo --pkg) -C $SOURCEFILE" >> build
62 echo "$CC $CFLAGS -o $PROGRAM$EXEEXT $PROGRAM.c \$(pkg-config --cflags --libs glib-2.0 gobject-2.0 $PACKAGES) $LDLIBS" >> build
63 echo "./$PROGRAM$EXEEXT" > check
67 for testfile
in "$@"; do
68 testname
=$
(basename $testfile)
69 testdir
=${testname/.test/.d}
74 touch prepare build check cleanup
76 echo 'set -e' >> prepare
82 cat "$builddir/$testfile" |
while true
; do
83 if IFS
="" read -r line
; then
84 if [ $PART -eq 0 ]; then
85 if [ -n "$line" ]; then
91 if [ $INHEADER -eq 1 ]; then
92 if [ -n "$line" ]; then
98 if echo "$line" |
grep -q "^[A-Za-z]\+:"; then
105 echo "$line" >> $SOURCEFILE
115 cat prepare build check cleanup
> script
116 if ! bash
script >log
2>&1; then
123 if [ $CODE -eq 0 ]; then