-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.sh
executable file
·63 lines (57 loc) · 1.89 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
BUILD_DIR=$(dirname "$0")/build/releases
rm -rf $BUILD_DIR
mkdir -p $BUILD_DIR
sum="sha256sum"
VERSION=$(git describe --tags --always --dirty)
# AMD64
OSES=(linux darwin windows freebsd)
for os in ${OSES[@]}; do
suffix=""
if [ "$os" == "windows" ]
then
suffix=".exe"
fi
env GOOS=$os GOARCH=amd64 go build -o $BUILD_DIR/azukiiro_${os}_amd64${suffix}
tar -zcf $BUILD_DIR/azukiiro-${os}-amd64-$VERSION.tar.gz $BUILD_DIR/azukiiro_${os}_amd64${suffix}
rm $BUILD_DIR/azukiiro_${os}_amd64${suffix}
HASH=$($sum $BUILD_DIR/azukiiro-${os}-amd64-$VERSION.tar.gz)
echo "$HASH" >> $BUILD_DIR/azukiiro-$VERSION.sha256
done
# 386
OSES=(linux windows)
for os in ${OSES[@]}; do
suffix=""
if [ "$os" == "windows" ]
then
suffix=".exe"
fi
env GOOS=$os GOARCH=386 go build -o $BUILD_DIR/azukiiro_${os}_386${suffix}
tar -zcf $BUILD_DIR/azukiiro-${os}-386-$VERSION.tar.gz $BUILD_DIR/azukiiro_${os}_386${suffix}
rm $BUILD_DIR/azukiiro_${os}_386${suffix}
HASH=$($sum $BUILD_DIR/azukiiro-${os}-386-$VERSION.tar.gz)
echo "$HASH" >> $BUILD_DIR/azukiiro-$VERSION.sha256
done
# ARM
ARMS=(5 6 7)
for v in ${ARMS[@]}; do
env GOOS=linux GOARCH=arm GOARM=$v go build -o $BUILD_DIR/azukiiro_linux_arm$v
tar -zcf $BUILD_DIR/azukiiro-linux-arm$v-$VERSION.tar.gz $BUILD_DIR/azukiiro_linux_arm$v
rm $BUILD_DIR/azukiiro_linux_arm$v
HASH=$($sum $BUILD_DIR/azukiiro-linux-arm$v-$VERSION.tar.gz)
echo "$HASH" >> $BUILD_DIR/azukiiro-$VERSION.sha256
done
# ARM64
OSES=(linux darwin windows)
for os in ${OSES[@]}; do
suffix=""
if [ "$os" == "windows" ]
then
suffix=".exe"
fi
env GOOS=$os GOARCH=arm64 go build -o $BUILD_DIR/azukiiro_${os}_arm64${suffix}
tar -zcf $BUILD_DIR/azukiiro-${os}-arm64-$VERSION.tar.gz $BUILD_DIR/azukiiro_${os}_arm64${suffix}
rm $BUILD_DIR/azukiiro_${os}_arm64${suffix}
HASH=$($sum $BUILD_DIR/azukiiro-${os}-arm64-$VERSION.tar.gz)
echo "$HASH" >> $BUILD_DIR/azukiiro-$VERSION.sha256
done