-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
63 lines (62 loc) · 1.45 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
59
60
61
62
#!/bin/bash
rename_binary() {
outpname=$(basename "$1" .go)
if [[ -n $compiler ]]; then
mv "$outpname" "$outpname"_"$compiler"
exit
fi
if [[ -f $outpname ]]; then
if [[ -n $GOARM ]]; then
mv "$outpname" "$outpname"_"$GOOS"_"$GOARCH"_"$GOARM"
else
mv "$outpname" "$outpname"_"$GOOS"_"$GOARCH"
fi
else
mv "$outpname".exe "$outpname"_"$GOOS"_"$GOARCH".exe
fi
}
# if [[ -z $all ]]; then
# git submodule init && git submodule update --recursive
# fi
build_os() {
# pushd pkg/lspr || exit
# if [[ -n $web ]]; then
# bash build.sh -w
# else
# bash build.sh
# fi
# popd || exit
go build -o lspvi-$GOOS
ls .
}
build_win_x64() {
CXX=x86_64-w64-mingw32-g++ CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -o lspvi-window-x64
}
# export GOARCH=amd64
export CGO_ENABLED=0
if [[ -n $mac ]]; then
export GOOS=darwin
build_os
fi
if [[ -n $win ]]; then
sss=$(which x86_64-w64-mingw32-gcc)
if [[ -z $sss ]];then
sudo apt-get update
sudo apt-get install gcc-mingw-w64
# For just the 64-bit compiler
sudo apt-get install gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64
# For just the 32-bit compiler
sudo apt-get install gcc-mingw-w64-i686 g++-mingw-w64-i686
fi
# sudo apt-get install x86_64-w64-mingw32-g++
build_win_x64
fi
if [[ -n $linux ]]; then
export GOOS=linux
build_os
fi
if [[ -n $all ]]; then
GOOS=linux build_os
GOOS=darwin build_os
build_win_x64
fi