forked from chilipeppr/serial-port-json-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile_go1_5_crosscompile.sh
executable file
·89 lines (79 loc) · 4.27 KB
/
compile_go1_5_crosscompile.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
# git submodule init
# git submodule update
echo "About to cross-compile Serial Port JSON Server with Go 1.5"
if [ "$1" = "" ]; then
echo "You need to pass in the version number as the first parameter like ./compile_go1_5_crosscompile 1.87"
exit
fi
rm -rf snapshot/*
cp README.md snapshot/
echo "Building Linux amd64"
mkdir snapshot/serial-port-json-server-$1_linux_amd64
mkdir snapshot/serial-port-json-server-$1_linux_amd64/arduino
cp sample* snapshot/serial-port-json-server-$1_linux_amd64
cp -r arduino/hardware snapshot/serial-port-json-server-$1_linux_amd64/arduino/hardware
cp -r arduino/tools_linux_64 snapshot/serial-port-json-server-$1_linux_amd64/arduino/tools
env GOOS=linux GOARCH=amd64 go build -v -o snapshot/serial-port-json-server-$1_linux_amd64/serial-port-json-server
cd snapshot
tar -zcvf serial-port-json-server-$1_linux_amd64.tar.gz serial-port-json-server-$1_linux_amd64
cd ..
echo ""
echo "Building Linux 386"
mkdir snapshot/serial-port-json-server-$1_linux_386
mkdir snapshot/serial-port-json-server-$1_linux_386/arduino
cp sample* snapshot/serial-port-json-server-$1_linux_386
cp -r arduino/hardware snapshot/serial-port-json-server-$1_linux_386/arduino/hardware
cp -r arduino/tools_linux_32 snapshot/serial-port-json-server-$1_linux_386/arduino/tools
env GOOS=linux GOARCH=386 go build -v -o snapshot/serial-port-json-server-$1_linux_386/serial-port-json-server
cd snapshot
tar -zcvf serial-port-json-server-$1_linux_386.tar.gz serial-port-json-server-$1_linux_386
cd ..
echo ""
echo "Building Linux ARM (Raspi)"
mkdir snapshot/serial-port-json-server-$1_linux_arm
mkdir snapshot/serial-port-json-server-$1_linux_arm/arduino
cp sample* snapshot/serial-port-json-server-$1_linux_arm
cp -r arduino/hardware snapshot/serial-port-json-server-$1_linux_arm/arduino/hardware
cp -r arduino/tools_linux_arm snapshot/serial-port-json-server-$1_linux_arm/arduino/tools
env GOOS=linux GOARCH=arm go build -v -o snapshot/serial-port-json-server-$1_linux_arm/serial-port-json-server
cd snapshot
tar -zcvf serial-port-json-server-$1_linux_arm.tar.gz serial-port-json-server-$1_linux_arm
cd ..
echo ""
echo "Building Windows x32"
mkdir snapshot/serial-port-json-server-$1_windows_386
mkdir snapshot/serial-port-json-server-$1_windows_386/arduino
mkdir snapshot/serial-port-json-server-$1_windows_386/drivers
cp -r drivers/* snapshot/serial-port-json-server-$1_windows_386/drivers
cp sample* snapshot/serial-port-json-server-$1_windows_386
cp -r arduino/hardware snapshot/serial-port-json-server-$1_windows_386/arduino/hardware
cp -r arduino/tools_windows snapshot/serial-port-json-server-$1_windows_386/arduino/tools
env GOOS=windows GOARCH=386 go build -v -o snapshot/serial-port-json-server-$1_windows_386/serial-port-json-server.exe
cd snapshot/serial-port-json-server-$1_windows_386
zip -r ../serial-port-json-server-$1_windows_386.zip *
cd ../..
echo ""
echo "Building Windows x64"
mkdir snapshot/serial-port-json-server-$1_windows_amd64
mkdir snapshot/serial-port-json-server-$1_windows_amd64/arduino
mkdir snapshot/serial-port-json-server-$1_windows_amd64/drivers
cp -r drivers/* snapshot/serial-port-json-server-$1_windows_amd64/drivers
cp sample* snapshot/serial-port-json-server-$1_windows_amd64
cp -r arduino/hardware snapshot/serial-port-json-server-$1_windows_amd64/arduino/hardware
cp -r arduino/tools_windows snapshot/serial-port-json-server-$1_windows_amd64/arduino/tools
env GOOS=windows GOARCH=amd64 go build -v -o snapshot/serial-port-json-server-$1_windows_amd64/serial-port-json-server.exe
cd snapshot/serial-port-json-server-$1_windows_amd64
zip -r ../serial-port-json-server-$1_windows_amd64.zip *
cd ../..
echo ""
echo "Building Darwin x64"
mkdir snapshot/serial-port-json-server-$1_darwin_amd64
mkdir snapshot/serial-port-json-server-$1_darwin_amd64/arduino
cp sample* snapshot/serial-port-json-server-$1_darwin_amd64
cp -r arduino/hardware snapshot/serial-port-json-server-$1_darwin_amd64/arduino/hardware
cp -r arduino/tools_darwin snapshot/serial-port-json-server-$1_darwin_amd64/arduino/tools
env GOOS=darwin GOARCH=amd64 go build -v -o snapshot/serial-port-json-server-$1_darwin_amd64/serial-port-json-server
cd snapshot/serial-port-json-server-$1_darwin_amd64
zip -r ../serial-port-json-server-$1_darwin_amd64.zip *
cd ../..
export GITHUB_TOKEN=d1ce644ff5eef10f4f1e5fbf27515d22c7d68e8b