diff options
| author | Petter Rasmussen | 2013-01-01 20:48:15 +0100 |
|---|---|---|
| committer | Petter Rasmussen | 2013-01-01 20:48:15 +0100 |
| commit | 2f4fabf7bb74b42a7aa54c5b02538e4ca337361f (patch) | |
| tree | db087fb26d0e97ab494f8f8684dc0441630efb75 /build-all.sh | |
| download | gdrive-2f4fabf7bb74b42a7aa54c5b02538e4ca337361f.tar.bz2 | |
version 1
Diffstat (limited to 'build-all.sh')
| -rwxr-xr-x | build-all.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/build-all.sh b/build-all.sh new file mode 100755 index 0000000..5170bdd --- /dev/null +++ b/build-all.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +if [ -z "$1" ]; then + echo "Usage: $0 <app>" + exit 1 +fi + +PLATFORMS="darwin/386 darwin/amd64 freebsd/386 freebsd/amd64 linux/386 linux/amd64 linux/arm windows/386 windows/amd64" +APP_NAME=$1 + +# Remove old binaries +rm bin/* + +# Load crosscompile environment +source /Users/pii/scripts/golang-crosscompile/crosscompile.bash + +# Build binary for each platform in parallel +for PLATFORM in $PLATFORMS; do + GOOS=${PLATFORM%/*} + GOARCH=${PLATFORM#*/} + BIN_NAME="${APP_NAME}-$GOOS-$GOARCH" + + if [ $GOOS == "windows" ]; then + BIN_NAME="${BIN_NAME}.exe" + fi + + BUILD_CMD="go-${GOOS}-${GOARCH} build -o bin/${BIN_NAME} $APP_NAME.go" + + echo "Building $APP_NAME for ${GOOS}/${GOARCH}..." + $BUILD_CMD & +done + +# Wait for builds to complete +for job in $(jobs -p); do + wait $job +done + +echo "All done" |
