util/crossgcc: Add date to the toolchain revision

With the current version method, it's not possible to determine if
a different version is older or newer than the current version without
digging into the repository and finding the dates for the version
numbers.

This change adds the commit date to the start of the toolchain version
which will let us tell at a glance how old or new the toolchain is.

It's not perfect because multiple toolchain commits can go in on the
same day, but adding the time made the string even longer, and really
doesn't help that much.

Signed-off-by: Martin Roth <martin@coreboot.org>
Change-Id: I9c6d27667b922dc15e7a6e132e1beff69eed839c
Reviewed-on: https://review.coreboot.org/c/coreboot/+/48901
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Martin Roth 2020-12-21 15:49:33 -07:00 committed by Patrick Georgi
parent a2241de8e8
commit 7014f8258e
1 changed files with 6 additions and 7 deletions

View File

@ -16,8 +16,7 @@
cd "$(dirname "$0")" || exit 1
CROSSGCC_DATE="$(git log -n 1 --pretty=%ad --date=short .)"
CROSSGCC_VERSION="$(git log -n 1 --pretty=%h .)"
CROSSGCC_VERSION="$(git log -n 1 --pretty=%cd --date=short .)_$(git log -n 1 --pretty=%h .)"
CROSSGCC_COMMIT=$( git describe )
# default settings
@ -591,7 +590,7 @@ myhelp()
}
printversion() {
printf "${blue}Welcome to the ${red}coreboot${blue} cross toolchain builder v$CROSSGCC_VERSION ($CROSSGCC_DATE)${NC}\n\n"
printf "${blue}Welcome to the ${red}coreboot${blue} cross toolchain builder v$CROSSGCC_VERSION ${NC}\n\n"
}
myversion()
@ -728,7 +727,7 @@ bootstrap_GCC() {
${GCC_OPTIONS} --enable-languages="${LANGUAGES}" \
--with-gmp="$DESTDIR$TARGETDIR" --with-mpfr="$DESTDIR$TARGETDIR" \
--with-mpc="$DESTDIR$TARGETDIR" \
--with-pkgversion="coreboot bootstrap v$CROSSGCC_VERSION $CROSSGCC_DATE" \
--with-pkgversion="coreboot bootstrap v$CROSSGCC_VERSION" \
&& \
# shellcheck disable=SC2086
$MAKE $JOBS BOOT_CFLAGS="$HOSTCFLAGS" BUILD_CONFIG="" bootstrap && \
@ -774,7 +773,7 @@ build_cross_GCC() {
--with-gmp="$DESTDIR$TARGETDIR" --with-mpfr="$DESTDIR$TARGETDIR" \
--with-mpc="$DESTDIR$TARGETDIR" \
--with-gnu-as --with-gnu-ld \
--with-pkgversion="coreboot toolchain v$CROSSGCC_VERSION $CROSSGCC_DATE" \
--with-pkgversion="coreboot toolchain v$CROSSGCC_VERSION" \
&& \
mkdir -p gcc/$TARGETARCH && \
rm -f "gcc/$TARGETARCH/$GCC_VERSION" && \
@ -843,7 +842,7 @@ build_IASL() {
test "$UNAME" = "FreeBSD" && HOST="_FreeBSD"
test "$UNAME" = "Cygwin" && HOST="_CYGWIN"
HOST="$HOST" CFLAGS="$CFLAGS" \
OPT_CFLAGS="-O -D_FORTIFY_SOURCE=2 -D COREBOOT_TOOLCHAIN_VERSION='\"coreboot toolchain v$CROSSGCC_VERSION $CROSSGCC_DATE\"' " \
OPT_CFLAGS="-O -D_FORTIFY_SOURCE=2 -D COREBOOT_TOOLCHAIN_VERSION='\"coreboot toolchain v$CROSSGCC_VERSION\"' " \
$MAKE $JOBS CC="$(hostcc host)" iasl acpibin acpidump acpiexec acpihelp acpisrc acpixtract
rm -f "$DESTDIR$TARGETDIR/bin/{iasl,acpibin,acpidump,acpiexec,acpihelp,acpisrc,acpixtract}" || touch "$RDIR/.failed"
cp bin/{iasl,acpibin,acpidump,acpiexec,acpihelp,acpisrc,acpixtract} "$DESTDIR$TARGETDIR/bin" || touch "$RDIR/.failed"
@ -858,7 +857,7 @@ build_LLVM() {
cd - || exit 1
$CMAKE -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$DESTDIR$TARGETDIR" \
-DCLANG_VENDOR="coreboot toolchain v$CROSSGCC_VERSION $CROSSGCC_DATE - " \
-DCLANG_VENDOR="coreboot toolchain v$CROSSGCC_VERSION - " \
-DCMAKE_BUILD_TYPE=Release ../$LLVM_DIR || touch .failed
# shellcheck disable=SC2086
$MAKE $JOBS || touch .failed