--- config/install.sh.orig	Fri Oct 20 18:02:25 2000
+++ config/install.sh	Tue Dec 21 06:22:34 2004
@@ -151,11 +151,34 @@
 #
 # build the run-time system
 #
+if [ -x $RUNDIR/run.$ARCH-$OPSYS ]; then
+  echo "$RUNDIR/run.$ARCH-$OPSYS already exists"
+else
 $CONFIGDIR/unpack.sh "run-time" $SRCDIR runtime $ROOT/runtime.tar
 if [ "$?" != "0" ]; then
   exit $?
 fi
-if [ ! -x $RUNDIR/run.$ARCH-$OPSYS ]; then
+# we need to patch just before build
+echo "applying source patches"
+patch_file="${FILESDIR}/extra-patch-cpp"
+if [ -f $patch_file ]; then
+	$PATCH $PATCH_ARGS < $patch_file
+fi
+patch_file="${FILESDIR}/extra-patch-global-names"
+if [ -f $patch_file ]; then
+	$PATCH $PATCH_ARGS < $patch_file
+fi
+patch_file="${FILESDIR}/extra-patch-genposixnames"
+if [ -f $patch_file ]; then
+	$PATCH $PATCH_ARGS < $patch_file
+fi
+if grep -w FPE_INTDIV /usr/include/machine/trap.h > /dev/null 2>&1; then
+	patch_file="${FILESDIR}/extra-patch-signals"
+	if [ -f $patch_file ]; then
+		$PATCH $PATCH_ARGS < $patch_file
+	fi
+fi
+#if [ ! -x $RUNDIR/run.$ARCH-$OPSYS ]; then
   cd $SRCDIR/runtime/objs
   echo "compiling the run-time system"
   $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS
