-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.sh
executable file
·53 lines (45 loc) · 1.03 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
rm -rf .tmp
gox -ldflags "-X main.version=$(git describe)" -output=".tmp/{{.OS}}_{{.Arch}}" -os="darwin linux windows" -arch="amd64 arm64"
cd .tmp
cat <<EOT >> goloc.sh
#!/bin/bash
if [ -x "\$(command -v goloc)" ]; then
echo "Using goloc from PATH..."
echo "Version:"
goloc --version
goloc "\$@"
exit 0
else
EXECUTABLE=""
case "\$OSTYPE" in
darwin*) EXECUTABLE+="darwin_" ;;
linux*) EXECUTABLE+="linux_" ;;
msys*) EXECUTABLE+="windows_" ;;
*)
echo "Platform is not supported: \$OSTYPE"
exit 1
;;
esac
MACHINE_TYPE=\$(uname -m)
case "\$MACHINE_TYPE" in
arm64*) EXECUTABLE+="arm64" ;;
x86_64*) EXECUTABLE+="amd64" ;;
*)
echo "CPU Architecture is not supported: \$MACHINE_TYPE"
exit 1
;;
esac
case "\$OSTYPE" in
msys*) EXECUTABLE+=".exe";;
esac
echo "Using goloc from project..."
echo "Version:"
"\${0%/*}"/\${EXECUTABLE} --version
"\${0%/*}"/\${EXECUTABLE} "\$@"
fi
EOT
zip -r goloc.zip .
cd ..
mkdir out
mv .tmp/goloc.zip out/
rm -rf .tmp