-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.sh
executable file
·48 lines (41 loc) · 918 Bytes
/
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
#!/usr/bin/env bash
set -euo pipefail -o posix
cd "$(dirname "$0")"
# List all possible platforms
# NOTE: Not all of these combinations have been tested - this are just a list of
# combinations where a build is possible
platforms=(
darwin/386
darwin/amd64
freebsd/386
freebsd/amd64
freebsd/arm
linux/386
linux/amd64
linux/arm
linux/arm64
linux/ppc64
linux/ppc64le
linux/mips
linux/mipsle
linux/mips64
linux/mips64le
linux/s390x
)
targetDir=dist
mkdir -p "$targetDir"
packageName="kubefs"
package="."
for platform in "${platforms[@]}"
do
platform_split=(${platform//\// })
export GOOS=${platform_split[0]}
export GOARCH=${platform_split[1]}
out="$targetDir/$packageName-$GOOS-$GOARCH"
if [ $GOOS = "windows" ]; then
out+='.exe'
fi
echo "Building for $platform..."
go build -o "$out" "$package"
echo
done