Better support for NetBSD/current
[sbcl.git] / make-target-contrib.sh
blobb6090724b5b1b105c94d10e62736baecb1939c1b
1 #!/bin/sh
2 set -e
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.
8 # This software is part of the SBCL system. See the README file for
9 # more information.
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.
17 echo //entering make-target-contrib.sh
19 LANG=C
20 LC_ALL=C
21 CC=${CC:-gcc}
22 export CC LANG LC_ALL
24 # Load our build configuration
25 . output/build-config
27 . ./sbcl-pwd.sh
28 sbcl_pwd
30 SBCL_HOME="$SBCL_PWD/contrib"
31 export SBCL_HOME
32 if [ "$OSTYPE" = "cygwin" ] ; then
33 SBCL_PWD=`echo $SBCL_PWD | sed s/\ /\\\\\\\\\ /g`
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
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
47 find contrib/ \( -name '*.fasl' -o \
48 -name '*.FASL' -o \
49 -name 'foo.c' -o \
50 -name 'FOO.C' -o \
51 -name 'a.out' -o \
52 -name 'A.OUT' -o \
53 -name 'alien.so' -o \
54 -name 'ALIEN.SO' -o \
55 -name '*.o' -o \
56 -name '*.O' \) \
57 -print | xargs rm -f
59 find output -name 'building-contrib.*' -print | xargs rm -f
61 # Ignore all source registries.
62 CL_SOURCE_REGISTRY='(:source-registry :ignore-inherited-configuration)'
63 export CL_SOURCE_REGISTRY
65 if [ -z "$*" ]; then
66 contribs_to_build=contrib/*
67 else
68 for name in $*; do
69 contribs_to_build="contrib/$name $contribs_to_build"
70 done
73 for i in $contribs_to_build; do
74 test -d $i && test -f $i/Makefile || continue;
75 # export INSTALL_DIR=$SBCL_HOME/`basename $i `
76 test -f $i/test-passed && rm $i/test-passed
77 # hack to get exit codes right.
78 if $GNUMAKE -C $i test 2>&1 && touch $i/test-passed ; then
80 else
81 exit $?
82 fi | tee output/building-contrib.`basename $i`
83 done
85 # Otherwise report expected failures:
86 HEADER_HAS_BEEN_PRINTED=false
87 for dir in contrib/*; do
88 f="$dir/test-passed"
89 if test -f "$f" && grep -i fail "$f" >/dev/null; then
90 if ! $HEADER_HAS_BEEN_PRINTED; then
91 cat <<EOF
93 Note: Test suite failures which are expected for this combination of
94 platform and features have been ignored:
95 EOF
96 HEADER_HAS_BEEN_PRINTED=true
98 echo " $dir"
99 (unset IFS; while read line; do echo " $line"; done <"$f")
101 done
103 # Sometimes people used to see the "No tests failed." output from the last
104 # DEFTEST in contrib self-tests and think that's all that is. So...
105 HEADER_HAS_BEEN_PRINTED=false
106 for dir in contrib/*
108 if [ -d "$dir" -a -f "$dir/Makefile" -a ! -f "$dir/test-passed" ]; then
109 if $HEADER_HAS_BEEN_PRINTED; then
110 echo > /dev/null
111 else
112 cat <<EOF
114 WARNING! Some of the contrib modules did not build successfully or pass
115 their self-tests. Failed contribs:"
117 HEADER_HAS_BEEN_PRINTED=true
119 echo " `basename $dir`"
121 done
123 if [ $HEADER_HAS_BEEN_PRINTED = true ]; then
124 exit 1