-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.sh
38 lines (37 loc) · 901 Bytes
/
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
#!/bin/bash
Vers=$1
Name=ServeMSX
echo "package main" > version.go
echo "const Name, Vers = \"$Name\", \"$Vers\"" >> version.go
PLATFORMS=(
'linux/amd64'
'linux/386'
'linux/arm'
'linux/mipsle'
'linux/mips'
'darwin/arm64'
'darwin/amd64'
'windows/amd64'
'windows/386'
)
gzip -f -k assets/index.html
for PLATFORM in "${PLATFORMS[@]}"; do
o=${PLATFORM%/*}
a=${PLATFORM#*/}
e=""
if [[ "$o" == "windows" ]]; then e=".exe"; fi
f="distribs/$Name-$o-$a$e"
echo -ne "> $f...\t"
if [[ "$a" == "386" ]]; then
GOOS=$o GOARCH=$a GO386=softfloat CGO_ENABLED=0 go build -o $f -ldflags="-s -w"
else
GOOS=$o GOARCH=$a CGO_ENABLED=0 go build -o $f -ldflags="-s -w"
fi
if [[ "$o" -ne "windows" ]]; then chmod +x $f; fi
echo "done!"
done
cd assets
for DIC in *.json; do
gzip -f -k -c $DIC > ../distribs/$DIC.gz
done
cd ..