-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·104 lines (87 loc) · 1.67 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
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
function check_blade() {
blade --version 1>/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
echo "blade not found"
return -1
fi
return 0
}
function install_blade() {
check_blade
if [ $? -eq 0 ]; then
echo "blade had intalled"
return 0
fi
echo "ready to install blade"
blade-build/install 2>&1
source ~/.profile
ret=0
check_blade
if [ $? -eq 0 ]; then
echo "blade install success"
else
echo "blade install fail"
ret=-1
fi
return $ret
}
function check_ninja() {
ninja --version 1>/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
echo "ninja not found"
return -1
fi
return 0
}
function install_ninja() {
check_ninja
if [ $? -eq 0 ]; then
echo "ninja had installed"
return 0
fi
echo "ready to install ninja"
cd ninja
./configure.py --bootstrap 2>&1
cp ninja ~/bin
cd ..
ret=0
check_ninja
if [ $? -eq 0 ]; then
echo "ninja install success"
else
echo "ninja install fail"
ret=-1
fi
return $ret
}
function build_normal() {
# 编译前更新子模块代码
git submodule update --init --recursive
# 编译需要安装blade和ninja
install_blade
if [ $? -ne 0 ]; then
return -1
fi
install_ninja
if [ $? -ne 0 ]; then
return -1
fi
blade build 2>&1
}
function blade_clean() {
blade clean 2>&1
rm -rf build64_release/*
}
########### 主流程 ###########
case $1 in
'build')
build_normal
;;
'clean')
blade_clean
;;
*)
build_normal
;;
esac