Skip to content

Commit

Permalink
Add binary build script
Browse files Browse the repository at this point in the history
  • Loading branch information
chrissnell committed Nov 30, 2016
1 parent 632be2d commit bed4b45
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions dist/build-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

TAG=`git describe --tag --abbrev=0`

platforms=( darwin linux freebsd windows openbsd )

programs=( crabby )

for prog in "${programs[@]}"
do
PROG_WITH_TAG=${prog}-${TAG}
echo "--> Building ${prog}"
for plat in "${platforms[@]}"
do
echo "----> Building for ${plat}/amd64"
if [ "$plat" = "windows" ]; then
GOOS=$plat GOARCH=amd64 go build -o ${PROG_WITH_TAG}-win64.exe
echo "Compressing..."
zip -9 ${PROG_WITH_TAG}-win64.zip ${PROG_WITH_TAG}-win64.exe
mv ${PROG_WITH_TAG}-win64.zip /binaries/${prog}/
rm ${PROG_WITH_TAG}-win64.exe
else
OUT="${PROG_WITH_TAG}-${plat}-amd64"
GOOS=$plat GOARCH=amd64 go build -o $OUT
echo "Compressing..."
gzip -f $OUT
mv ${OUT}.gz /binaries/${prog}/
fi
done

# Build Linux/ARM
echo "----> Building for linux/arm"
OUT="${PROG_WITH_TAG}-linux-arm"
GOOS=linux GOARCH=arm go build -o $OUT
echo "Compressing..."
gzip -f $OUT
mv ${OUT}.gz /binaries/${prog}/
done

0 comments on commit bed4b45

Please sign in to comment.