| 1 |
#!/bin/bash |
| 2 |
if [ -z "$JP_VERSION" ] |
| 3 |
then |
| 4 |
echo "Must set JP_VERSION env var" 1>&2 |
| 5 |
exit 1 |
| 6 |
fi |
| 7 |
go get ./... |
| 8 |
rm -rf ./build/jp-* |
| 9 |
# All builds for 386/amd64. |
| 10 |
for goos in darwin linux windows freebsd; do |
| 11 |
export GOOS="$goos" |
| 12 |
for goarch in 386 amd64; do |
| 13 |
export GOARCH="$goarch" |
| 14 |
echo "Building for $GOOS/$GOARCH" |
| 15 |
go build -v -o build/jp-$GOOS-$GOARCH 2>/dev/null |
| 16 |
done |
| 17 |
done |
| 18 |
# Now handle ARM builds. |
| 19 |
# First handle 32bit builds separately |
| 20 |
export GOARCH=arm |
| 21 |
export GOARM=7 |
| 22 |
export GOOS=linux |
| 23 |
echo "Building for $GOOS/$GOARCH/$GOARM" |
| 24 |
go build -v -o build/jp-$GOOS-$GOARCH-arm$GOARM 2> /dev/null |
| 25 |
# Now handled supported ARM64 builds. |
| 26 |
export GOARCH=arm64 |
| 27 |
for goos in linux darwin; do |
| 28 |
export GOOS="$goos" |
| 29 |
echo "Building for $GOOS/$GOARCH" |
| 30 |
go build -v -o build/jp-$GOOS-$GOARCH 2>/dev/null |
| 31 |
done |
| 32 |
# And finally we'll create a .tar.gz version for homebrew users. |
| 33 |
# We'll neend to figure out how to deal with M1 macbooks in the future. |
| 34 |
cp build/jp-darwin-amd64 build/jp |
| 35 |
cd build |
| 36 |
tar cvfz jp-$JP_VERSION.tar.gz jp |
| 37 |
rm jp |
| 38 |
cd .. |