-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-all
executable file
·67 lines (55 loc) · 1.28 KB
/
build-all
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
64
65
66
#!/bin/bash
set -e
set -x
FLAGS=(-ldflags '-s -w' -trimpath)
VERSION=$(go run pkg/version/version.go)
function build_for_os64() {
OS=$1
shift
OUT=ayandict-$VERSION-$OS-x86_64
GOOS=$OS GOARCH=amd64 go build -o $OUT "${FLAGS[@]}" "$@"
echo $OUT
}
function build_for_os32() {
OS=$1
shift
OUT=ayandict-$VERSION-$OS-x86
GOOS=$OS GOARCH=386 go build -o $OUT "${FLAGS[@]}" "$@"
echo $OUT
}
function build_for_win64() {
OUT=ayandict-$VERSION-windows-x86_64.exe
GOOS=windows GOARCH=amd64 go build -o $OUT "${FLAGS[@]}" "$@"
run_zip $OUT
}
function build_for_win32() {
OUT=ayandict-$VERSION-windows-x86.exe
GOOS=windows GOARCH=386 go build -o $OUT "${FLAGS[@]}" "$@"
run_zip $OUT
}
function build_for_mac() {
OUT=ayandict-$VERSION-mac-x86_64
GOOS=darwin GOARCH=amd64 go build -o $OUT "${FLAGS[@]}" "$@"
bzip2 -f $OUT
}
function run_zip() {
IN_PATH=$1
ZIP_PATH="${IN_PATH%.*}.zip"
if [ -f C:\\Windows\\System32\\tar.exe ] ; then
C:\\Windows\\System32\\tar.exe -a -c -f $ZIP_PATH $IN_PATH
rm $IN_PATH
return
fi
if which zip ; then
zip $ZIP_PATH $IN_PATH
rm $IN_PATH
return
fi
}
bzip2 -f $(build_for_os64 linux)
bzip2 -f $(build_for_os32 linux)
build_for_win64
build_for_win32 -tags nosql
bzip2 -f $(build_for_os64 freebsd)
bzip2 -f $(build_for_os32 freebsd)
build_for_mac