-
Notifications
You must be signed in to change notification settings - Fork 333
/
build.sh.in
executable file
·65 lines (52 loc) · 1.4 KB
/
build.sh.in
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
#!/bin/bash
PATH_ROOT=$(cd "$(dirname "$0")"; pwd)
function on_error()
{
echo -e "\033[01m\033[31m"
echo "==================[ !! ERROR !! ]=================="
echo ""
echo -e $1
echo ""
echo "==================================================="
echo -e "\033[0m"
exit 1
}
function build_linux
{
if [ `id -u` -eq 0 ]; then
on_error "Do not build as root."
fi
if [ ! -f "/etc/centos-release" ] ; then
on_error "Sorry, build script works on CentOS 7 only."
fi
X=$(yum list installed | grep "libffi-devel")
if [ "$X-x" = "-x" ] ; then
on_error "Need libffi-devel to build Python, try:\r\n sudo yum install libffi-devel"
fi
X=$(yum list installed | grep "zlib-devel")
if [ "$X-x" = "-x" ] ; then
on_error "Need zlib-devel to build Python, try:\r\n sudo yum install zlib-devel"
fi
PYEXEC=${PATH_ROOT}/external/linux/release/bin/python3.7
PYSTATIC=${PATH_ROOT}/external/linux/release/lib/libpython3.7m.a
if [ ! -f "${PYSTATIC}" ] ; then
echo "python static not found, now build it..."
"${PATH_ROOT}/build/build-py-static.sh"
if [ ! -f "${PYSTATIC}" ] ; then
on_error "can not build python static."
fi
fi
${PYEXEC} -B "${PATH_ROOT}/build/build.py" $@
}
function build_macos
{
python3 -B "${PATH_ROOT}/build/build.py" $@
}
SYSTEM=`uname -s`
if [ $SYSTEM = "Linux" ] ; then
build_linux $@
elif [ $SYSTEM = "Darwin" ] ; then
build_macos $@
else
echo "Unsupported platform."
fi