forked from BoltzExchange/boltz-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
binaries.sh
executable file
·61 lines (47 loc) · 1.15 KB
/
binaries.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
#!/bin/bash
function print() {
echo -e " \e[0;32m${1}\e[0m"
}
function cc_version() {
case $1 in
"linux")
case $2 in
"amd64")
echo "gcc"
;;
"arm")
echo "arm-linux-gnueabi-gcc"
;;
"arm64")
echo "aarch64-linux-gnu-gcc"
;;
esac
;;
"windows")
case $2 in
"amd64")
echo "x86_64-w64-mingw32-gcc"
;;
"386")
echo "i686-w64-mingw32-gcc"
;;
esac
esac
}
mkdir -p binaries
for build_system in "$@"; do
print "Building binaries for $build_system"
os=$(echo "$build_system" | cut -f1 -d-)
arch=$(echo "$build_system" | cut -f2 -d-)
env CGO_ENABLED=1 CC="$(cc_version "$os" "$arch")" GOOS="$os" GOARCH="$arch" make build
print "Moving binaries for $build_system"
destinationPath=binaries/$build_system/
mkdir -p "$destinationPath"
if [[ $os == "windows" ]]; then
mv boltzd "$destinationPath"/boltzd.exe
mv boltzcli "$destinationPath"/boltzcli.exe
else
mv boltzd "$destinationPath"/boltzd
mv boltzcli "$destinationPath"/boltzcli
fi
done