forked from anton-becker/network-list-parser
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild-for-all.sh
executable file
·63 lines (59 loc) · 1.11 KB
/
build-for-all.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
#!/usr/bin/env bash
TARGETS=" \
darwin/386 \
darwin/amd64 \
dragonfly/amd64 \
freebsd/386 \
freebsd/amd64 \
freebsd/arm \
linux/386 \
linux/amd64 \
linux/arm \
linux/arm64 \
linux/mips \
linux/mips64 \
linux/mips64le \
linux/mipsle \
linux/ppc64 \
linux/ppc64le \
linux/s390x \
nacl/386 \
nacl/amd64p32 \
nacl/arm \
netbsd/386 \
netbsd/amd64 \
netbsd/arm \
openbsd/386 \
openbsd/amd64 \
openbsd/arm \
plan9/386 \
plan9/amd64 \
plan9/arm \
solaris/amd64 \
windows/386/.exe \
windows/amd64/.exe \
"
INVALID_TARGETS=" \
android/386 \
android/amd64 \
android/arm \
android/arm64 \
darwin/arm \
darwin/arm64 \
"
N=network-list-parser
PKG=github.com/unsacrificed/network-list-parser
GO_PATH=`go env GOPATH`
VERSION_FILE="${GO_PATH}/src/${PKG}/doc.go"
VERSION=`cat "${VERSION_FILE}" | grep "const version =" | cut -d "\"" -f 2`
for TARGET in ${TARGETS} ; do
IFS='/' read -a ARR <<< "${TARGET}"
GOOS=${ARR[0]}
GOARCH=${ARR[1]}
EXT=${ARR[2]}
if [[ -z "${EXT}" ]] ; then
EXT=".bin"
fi
echo $GOOS $GOARCH
GOOS=${GOOS} GOARCH=${GOARCH} go build -o ${N}-${GOOS}-${GOARCH}-${VERSION}${EXT} ${PKG}
done