diff options
author | Jakob Unterwurzacher | 2017-09-06 21:41:22 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2017-09-06 21:41:22 +0200 |
commit | 830cbb7218d61467c011fd5e9d4751e1529677e4 (patch) | |
tree | 72bd7cfc2a3c9ab4ddb0554006f666b0caaa7a8e /build.bash | |
parent | 512be8f081d2cc2afc778a2dcf5447647de2bbea (diff) |
build.bash: make reproduceable builds easier
* Reduce the build time precision from seconds to days
* Allow to specify an arbitrary build date through an
env variable
Diffstat (limited to 'build.bash')
-rwxr-xr-x | build.bash | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -1,4 +1,11 @@ #!/bin/bash +# +# Compile gocryptfs and bake the git version string of itself and the go-fuse +# library into the binary. +# +# If you want to fake a build date to reproduce a specific build, +# you can use: +# BUILDDATE=2017-02-03 ./build.bash set -eu @@ -24,13 +31,15 @@ fi GITVERSIONFUSE=$OUT cd "$MYDIR" -# Build Unix timestamp, something like 1467554204. -BUILDTIME=$(date +%s) +# Build date, something like "2017-09-06" +if [[ -z ${BUILDDATE:-} ]] ; then + BUILDDATE=$(date +%Y-%m-%d) +fi # Make sure we have the go binary go version > /dev/null -LDFLAGS="-X main.GitVersion=$GITVERSION -X main.GitVersionFuse=$GITVERSIONFUSE -X main.BuildTime=$BUILDTIME" +LDFLAGS="-X main.GitVersion=$GITVERSION -X main.GitVersionFuse=$GITVERSIONFUSE -X main.BuildDate=$BUILDDATE" go build "-ldflags=$LDFLAGS" $@ (cd gocryptfs-xray; go build $@) |