From 47015433cc41d0b98c1bbd926b871a15d927d9de Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Sun, 27 Sep 2015 15:54:44 +0200 Subject: [PATCH] Split binary into 2 - binary (simple traefik build) - crossbinary, cross build using gox Signed-off-by: Vincent Demeester --- script/binary | 19 +------------------ script/crossbinary | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 18 deletions(-) create mode 100755 script/crossbinary diff --git a/script/binary b/script/binary index 60503e089..89d2dacf4 100755 --- a/script/binary +++ b/script/binary @@ -6,26 +6,9 @@ if ! test -e gen.go; then 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 - -# Get rid of existing binaries -rm -f dist/traefik* +rm -f dist/traefik rm -rf Godeps/_workspace/pkg # Build binaries CGO_ENABLED=0 godep go build -a -installsuffix nocgo -o dist/traefik . -GOPATH=`godep path`:$GOPATH gox "${OS_PLATFORM_ARG[@]}" "${OS_ARCH_ARG[@]}" \ - -output="dist/traefik_{{.OS}}-{{.Arch}}" diff --git a/script/crossbinary b/script/crossbinary new file mode 100755 index 000000000..5c82b1fd8 --- /dev/null +++ b/script/crossbinary @@ -0,0 +1,30 @@ +#!/bin/bash +set -e + +if ! test -e gen.go; then + echo >&2 'error: generate must be run before binary' + 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 + +# Get rid of existing binaries +rm -f dist/traefik_* +rm -rf Godeps/_workspace/pkg + +# Build binaries +GOPATH=`godep path`:$GOPATH gox "${OS_PLATFORM_ARG[@]}" "${OS_ARCH_ARG[@]}" \ + -output="dist/traefik_{{.OS}}-{{.Arch}}" +