Skip to content

Commit 88cf1a1

Browse files
committed
Simplify build script
1 parent 12672c4 commit 88cf1a1

File tree

1 file changed

+39
-36
lines changed

1 file changed

+39
-36
lines changed

bin/build-all

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,48 +5,51 @@ set -e -x
55
echo "Creating release dir..."
66
mkdir -p release
77

8-
EXECUTABLE_NAME="exercism"
9-
10-
PLATFORMS="darwin/386 darwin/amd64 linux/386 linux/amd64 windows/386 windows/amd64 linux/arm"
11-
12-
function build-architecture {
13-
GOOS=${1%/*}
14-
GOARCH=${1#*/}
15-
GOARM=""
8+
echo "Creating darwin/386 binary..."
9+
GOOS=darwin GOARCH=386 go build -o out/exercism
10+
cd out
11+
tar cvzf ../release/exercism-mac-32bit.tgz exercism
12+
cd ..
1613

17-
if [ $GOARCH == "arm" ]; then
18-
GOARM=5
19-
fi
14+
echo "Creating darwin/amd64 binary..."
15+
GOOS=darwin GOARCH=amd64 go build -o out/exercism
16+
cd out
17+
tar cvzf ../release/exercism-mac-64bit.tgz exercism
18+
cd ..
2019

21-
echo "Creating $GOOS $GOARCH binary..."
20+
echo "Creating linux/386 binary..."
21+
GOOS=linux GOARCH=386 go build -o out/exercism
22+
cd out
23+
tar cvzf ../release/exercism-linux-32bit.tgz exercism
24+
cd ..
2225

23-
GOOS=$GOOS GOARCH=$GOARCH GOARM=$GOARM "$(dirname $0)/build"
26+
echo "Creating linux/amd64 binary..."
27+
GOOS=linux GOARCH=amd64 go build -o out/exercism
28+
cd out
29+
tar cvzf ../release/exercism-linux-64bit.tgz exercism
30+
cd ..
2431

25-
NAME=$GOOS
26-
if [ $NAME == "darwin" ]; then
27-
NAME="mac"
28-
fi
29-
ARCH="32bit"
30-
if [ $GOARCH == "amd64" ]; then
31-
ARCH="64bit"
32-
fi
33-
if [ $GOARCH == "arm" ]; then
34-
ARCH="arm-v5"
35-
fi
32+
echo "Creating linux/ARMv5 binary..."
33+
GOOS=linux GOARCH=arm GOARM=5 go build -o out/exercism
34+
cd out
35+
tar cvzf ../release/exercism-linux-arm-v5.tgz exercism
36+
cd ..
3637

38+
echo "Creating linux/ARMv6 binary..."
39+
GOOS=linux GOARCH=arm GOARM=6 go build -o out/exercism
3740
cd out
38-
ls
41+
tar cvzf ../release/exercism-linux-arm-v6.tgz exercism
42+
cd ..
3943

40-
if [ $GOOS == windows ]; then
41-
mv $EXECUTABLE_NAME $EXECUTABLE_NAME.exe
42-
zip ../release/$EXECUTABLE_NAME-$NAME-$ARCH.zip $EXECUTABLE_NAME.exe
43-
else
44-
tar cvzf ../release/$EXECUTABLE_NAME-$NAME-$ARCH.tgz $EXECUTABLE_NAME
45-
fi
44+
echo "Creating windows/386 binary..."
45+
GOOS=windows GOARCH=386 go build -o out/exercism.exe
46+
cd out
47+
zip ../release/exercism-windows-32bit.zip exercism.exe
48+
cd ..
4649

47-
cd ..
48-
}
50+
echo "Creating windows/amd64 binary..."
51+
GOOS=windows GOARCH=amd64 go build -o out/exercism.exe
52+
cd out
53+
zip ../release/exercism-windows-64bit.zip exercism.exe
54+
cd ..
4955

50-
for PLATFORM in $PLATFORMS; do
51-
build-architecture $PLATFORM
52-
done

0 commit comments

Comments
 (0)