summaryrefslogtreecommitdiff
path: root/util/genbuild_h
diff options
context:
space:
mode:
authorIdwer Vollering <vidwer@gmail.com>2015-03-27 00:15:20 +0100
committerIdwer Vollering <vidwer@gmail.com>2015-03-29 22:45:08 +0200
commitb5589026c7eba0a0aef880e57d10f7134ab1837b (patch)
tree5e11d101635e698e81cbd3a9947ab7bb9e8b5417 /util/genbuild_h
parent00d48464b9d6b93680da686de02121ffd7d65ba2 (diff)
downloadcoreboot-b5589026c7eba0a0aef880e57d10f7134ab1837b.tar.xz
util/genbuild_h: work around GNU date
Confirmed to work on FreeBSD using sh from base and bash from ports. Verified to not break M.O. on Linux. Change-Id: I3bce724c889c7fb760b30b25e9fc0b74620e2c53 Signed-off-by: Idwer Vollering <vidwer@gmail.com> Reviewed-on: http://review.coreboot.org/9056 Tested-by: build bot (Jenkins) Reviewed-by: Alexander Couzens <lynxis@fe80.eu> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'util/genbuild_h')
-rwxr-xr-xutil/genbuild_h/genbuild_h.sh24
1 files changed, 17 insertions, 7 deletions
diff --git a/util/genbuild_h/genbuild_h.sh b/util/genbuild_h/genbuild_h.sh
index b161dffcaf..55a3b858fa 100755
--- a/util/genbuild_h/genbuild_h.sh
+++ b/util/genbuild_h/genbuild_h.sh
@@ -31,6 +31,16 @@ else
DATE=$(date +%s)
fi
+our_date() {
+case $(uname) in
+NetBSD|OpenBSD|DragonFly|FreeBSD)
+ TZ=UTC date -r $1 $2
+ ;;
+*)
+ TZ=UTC date -d @$1 $2
+esac
+}
+
#Print out the information that goes into build.h
printf "/* build system definitions (autogenerated) */\n"
printf "#ifndef __BUILD_H\n"
@@ -43,12 +53,12 @@ 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 \"%s\"\n" "$(LANG= TZ=UTC date -d @$DATE)"
-printf "#define COREBOOT_BUILD_YEAR_BCD 0x%s\n" "$(TZ=UTC date -d @$DATE +%y)"
-printf "#define COREBOOT_BUILD_MONTH_BCD 0x%s\n" "$(TZ=UTC date -d @$DATE +%m)"
-printf "#define COREBOOT_BUILD_DAY_BCD 0x%s\n" "$(TZ=UTC date -d @$DATE +%d)"
-printf "#define COREBOOT_BUILD_WEEKDAY_BCD 0x%s\n" "$(TZ=UTC date -d @$DATE +%w)"
-printf "#define COREBOOT_DMI_DATE \"%s\"\n" "$(TZ=UTC date -d @$DATE +%m/%d/%Y)"
+printf "#define COREBOOT_BUILD \"$(LANG= 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"
+printf "#define COREBOOT_BUILD_WEEKDAY_BCD 0x$(our_date "$DATE" +%w)\n"
+printf "#define COREBOOT_DMI_DATE \"$(our_date "$DATE" +%m/%d/%Y)\"\n"
printf "\n"
-printf "#define COREBOOT_COMPILE_TIME \"%s\"\n" "$(TZ=UTC date -d @$DATE +%T)"
+printf "#define COREBOOT_COMPILE_TIME \"$(our_date "$DATE" +%T)\"\n"
printf "#endif\n"