-
Notifications
You must be signed in to change notification settings - Fork 171
/
compile_go1_5_crosscompile.sh
executable file
·71 lines (62 loc) · 3.6 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
# 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 -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
tar -zcvf snapshot/serial-port-json-server-$1_linux_amd64.tar.gz snapshot/serial-port-json-server-$1_linux_amd64
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 -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
tar -zcvf snapshot/serial-port-json-server-$1_linux_386.tar.gz snapshot/serial-port-json-server-$1_linux_386
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 -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
tar -zcvf snapshot/serial-port-json-server-$1_linux_arm.tar.gz snapshot/serial-port-json-server-$1_linux_arm
echo ""
echo "Building Windows x32"
mkdir snapshot/serial-port-json-server-$1_windows_386
mkdir snapshot/serial-port-json-server-$1_windows_386/arduino
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
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 -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 ../..