diff --git a/bin/build-all.sh b/bin/build-all.sh index d5823afc365b50502d40afdcece8708a87f2472a..0bf6ed5fb10a6e7596b43c34ae74a3cb5ece03df 100755 --- a/bin/build-all.sh +++ b/bin/build-all.sh @@ -35,12 +35,13 @@ usage () echo " -P On the last build, (re)generate cmucl.pot and the" echo " translations" echo " -R Force recompilation of C runtime" + echo " -G Don't use git to fill file-comment information" } CREATE_OPT="" UPDATE_POT="-P" -while getopts "PRUB:b:v:C:o:8:?" arg +while getopts "PRUGB:b:v:C:o:8:?" arg do case $arg in b) BASE="$OPTARG" ;; @@ -53,6 +54,7 @@ do U) UPDATE_TRANS="-U" ;; P) UPDATE_POT="" ;; R) RECOMPILEC="-R" ;; + G) GIT_FILE_COMMENT="-G" ;; \?) usage; exit 1 ;; esac done @@ -87,15 +89,15 @@ buildx86 () if [ -n "$OLD8" ]; then # Build non-unicode versions set -x - $BINDIR/build.sh -f x87 -b ${BASE}-8bit $bootfiles ${VERSION:+-v "$VERSION"} -C "${CREATE_OPT}" ${UPDATE_TRANS} ${UPDATE_POT} ${RECOMPILEC} -o "$OLD8" - $BINDIR/build.sh -f sse2 -b ${BASE}-8bit $bootfiles ${VERSION:+-v "$VERSION"} -C "${CREATE_OPT}" ${UPDATE_TRANS} ${UPDATE_POT} ${RECOMPILEC} -o "$OLD8" + $BINDIR/build.sh -f x87 -b ${BASE}-8bit $bootfiles ${VERSION:+-v "$VERSION"} -C "${CREATE_OPT}" ${UPDATE_TRANS} ${UPDATE_POT} ${RECOMPILEC} ${GIT_FILE_COMMENT} -o "$OLD8" + $BINDIR/build.sh -f sse2 -b ${BASE}-8bit $bootfiles ${VERSION:+-v "$VERSION"} -C "${CREATE_OPT}" ${UPDATE_TRANS} ${UPDATE_POT} ${RECOMPILEC} ${GIT_FILE_COMMENT} -o "$OLD8" set +x fi # Build the unicode versions if [ -n "$OLDLISP" ]; then set -x - $BINDIR/build.sh -f x87 -b ${BASE} $bootfiles ${VERSION:+-v "$VERSION"} -C "${CREATE_OPT}" ${UPDATE_TRANS} ${UPDATE_POT} ${RECOMPILEC} -o "$OLDLISP" - $BINDIR/build.sh -f sse2 -b ${BASE} $bootfiles ${VERSION:+-v "$VERSION"} -C "${CREATE_OPT}" ${UPDATE_TRANS} ${UPDATE_POT} ${RECOMPILEC} -o "$OLDLISP" + $BINDIR/build.sh -f x87 -b ${BASE} $bootfiles ${VERSION:+-v "$VERSION"} -C "${CREATE_OPT}" ${UPDATE_TRANS} ${UPDATE_POT} ${RECOMPILEC} ${GIT_FILE_COMMENT} -o "$OLDLISP" + $BINDIR/build.sh -f sse2 -b ${BASE} $bootfiles ${VERSION:+-v "$VERSION"} -C "${CREATE_OPT}" ${UPDATE_TRANS} ${UPDATE_POT} ${RECOMPILEC} ${GIT_FILE_COMMENT} -o "$OLDLISP" set +x fi } @@ -108,13 +110,13 @@ buildsun4 () # Build non-unicode versions if [ -n "$OLD8" ]; then set -x - $BINDIR/build.sh -b ${BASE}-8bit $bootfiles ${VERS} -C "$CREATE_OPT" ${UPDATE_TRANS} ${UPDATE_POT} ${RECOMPILEC} -o "$OLD8" + $BINDIR/build.sh -b ${BASE}-8bit $bootfiles ${VERS} -C "$CREATE_OPT" ${UPDATE_TRANS} ${UPDATE_POT} ${RECOMPILEC} ${GIT_FILE_COMMENT} -o "$OLD8" set +x fi # Build the unicode version. if [ -n "$OLDLISP" ]; then set -x - $BINDIR/build.sh -b ${BASE} $bootfiles ${VERS} -C "$CREATE_OPT" ${UPDATE_TRANS} ${UPDATE_POT} ${RECOMPILEC} -o "$OLDLISP" + $BINDIR/build.sh -b ${BASE} $bootfiles ${VERS} -C "$CREATE_OPT" ${UPDATE_TRANS} ${UPDATE_POT} ${RECOMPILEC} ${GIT_FILE_COMMENT} -o "$OLDLISP" set +x fi } diff --git a/bin/build-world.sh b/bin/build-world.sh index f354915ac60bb6be2b60451a6a7e8a194b7bfd7b..8a209111162894e0fdb8495ae8b8d806326e109e 100755 --- a/bin/build-world.sh +++ b/bin/build-world.sh @@ -26,6 +26,12 @@ if [ -n "$MAKE_POT" ]; then SAVEPOT='(intl::dump-pot-files :output-directory "default:src/i18n/locale/")' fi +if [ "$GIT_FILE_COMMENT" = "no" ]; then + GIT_FILE_COMMENT="(setf c::*file-comment-from-git* nil)" +else + GIT_FILE_COMMENT= +fi + $LISP "$@" -noinit -nositeinit <<EOF (in-package :cl-user) @@ -56,6 +62,8 @@ $LISP "$@" -noinit -nositeinit <<EOF (setq debug:*debug-print-level* nil) (setq debug:*debug-print-length* nil) +$GIT_FILE_COMMENT + (load "target:tools/worldcom") #-(or no-compiler runtime) (load "target:tools/comcom") ;; Compile at least new-genesis, so that genesis doesn't take ages @@ -64,7 +72,6 @@ $LISP "$@" -noinit -nositeinit <<EOF $GETFMT $SAVEPOT - (setq *gc-verbose* t *interactive* t) (load "target:tools/worldbuild") diff --git a/bin/build.sh b/bin/build.sh index 4aa8f2462c42c99acea6c208c90c434b25b8a1c2..9be48e4a7f413995e6de435d100767904f87b38e 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -45,6 +45,8 @@ BINDIR=bin TOOLDIR=$BINDIR OLDLISPFLAGS="-noinit -nositeinit" OLDLISP="cmulisp" +GIT_FILE_COMMENT="yes" +export GIT_FILE_COMMENT SKIPUTILS=no @@ -66,7 +68,7 @@ fi usage () { - echo "build.sh [-123obvuBCU?]" + echo "build.sh [-123obvuBCUG?]" echo " -1 Skip build 1" echo " -2 Skip build 2" echo " -3 Skip build 3" @@ -96,6 +98,7 @@ usage () echo " The flags always include -noinit -nositeinit" echo " -R Force recompiling the C runtime. Normally, just runs make to " echo " recompile anything that has changed." + echo " -G Don't use git to fill file-comment information" exit 1 } @@ -152,7 +155,7 @@ BUILDWORLD="$TOOLDIR/build-world.sh" BUILD_POT="yes" UPDATE_TRANS= -while getopts "123PRo:b:v:uB:C:Ui:f:w:O:?" arg +while getopts "123PRGo:b:v:uB:C:Ui:f:w:O:?" arg do case $arg in 1) ENABLE2="no" ;; @@ -172,6 +175,7 @@ do U) UPDATE_TRANS="yes";; O) OLDLISPFLAGS="$OLDLISPFLAGS $OPTARG" ;; R) REBUILD_LISP="yes";; + G) GIT_FILE_COMMENT="no";; \?) usage ;; esac diff --git a/src/compiler/main.lisp b/src/compiler/main.lisp index cba62e95b7289d2e5a2eef9578b05b5bfb376471..6abe478ee2dd665a6c5032f53d56688c4e4895d4 100644 --- a/src/compiler/main.lisp +++ b/src/compiler/main.lisp @@ -1094,34 +1094,41 @@ ;;; ;;; Stash file comment in the file-info structure. ;;; + +(defvar *file-comment-from-git* t + "If non-Nil, use git to derive the file-comment. This info includes + the sha1 hash, the time and the author of the change. Otherwise, + just use the supplied file-comment.") + (defun process-file-comment (form) (unless (and (= (length form) 2) (stringp (second form))) (compiler-error _N"Bad FILE-COMMENT form: ~S." form)) (let ((file (first (source-info-current-file *source-info*)))) (labels ((run-git (path) - (let ((cwd (default-directory)) - (new (make-pathname :directory (pathname-directory path)))) - (unwind-protect - (progn - ;; Cd to the directory containing the file so that - ;; git can find the git repo, if available. - (setf (default-directory) new) - ;; Run git to get the info. Don't signal any - ;; errors if we can't find git and discard any - ;; error messages from git. We only use the - ;; result if git returns a zero exit code, anyway. - (handler-case - (run-program "git" - (list "log" - "-1" - "--pretty=format:%h %ai %an" - (namestring path)) - :output :stream - :error nil) - (error () - nil))) - (setf (default-directory) cwd)))) + (when *file-comment-from-git* + (let ((cwd (default-directory)) + (new (make-pathname :directory (pathname-directory path)))) + (unwind-protect + (progn + ;; Cd to the directory containing the file so that + ;; git can find the git repo, if available. + (setf (default-directory) new) + ;; Run git to get the info. Don't signal any + ;; errors if we can't find git and discard any + ;; error messages from git. We only use the + ;; result if git returns a zero exit code, anyway. + (handler-case + (run-program "git" + (list "log" + "-1" + "--pretty=format:%h %ai %an" + (namestring path)) + :output :stream + :error nil) + (error () + nil))) + (setf (default-directory) cwd))))) (generate-comment (file-info) (let* ((name (pathname (source-info-stream file-info))) (proc (run-git name))