genbuild_h: refactor environment variable into export's

Change-Id: Ife3fb0c86fbd065fe9957bbc79b4dd1391f930b2
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
Reviewed-on: http://review.coreboot.org/10448
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Alexander Couzens 2015-06-07 02:07:34 +02:00 committed by Patrick Georgi
parent 999ed64ac5
commit 4dc1197ba3
1 changed files with 7 additions and 3 deletions

View File

@ -21,6 +21,10 @@
DATE=""
GITREV=""
TIMESOURCE=""
export LANG=C
export TZ=UTC
if [ -d "${top}/.git" ] && [ -f "$(command -v git)" ]; then
GITREV=$(LANG= git log remotes/origin/master -1 --format=format:%h)
TIMESOURCE=git
@ -34,10 +38,10 @@ fi
our_date() {
case $(uname) in
NetBSD|OpenBSD|DragonFly|FreeBSD)
TZ=UTC date -r $1 $2
date -r $1 $2
;;
*)
TZ=UTC date -d @$1 $2
date -d @$1 $2
esac
}
@ -53,7 +57,7 @@ printf "#define COREBOOT_VERSION_TIMESTAMP $DATE\n"
printf "#define COREBOOT_ORIGIN_GIT_REVISION \"$GITREV\"\n"
printf "#define COREBOOT_EXTRA_VERSION \"%s\"\n" "$COREBOOT_EXTRA_VERSION"
printf "#define COREBOOT_BUILD \"$(LANG= our_date "$DATE")\"\n"
printf "#define COREBOOT_BUILD \"$(our_date "$DATE")\"\n"
printf "#define COREBOOT_BUILD_YEAR_BCD 0x$(our_date "$DATE" +%y)\n"
printf "#define COREBOOT_BUILD_MONTH_BCD 0x$(our_date "$DATE" +%m)\n"
printf "#define COREBOOT_BUILD_DAY_BCD 0x$(our_date "$DATE" +%d)\n"