Set -u in the setup scripts and make them more robust to interrupts.
authorTaylor R Campbell <campbell@mumble.net>
Mon, 9 Aug 2010 16:44:03 +0000 (16:44 +0000)
committerTaylor R Campbell <campbell@mumble.net>
Mon, 9 Aug 2010 16:44:03 +0000 (16:44 +0000)
src/Setup.sh
src/compiler/Setup.sh
src/etc/Setup.sh
src/microcode/Setup.sh

index 575df1bf30223ac61c6542fd2afa0ca7eb0b3897..7e52efe46722c0f65f45e530570e59812cd4d8c1 100755 (executable)
 # Utility to set up the MIT/GNU Scheme build directories.
 # The working directory must be the top-level source directory.
 
-set -e
+set -eu
 
 : ${MIT_SCHEME_EXE:=mit-scheme}
 
+configure=done
+
+clean ()
+{
+    if [ "x${configure}" != xdone ]; then
+       rm -f configure
+    fi
+}
+
+trap clean EXIT INT TERM
+
 # Please keep the following messages synchronized with the messages in
 # these files:
 #
@@ -56,8 +67,10 @@ EOF
 fi
 
 if [ ! -x configure ]; then
+    configure=clean
     echo "autoconf"
     autoconf --include=microcode
+    configure=done
 fi
 
 . etc/functions.sh
@@ -87,5 +100,5 @@ done
 for SUBDIR in ${INSTALLED_SUBDIRS} ${OTHER_SUBDIRS}; do
     echo "setting up ${SUBDIR}"
     maybe_link ${SUBDIR}/Setup.sh ../etc/Setup.sh
-    (cd ${SUBDIR} && ./Setup.sh "$@")
+    (cd ${SUBDIR} && ./Setup.sh ${@:+"${@}"})
 done
index 18e2e1792ea7fc0e3fe81dabcdbb6ff383d6acdb..1330c53dcc0d7e22241381425276d753e61ef2ee 100755 (executable)
 # Utility to set up the MIT/GNU Scheme compiler directory.
 # The working directory must be the compiler directory.
 
-set -e
+set -eu
 
 . ../etc/functions.sh
 
-../etc/Setup.sh "${@}"
+../etc/Setup.sh ${@:+"${@}"}
 
 for N in 1 2 3; do
     maybe_link machines/vax/dinstr${N}.scm instr${N}.scm
index acfbdb7ebe638794d4fa6cf08b8ea312fdb274f1..b26d884a29e6df40d8773ce0fa83282f1441feb6 100755 (executable)
@@ -25,7 +25,7 @@
 # Utility to set up an MIT/GNU Scheme build directory.
 # The working directory must be the build directory.
 
-set -e
+set -eu
 
 . ../etc/functions.sh
 
index 3c3e6703f770b73b46f52b705151173782d0a986..00dac413c20b97b7b0e6132b86f81712c6b0b383 100755 (executable)
 # Program to set up MIT/GNU Scheme microcode from CVS for distribution.
 # Requires `gcc' and `scheme'.
 
-set -e
+set -eu
+
+autoheader=done
+autoconf=done
+makeinit=done
+
+clean ()
+{
+    if [ "x${autoheader}" != xdone ]; then
+       rm -f config.h.in
+    fi
+    if [ "x${autoconf}" != xdone ]; then
+       rm -f configure
+    fi
+    if [ "x${makeinit}" != xdone ]; then
+       rm -f Makefile.deps Makefile.in
+    fi
+}
+
+trap clean EXIT INT TERM
 
 if [ ! -f config.h.in ]; then
+    autoheader=clean
     echo "autoheader"
     autoheader
+    autoheader=done
 fi
 if [ ! -x configure ]; then
+    autoconf=clean
     echo "autoconf"
     autoconf
+    autoconf=done
 fi
-( cd cmpauxmd && make "${@}" )
+( cd cmpauxmd && make ${@:+"${@}"} )
 if [ ! -f Makefile.in ]; then
-    makegen/makeinit.sh "${@}"
+    makeinit=clean
+    makegen/makeinit.sh ${@:+"${@}"}
+    makeinit=done
 fi