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
13# Disable analyzer on m68k because the compiler gets very confused
14# about complex values
15
16case "$TARGET" in
17    *m68k*)
18	ANALYZER=""
19	;;
20esac
21
22# Disable the analyser when not using tinystdio as the stdio code is
23# full of problems
24
25case "$*" in
26    *-Dtinystdio=false*)
27	ANALYZER=""
28	;;
29esac
30
31mkdir "$DIR"
32trap 'rm -rf "$DIR"' 0 1 15
33(cd "$DIR" || exit 1
34 echo '##################################################'
35 echo '##########' ../scripts/"$CONFIGURE" -Dwerror=true $ANALYZER "$@"
36 echo '##################################################'
37 ../scripts/"$CONFIGURE" -Dwerror=true $ANALYZER "$@"
38 case $? in
39     0)
40	 echo 'Configuration succeeded'
41	 ;;
42     77)
43	 echo 'Configuration skipped'
44	 exit 0
45	 ;;
46     *)
47	 echo 'Configuration failed with' "$?"
48	 exit 1
49	 ;;
50 esac
51 cat meson-logs/*
52 ninja || exit 1) || exit 1
53