teleport/build.sh

72 lines
1.5 KiB
Bash
Raw Normal View History

2017-01-11 12:04:11 +00:00
#!/bin/bash
2018-09-16 13:52:10 +00:00
#---------------------------------------------------------------
# README
#
# pleas copy build.sh.in to build.sh and change the following
# two lines to fit your env.
#
# Recommend to download miniconda from
# https://conda.io/miniconda.html
# and install it, root priviledge is not necessary.
#---------------------------------------------------------------
PATH_PYTHON_LINUX=/home/apex/miniconda3
PATH_PYTHON_MACOS=/path/of/your/python/installation
################################################################
# DO NOT TOUCH FOLLOWING CODE
################################################################
2017-06-05 18:22:52 +00:00
2017-01-11 12:04:11 +00:00
PATH_ROOT=$(cd "$(dirname "$0")"; pwd)
function on_error()
{
echo -e "\033[01m\033[31m"
echo "==================[ !! ERROR !! ]=================="
2018-09-16 13:52:10 +00:00
echo ""
2017-01-11 12:04:11 +00:00
echo -e $1
2018-09-16 13:52:10 +00:00
echo ""
2017-01-11 12:04:11 +00:00
echo "==================================================="
echo -e "\033[0m"
exit 1
}
2018-09-16 13:52:10 +00:00
function check_python
2017-06-05 18:22:52 +00:00
{
2017-01-11 12:04:11 +00:00
if [ ! -f "${PYSTATIC}" ]; then
2018-09-16 13:52:10 +00:00
on_error "python not found."
2017-01-11 12:04:11 +00:00
fi
2018-09-16 13:52:10 +00:00
}
function build_linux
{
PATH_PYTHON=${PATH_PYTHON_LINUX}
PYEXEC=${PATH_PYTHON}/bin/python3.7
PYSTATIC=${PATH_PYTHON}/lib/libpython3.7m.a
2017-01-11 12:04:11 +00:00
2018-09-16 13:52:10 +00:00
check_python
2017-01-11 12:04:11 +00:00
2017-06-05 18:22:52 +00:00
${PYEXEC} -B "${PATH_ROOT}/build/build.py" $@
}
function build_macos
{
2018-09-16 13:52:10 +00:00
PATH_PYTHON=${PATH_PYTHON_LINUX}
PYEXEC=${PATH_PYTHON}/bin/python3.7
PYSTATIC=${PATH_PYTHON}/lib/libpython3.7m.a
check_python
${PYEXEC} -B "${PATH_ROOT}/build/build.py" $@
2017-06-05 18:22:52 +00:00
}
SYSTEM=`uname -s`
if [ $SYSTEM = "Linux" ] ; then
build_linux
elif [ $SYSTEM = "Darwin" ] ; then
build_macos
else
echo "Unsupported platform."
fi
2018-09-16 13:52:10 +00:00