Add stamp files so that the build and image stages aren't repeated if
authorChris Hanson <org/chris-hanson/cph>
Fri, 9 Mar 2001 17:40:37 +0000 (17:40 +0000)
committerChris Hanson <org/chris-hanson/cph>
Fri, 9 Mar 2001 17:40:37 +0000 (17:40 +0000)
the script is restarted.

v7/dist/make-dist-files

index 49d1dbaa3b638375469be2b92f10fc38d165d52c..546c07c24d59a2c15be239800b4149307918dfee 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# $Id: make-dist-files,v 1.14 2001/03/05 20:49:02 cph Exp $
+# $Id: make-dist-files,v 1.15 2001/03/09 17:40:37 cph Exp $
 #
 # Copyright (c) 2000-2001 Massachusetts Institute of Technology
 #
@@ -38,43 +38,56 @@ esac
 
 . /scheme/v7/dist/release-prefix
 
-SRC_FILE="$(get_release_prefix)-src.tar.gz"
+TL_DIR="$(pwd)"
+BUILD_DIR="${TL_DIR}/$(get_release_prefix)"
+IMAGE_DIR="${BUILD_DIR}-image"
+BINDIR="${IMAGE_DIR}/usr/local/bin"
+AUXDIR="${IMAGE_DIR}/usr/local/lib/mit-scheme"
+SRC_FILE="${BUILD_DIR}-src.tar.gz"
+STAMP_BUILD="${TL_DIR}/stamp-build"
+STAMP_IMAGE="${TL_DIR}/stamp-image"
+
 if [ ! -f "${SRC_FILE}" ]; then
     echo "No source file: ${SRC_FILE}."
     exit 1
 fi
 
-BUILD_DIR="$(pwd)/$(get_release_prefix)"
-IMAGE_DIR="${BUILD_DIR}-image"
-BINDIR="${IMAGE_DIR}/usr/local/bin"
-AUXDIR="${IMAGE_DIR}/usr/local/lib/mit-scheme"
-
 MKINSTALLDIRS="/scheme/v7/src/mkinstalldirs"
 INSTALL="install"
 INSTALL_DATA="${INSTALL} -m 644"
 
 # It takes a lot of work to build the image.
 # Don't throw it away needlessly.
-if [ ! -d "${IMAGE_DIR}" ]; then
+
+if [ ! -f "${STAMP_BUILD}" ];then
     rm -rf "${BUILD_DIR}"
+
     tar xzf "${SRC_FILE}"
 
     cd "${BUILD_DIR}/src"
     ./configure --enable-static-libs=yes --with-mcrypt=no
     make
+
+    cd "${BUILD_DIR}/doc"
+    ./configure
+    make
+
+    touch "${STAMP_BUILD}"
+fi
+
+if [ ! -f "${STAMP_IMAGE}" ]; then
+    rm -rf ${IMAGE_DIR}
+
+    cd "${BUILD_DIR}/src"
     make install DESTDIR="${IMAGE_DIR}"
     ${MKINSTALLDIRS} "${AUXDIR}/doc/."
     ${INSTALL_DATA} COPYING "${AUXDIR}/doc/."
 
     cd "${BUILD_DIR}/doc"
-    ./configure
-    make
     make install-info-gz DESTDIR="${IMAGE_DIR}" \
        infodir=/usr/local/lib/mit-scheme/edwin/info
     make install-html DESTDIR="${IMAGE_DIR}"
 
-    rm -rf ${BUILD_DIR}
-
     ${INSTALL_DATA} /usr/local/info/dir "${AUXDIR}/edwin/info/."
     ${INSTALL_DATA} /usr/local/info/r4rs.* "${AUXDIR}/edwin/info/."
     ${INSTALL_DATA} /usr/local/info/r5rs.* "${AUXDIR}/edwin/info/."
@@ -161,14 +174,17 @@ if [ ! -d "${IMAGE_DIR}" ]; then
     #
     find ${IMAGE_DIR} -type f -print | xargs chmod og-w
     find ${IMAGE_DIR} -type d -print | xargs chmod og-w
+
+    touch "${STAMP_IMAGE}"
 fi
 
+
 make_tarfile ()
 {
-    tarfile="${1}.tar.gz"
-    [ -e "${tarfile}" ] && rm -f "${tarfile}"
-    (cd ${IMAGE_DIR}/usr/local; tar cvzf "../../../${tarfile}" *)
-    chmod 444 "${tarfile}"
+    TARFILE="${TL_DIR}/${1}.tar.gz"
+    [ -e "${TARFILE}" ] && rm -f "${TARFILE}"
+    (cd ${IMAGE_DIR}/usr/local; tar cvzf "${TARFILE}" *)
+    chmod 444 "${TARFILE}"
 }
 
 if [ "${DESTINATION}" = "" ]; then
@@ -180,4 +196,4 @@ else
   make_tarfile "${DESTINATION}"
 fi
 
-rm -rf "${IMAGE_DIR}"
+rm -rf "${STAMP_BUILD}" "${BUILD_DIR}" "${STAMP_IMAGE}" "${IMAGE_DIR}"