traefik/script/crossbinary
Vincent Demeester de0a57ec76 Refactor traefik with package
Split a bit traefik into package. The idea behind this refactor is to
start move inter-dependencies away and do some DRY or SRP.

- Adds a `provider` package, with providers except `web.go`
- Adds a `types` package with common struct.
- Move `gen.go` to an `autogen` package

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2015-11-02 18:35:55 +01:00

36 lines
760 B
Bash
Executable file

#!/bin/bash
set -e
if ! test -e autogen/gen.go; then
echo >&2 'error: generate must be run before crossbinary'
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
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
# Get rid of existing binaries
rm -f dist/traefik_*
# Build binaries
gox -ldflags "-X main.Version=$VERSION -X main.BuildDate=$DATE" "${OS_PLATFORM_ARG[@]}" "${OS_ARCH_ARG[@]}" \
-output="dist/traefik_{{.OS}}-{{.Arch}}"