-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.sh
executable file
·50 lines (46 loc) · 1.25 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
#!/bin/bash
has() {
while [ -n "$1" ]; do
if ! builtin command -v "$1" > /dev/null; then
return 1
fi
shift
done
}
download_release() {
curr_commit="$(git rev-parse HEAD)"
curr_tag="$(git describe --exact-match "$curr_commit" 2> /dev/null)"
if [ -z "$curr_tag" ]; then
return 1
fi
arch="$(uname -m)"
os="$(uname -s)"
url=""
case "$arch-$os" in
x86_64-Darwin)
url=https://github.com/kkew3/jieba.vim/releases/download/${curr_tag}/jieba_vim_rs-x86_64-apple-darwin.dylib;
name=jieba_vim_rs.so;
;;
aarch64-Darwin)
url=https://github.com/kkew3/jieba.vim/releases/download/${curr_tag}/jieba_vim_rs-aarch64-apple-darwin.dylib;
name=jieba_vim_rs.so;
;;
x86_64-Linux)
url=https://github.com/kkew3/jieba.vim/releases/download/${curr_tag}/jieba_vim_rs-x86_64-unknown-linux-gnu.so;
name=jieba_vim_rs.so;
;;
esac
if [ -z "$url" ]; then
return 1
fi
curl -fsSLo "pythonx/jieba_vim/$name" "$url"
}
build_from_source() {
cd pythonx && cargo build -r
}
if has git uname curl; then
if download_release; then
exit 0
fi
fi
build_from_source