1#!/bin/sh
2TARGET=$1
3DIR=build-"$TARGET"
4CONFIGURE=do-"$TARGET"-configure
5shift
6
7for p in /opt/*/bin; do
8    PATH="$p":$PATH
9done
10
11ANALYZER="-Danalyzer=true"
12
13CDEFS="-Dtests-cdefs=true"
14TEST="test"
15
16# Disable analyzer on m68k because the compiler gets very confused
17# about complex values
18
19case "$TARGET" in
20    *m68k*)
21	ANALYZER=""
22	;;
23esac
24
25# Disable the analyser when not using tinystdio as the stdio code is
26# full of problems
27
28case "$*" in
29    *-Dtinystdio=false*)
30	ANALYZER=""
31	;;
32esac
33
34mkdir "$DIR"
35trap 'rm -rf "$DIR"' 0 1 15
36(cd "$DIR" || exit 1
37 echo '##################################################'
38 echo '##########' ../scripts/"$CONFIGURE" -Dwerror=true $ANALYZER $CDEFS "$@"
39 echo '##################################################'
40 ../scripts/"$CONFIGURE" -Dwerror=true $ANALYZER $CDEFS "$@"
41 case $? in
42     0)
43	 echo 'Configuration succeeded'
44	 ;;
45     77)
46	 echo 'Configuration skipped'
47	 exit 0
48	 ;;
49     *)
50	 echo 'Configuration failed with' "$?"
51	 cat meson-logs/*
52	 exit 1
53	 ;;
54 esac
55 cat meson-logs/*
56 ninja $TEST || exit 1) || exit 1
57