forked from cyfdecyf/cow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·58 lines (51 loc) · 1.34 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
#!/bin/bash
cd "$( dirname "${BASH_SOURCE[0]}" )/.."
version=`grep '^version=' ./install-cow.sh | sed -s 's/version=//'`
echo "creating cow binary version $version"
mkdir -p bin
build() {
local name
local goos
local goarch
local goarm
local cgo
local armv
goos="GOOS=$1"
goarch="GOARCH=$2"
arch=$3
if [[ $2 == "arm" ]]; then
armv=`echo $arch | grep -o [0-9]`
goarm="GOARM=$armv"
fi
if [[ $1 == "darwin" ]]; then
# Enable CGO for OS X so change network location will not cause problem.
cgo="CGO_ENABLED=1"
else
cgo="CGO_ENABLED=0"
fi
name=cow-$arch-$version
echo "building $name"
echo $cgo $goos $goarch $goarm go build
eval $cgo $goos $goarch $goarm go build || exit 1
if [[ $1 == "windows" ]]; then
mv cow.exe script
pushd script
sed -e 's/$/\r/' ../doc/sample-config/rc > rc.txt
zip $name.zip cow.exe cow-taskbar.exe cow-hide.exe rc.txt
rm -f cow.exe rc.txt
mv $name.zip ../bin/
popd
else
mv cow bin/$name
gzip -f bin/$name
fi
}
build darwin amd64 mac64
#build darwin 386 mac32
build linux amd64 linux64
build linux 386 linux32
build linux arm linux-armv5tel
build linux arm linux-armv6l
build linux arm linux-armv7l
build windows amd64 win64
build windows 386 win32