-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
123 lines (106 loc) · 3.24 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name="StaticDeployment"
pname="StaticDeployment"
version="1.0.0"
rm -rf bin
mkdir -p bin
cp README.md bin/
cp ${name}.desktop bin/
export CGO_ENABLED=0
export GOOS=windows
echo "Compiling Windows x86"
export GOARCH=386
go generate
mkdir -p "bin/${pname}_windows-x86"
go build -o "bin/${pname}_windows-x86/${name}.exe"
cp README.md "bin/${pname}_windows-x86/"
rm -f *.syso
echo "Compiling Windows x64"
export GOARCH=amd64
go generate
mkdir -p "bin/${pname}_windows-x64"
go build -o "bin/${pname}_windows-x64/${name}.exe"
cp README.md "bin/${pname}_windows-x64/"
rm -f *.syso
echo "Compiling Windows ARM32"
export GOARCH=arm
go generate
mkdir -p "bin/${pname}_windows-arm32"
go build -o "bin/${pname}_windows-arm32/${name}.exe"
cp README.md "bin/${pname}_windows-arm32/"
rm -f *.syso
echo "Compiling Windows ARM64"
export GOARCH=arm64
go generate
mkdir -p "bin/${pname}_windows-arm64"
go build -o "bin/${pname}_windows-arm64/${name}.exe"
cp README.md "bin/${pname}_windows-arm64/"
rm -f *.syso
export GOOS=darwin
mkdir -p "bin/${name}.app"
mkdir -p "bin/${name}.app/Contents"
cp Info.plist "bin/${name}.app/Contents"
mkdir -p "bin/${name}.app/Contents/Resources"
cp ico/icon.icns "bin/${name}.app/Contents/Resources"
mkdir -p "bin/${name}.app/Contents/MacOS"
mkdir -p "bin/${pname}_macos-x64"
cp -R "bin/${name}.app" "bin/${pname}_macos-x64/${name}.app"
mkdir -p "bin/${pname}_macos-arm64"
cp -R "bin/${name}.app" "bin/${pname}_macos-arm64/${name}.app"
rm -rf "bin/${name}.app"
echo "Compiling macOS x64"
export GOARCH=amd64
go build -o "bin/${pname}_macos-x64/${name}"
cp README.md "bin/${pname}_macos-x64/"
cp "bin/${pname}_macos-x64/${name}" "bin/${pname}_macos-x64/${name}.app/Contents/MacOS/"
echo "Compiling macOS ARM64"
export GOARCH=arm64
go build -o "bin/${pname}_macos-arm64/${name}"
cp README.md "bin/${pname}_macos-arm64/"
cp "bin/${pname}_macos-arm64/${name}" "bin/${pname}_macos-arm64/${name}.app/Contents/MacOS/"
export GOOS=linux
echo "Compiling Linux x86"
export GOARCH=386
mkdir -p "bin/${pname}_linux-x86"
go build -o "bin/${pname}_linux-x86/${name}"
cp README.md "bin/${pname}_linux-x86/"
cp ico/icon.png "bin/${pname}_linux-x86/${name}.png"
cp "${name}.desktop" "bin/${pname}_linux-x86/"
echo "Compiling Linux x64"
export GOARCH=amd64
mkdir -p "bin/${pname}_linux-x64"
go build -o "bin/${pname}_linux-x64/${name}"
cp README.md "bin/${pname}_linux-x64/"
cp ico/icon.png "bin/${pname}_linux-x64/${name}.png"
cp "${name}.desktop" "bin/${pname}_linux-x64/"
echo "Compiling Linux ARM32"
export GOARCH=arm
mkdir -p "bin/${pname}_linux-arm32"
go build -o "bin/${pname}_linux-arm32/${name}"
cp README.md "bin/${pname}_linux-arm32/"
cp ico/icon.png "bin/${pname}_linux-arm32/${name}.png"
cp "${name}.desktop" "bin/${pname}_linux-arm32/"
echo "Compiling Linux ARM64"
export GOARCH=arm64
mkdir -p "bin/${pname}_linux-arm64"
go build -o "bin/${pname}_linux-arm64/${name}"
cp README.md "bin/${pname}_linux-arm64/"
cp ico/icon.png "bin/${pname}_linux-arm64/${name}.png"
cp "${name}.desktop" "bin/${pname}_linux-arm64/"
cd bin
rm -f *.md
rm -f *.png
rm -f *.desktop
cd ..
unset version
unset CGO_ENABLED
unset GOOS
unset GOARCH
unset pname
echo "Compiling Local"
mkdir "${GOPATH}/bin"
go generate
go build -o "${GOPATH}/bin/${name}"
rm -f *.syso
go clean
echo "${GOPATH}/bin/${name}"
unset name