-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-all
executable file
·58 lines (46 loc) · 1.1 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
#!/bin/bash
set -e
set -x
FLAGS=(-ldflags '-s -w' -trimpath)
VERSION=$(go run pkg/version/version.go)
function build_for_amd64() {
OS=$1
shift
OUT=ayandict-$VERSION-$OS-x86_64
GOOS=$OS GOARCH=amd64 go build -o $OUT "${FLAGS[@]}" "$@"
echo $OUT
}
function build_for_windows_amd64() {
OUT=ayandict-$VERSION-windows-x86_64.exe
GOOS=windows GOARCH=amd64 go build -o $OUT "${FLAGS[@]}" "$@"
run_zip $OUT
}
function build_for_mac_arm64() {
OUT=ayandict-$VERSION-mac-arm64
GOOS=darwin GOARCH=arm64 go build -o $OUT "${FLAGS[@]}" "$@"
bzip2 -f $OUT
}
function build_for_mac_amd64() {
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_amd64 linux)
build_for_mac_arm64
build_for_mac_amd64
build_for_windows_amd64
#bzip2 -f $(build_for_amd64 freebsd)