teleport/build.sh.in

67 lines
1.4 KiB
Bash
Raw Normal View History

2018-09-16 13:52:10 +00:00
#!/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
}
2018-09-23 20:46:12 +00:00
function build_linux
2018-09-16 13:52:10 +00:00
{
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
2018-09-23 20:46:12 +00:00
PYEXEC=${PATH_ROOT}/external/linux/release/bin/python3.7
PYSTATIC=${PATH_ROOT}/external/linux/release/lib/libpython3.7m.a
if [ ! -f "${PYSTATIC}" ] ; then
2018-09-23 20:46:12 +00:00
echo "python static not found, now build it..."
"${PATH_ROOT}/build/build-py-static.sh"
2018-09-16 13:52:10 +00:00
if [ ! -f "${PYSTATIC}" ] ; then
2018-09-23 20:46:12 +00:00
on_error "can not build python static."
fi
fi
2018-09-16 13:52:10 +00:00
${PYEXEC} -B "${PATH_ROOT}/build/build.py" $@
}
function build_macos
{
2018-09-23 20:46:12 +00:00
python3 -B "${PATH_ROOT}/build/build.py" $@
2018-09-16 13:52:10 +00:00
}
SYSTEM=`uname -s`
if [ $SYSTEM = "Linux" ] ; then
build_linux
elif [ $SYSTEM = "Darwin" ] ; then
build_macos
else
echo "Unsupported platform."
fi