Fix make-array transforms.
[sbcl.git] / make-target-contrib.sh
1 #!/bin/sh
2 set -e
3
4 # This is a script to be run as part of make.sh. The only time you'd
5 # probably want to run it by itself is if you're cross-compiling the
6 # system or doing some kind of troubleshooting.
7
8 # This software is part of the SBCL system. See the README file for
9 # more information.
10 #
11 # This software is derived from the CMU CL system, which was
12 # written at Carnegie Mellon University and released into the
13 # public domain. The software is in the public domain and is
14 # provided with absolutely no warranty. See the COPYING and CREDITS
15 # files for more information.
16
17 echo //entering make-target-contrib.sh
18
19 LANG=C
20 LC_ALL=C
21 CC=${CC:-gcc}
22 export CC LANG LC_ALL
23
24 # Load our build configuration
25 . output/build-config
26
27 . ./sbcl-pwd.sh
28 sbcl_pwd
29
30 SBCL_HOME="$SBCL_PWD/obj/sbcl-home"
31 export SBCL_HOME SBCL_PWD
32 if [ "$OSTYPE" = "cygwin" ] ; then
33     SBCL_PWD=`echo $SBCL_PWD | sed s/\ /\\\\\\\\\ /g`
34 fi
35
36 SBCL="$SBCL_PWD/src/runtime/sbcl --noinform --core $SBCL_PWD/output/sbcl.core \
37 --lose-on-corruption --disable-debugger --no-sysinit --no-userinit"
38 SBCL_BUILDING_CONTRIB=1
39 export SBCL SBCL_BUILDING_CONTRIB
40
41 # deleting things here lets us not worry about interaction with stale
42 # fasls.  This is not good, but is better than :FORCE on each asdf
43 # operation, because that causes multiple builds of base systems such
44 # as SB-RT and SB-GROVEL, but FIXME: there's probably a better
45 # solution.  -- CSR, 2003-05-30
46 if [ -z "$DONT_CLEAN_SBCL_CONTRIB" ] ; then
47   find contrib/ obj/asdf-cache/ obj/sbcl-home/contrib/ \
48     \( -name '*.fasl' -o \
49        -name '*.FASL' -o \
50        -name 'foo.c' -o \
51        -name 'FOO.C' -o \
52        -name 'a.out' -o \
53        -name 'A.OUT' -o \
54        -name 'alien.so' -o \
55        -name 'ALIEN.SO' -o \
56        -name '*.o' -o \
57        -name '*.O' \) \
58     -print | xargs rm -f
59 fi
60
61 find output -name 'building-contrib.*' -print | xargs rm -f
62
63 # Ignore all source registries.
64 if [ -z "$*" ]; then
65     contribs_to_build="`cd contrib ; echo *`"
66 else
67     contribs_to_build="$*"
68 fi
69
70 for i in $contribs_to_build; do
71     test -d contrib/$i && test -f contrib/$i/Makefile || continue;
72     test -f contrib/$i/test-passed && rm contrib/$i/test-passed # remove old convention
73     test -f obj/asdf-cache/$i/test-passed.test-report && rm obj/asdf-cache/$i/test-passed.test-report
74     mkdir -p obj/asdf-cache/$i/
75     # hack to get exit codes right.
76     if $GNUMAKE -C contrib/$i test < /dev/null 2>&1 && touch obj/asdf-cache/$i/test-passed.test-report ; then
77         :
78     else
79         exit $?
80     fi | tee output/building-contrib.`basename $i` 
81 done
82
83 # Otherwise report expected failures:
84 HEADER_HAS_BEEN_PRINTED=false
85 for dir in `cd obj/asdf-cache/ ; echo *`; do
86   f="obj/asdf-cache/$dir/test-passed.test-report"
87   if test -f "$f" && grep -i fail "$f" >/dev/null; then
88       if ! $HEADER_HAS_BEEN_PRINTED; then
89           cat <<EOF
90
91 Note: Test suite failures which are expected for this combination of
92 platform and features have been ignored:
93 EOF
94           HEADER_HAS_BEEN_PRINTED=true
95       fi
96       echo "  contrib/$dir"
97       (unset IFS; while read line; do echo "    $line"; done <"$f")
98   fi
99 done
100
101 # Sometimes people used to see the "No tests failed." output from the last
102 # DEFTEST in contrib self-tests and think that's all that is. So...
103 HEADER_HAS_BEEN_PRINTED=false
104 for dir in `cd contrib ; echo *`
105 do
106   if [ -d "contrib/$dir" -a -f "contrib/$dir/Makefile" -a ! -f "obj/asdf-cache/$dir/test-passed.test-report" ]; then
107       if $HEADER_HAS_BEEN_PRINTED; then
108           echo > /dev/null
109       else
110           cat <<EOF
111
112 WARNING! Some of the contrib modules did not build successfully or pass
113 their self-tests. Failed contribs:"
114 EOF
115           HEADER_HAS_BEEN_PRINTED=true
116       fi
117       echo "  $dir"
118   fi
119 done
120
121 if [ $HEADER_HAS_BEEN_PRINTED = true ]; then
122   exit 1
123 fi