2015-09-15 19:38:54 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
2015-11-01 15:35:01 +00:00
|
|
|
if ! test -e autogen/gen.go; then
|
2015-09-15 19:38:54 +00:00
|
|
|
echo >&2 'error: generate must be run before binary'
|
|
|
|
false
|
|
|
|
fi
|
|
|
|
|
2015-09-27 13:54:44 +00:00
|
|
|
rm -f dist/traefik
|
2015-09-15 19:38:54 +00:00
|
|
|
|
2016-03-23 22:06:22 +00:00
|
|
|
FLAGS=""
|
|
|
|
if [ -n "$VERBOSE" ]; then
|
|
|
|
FLAGS="${FLAGS} -v"
|
|
|
|
fi
|
|
|
|
|
2015-10-14 20:04:56 +00:00
|
|
|
if [ -z "$VERSION" ]; then
|
|
|
|
VERSION=$(git rev-parse HEAD)
|
|
|
|
fi
|
2015-09-15 19:38:54 +00:00
|
|
|
|
2015-10-14 20:04:56 +00:00
|
|
|
if [ -z "$DATE" ]; then
|
|
|
|
DATE=$(date -u '+%Y-%m-%d_%I:%M:%S%p')
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Build binaries
|
2016-02-08 20:57:32 +00:00
|
|
|
CGO_ENABLED=0 GOGC=off go build $FLAGS -ldflags "-s -w -X main.Version=$VERSION -X main.BuildDate=$DATE" -a -installsuffix nocgo -o dist/traefik .
|