2015-09-27 13:54:44 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
2015-11-01 15:35:01 +00:00
|
|
|
if ! test -e autogen/gen.go; then
|
|
|
|
echo >&2 'error: generate must be run before crossbinary'
|
2015-09-27 13:54:44 +00:00
|
|
|
false
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
# Remove windows platform because of
|
|
|
|
# https://github.com/mailgun/log/issues/10
|
|
|
|
OS_PLATFORM_ARG=(-os="darwin linux")
|
|
|
|
else
|
|
|
|
OS_PLATFORM_ARG=($1)
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$2" ]; then
|
|
|
|
OS_ARCH_ARG=(-arch="386 amd64 arm")
|
|
|
|
else
|
|
|
|
OS_ARCH_ARG=($2)
|
|
|
|
fi
|
|
|
|
|
2015-10-14 20:04:56 +00:00
|
|
|
if [ -z "$VERSION" ]; then
|
|
|
|
VERSION=$(git rev-parse HEAD)
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$DATE" ]; then
|
|
|
|
DATE=$(date -u '+%Y-%m-%d_%I:%M:%S%p')
|
|
|
|
fi
|
|
|
|
|
2015-09-27 13:54:44 +00:00
|
|
|
# Get rid of existing binaries
|
|
|
|
rm -f dist/traefik_*
|
|
|
|
|
|
|
|
# Build binaries
|
2015-10-14 20:04:56 +00:00
|
|
|
gox -ldflags "-X main.Version=$VERSION -X main.BuildDate=$DATE" "${OS_PLATFORM_ARG[@]}" "${OS_ARCH_ARG[@]}" \
|
2015-09-27 13:54:44 +00:00
|
|
|
-output="dist/traefik_{{.OS}}-{{.Arch}}"
|