forked from volcengine/terraform-provider-volcengine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_scm.sh
55 lines (53 loc) · 1.6 KB
/
build_scm.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
#!/bin/bash
mkdir -p output
go mod tidy
SUPPORT_GOOS=("freebsd" "darwin" "linux" "windows")
BSD_SUPPORT_GOARCH=("386" "amd64" "arm64" "arm")
LINUX_SUPPORT_GOARCH=("386" "amd64" "arm64" "arm")
MAC_SUPPORT_GOARCH=("amd64" "arm64")
WIN_SUPPORT_GOARCH=("386" "amd64")
NAME="terraform-provider-volcengine"
set -ea
for goos in "${SUPPORT_GOOS[@]}"
do
if [ "$goos" == "freebsd" ]
then
for goarch in "${BSD_SUPPORT_GOARCH[@]}"
do
echo "build $goos/$goarch/$NAME"
CGO_ENABLED=0 GOOS=$goos GOARCH=$goarch go build -o $NAME
mkdir -p output/"$goos"/"$goarch"
mv "$NAME" output/"$goos"/"$goarch"/"$NAME"
done
fi
if [ "$goos" == "darwin" ]
then
for goarch in "${MAC_SUPPORT_GOARCH[@]}"
do
echo "build $goos/$goarch/$NAME"
CGO_ENABLED=0 GOOS=$goos GOARCH=$goarch go build -o $NAME
mkdir -p output/"$goos"/"$goarch"
mv "$NAME" output/"$goos"/"$goarch"/"$NAME"
done
fi
if [ "$goos" == "linux" ]
then
for goarch in "${LINUX_SUPPORT_GOARCH[@]}"
do
echo "build $goos/$goarch/$NAME"
CGO_ENABLED=0 GOOS=$goos GOARCH=$goarch go build -o $NAME
mkdir -p output/"$goos"/"$goarch"
mv "$NAME" output/"$goos"/"$goarch"/"$NAME"
done
fi
if [ "$goos" == "windows" ]
then
for goarch in "${WIN_SUPPORT_GOARCH[@]}"
do
echo "build $goos/$goarch/$NAME"
CGO_ENABLED=0 GOOS=$goos GOARCH=$goarch go build -o $NAME
mkdir -p output/"$goos"/"$goarch"
mv "$NAME" output/"$goos"/"$goarch"/"$NAME"
done
fi
done