summaryrefslogtreecommitdiff
path: root/build.bash
diff options
context:
space:
mode:
authorJakob Unterwurzacher2017-03-05 17:44:14 +0100
committerJakob Unterwurzacher2017-03-05 17:44:14 +0100
commit966308eeb7793a4a8ca578e160981e3b059b82e6 (patch)
tree36b0b6d192b26b7c3addcd74bbc566a40736773c /build.bash
parente6461634422e7713d1863b416934297a8f6c4244 (diff)
Drop Go 1.4 compatability code everywhere
Yields a nice reduction in code size.
Diffstat (limited to 'build.bash')
-rwxr-xr-xbuild.bash13
1 files changed, 7 insertions, 6 deletions
diff --git a/build.bash b/build.bash
index e492f17..1cc266b 100755
--- a/build.bash
+++ b/build.bash
@@ -38,16 +38,17 @@ BUILDTIME=$(date +%s)
# Make sure we have the go binary
go version > /dev/null
-# Go 1.5 changed the CLI syntax. Let's also support 1.3 and 1.4.
-# "go version go1.6.2 linux/amd64" -> "1.6"
+# Parse "go version go1.6.2 linux/amd64" to "1.6"
V=$(go version | cut -d" " -f3 | cut -c3-5)
+# Reject old Go versions already here. It would fail with compile
+# errors anyway.
if [[ $V == "1.3" || $V == "1.4" ]] ; then
- LDFLAGS="-X main.GitVersion $GITVERSION -X main.GitVersionFuse $GITVERSIONFUSE -X main.BuildTime $BUILDTIME"
-else
- # Go 1.5+ wants an "=" here
- LDFLAGS="-X main.GitVersion=$GITVERSION -X main.GitVersionFuse=$GITVERSIONFUSE -X main.BuildTime=$BUILDTIME"
+ echo "Error: you need Go 1.5 or higher to compile gocryptfs"
+ echo -n "You have: "
+ go version
fi
+LDFLAGS="-X main.GitVersion=$GITVERSION -X main.GitVersionFuse=$GITVERSIONFUSE -X main.BuildTime=$BUILDTIME"
go build "-ldflags=$LDFLAGS" $@
(cd gocryptfs-xray; go build $@)