finish-swig-Python-LLDB.sh [plain text]
#! /bin/sh
SRC_ROOT=$1
TARGET_DIR=$2
CONFIG_BUILD_DIR=$3
PYTHON_INSTALL_DIR=$4
debug_flag=$5
if [ -n "$debug_flag" -a "$debug_flag" == "-debug" ]
then
Debug=1
else
Debug=0
fi
OS_NAME=`uname -s`
PYTHON_VERSION=`/usr/bin/python --version 2>&1 | sed -e 's,Python ,,' -e 's,[.][0-9],,2' -e 's,[a-z][a-z][0-9],,'`
if [ $Debug == 1 ]
then
echo "The current OS is $OS_NAME"
echo "The Python version is $PYTHON_VERSION"
fi
if [ ${OS_NAME} == "Darwin" ]
then
if [ ! -d "${TARGET_DIR}/LLDB.framework" ]
then
echo "Error: Unable to find LLDB.framework" >&2
exit 1
else
if [ $Debug == 1 ]
then
echo "Found ${TARGET_DIR}/LLDB.framework."
fi
fi
framework_python_dir="${TARGET_DIR}/LLDB.framework/Resources/Python"
else
framework_python_dir="${PYTHON_INSTALL_DIR}/python${PYTHON_VERSION}"
fi
if [ $Debug == 1 ]
then
echo "Python files will be put in ${framework_python_dir}"
fi
if [ ! -d "${framework_python_dir}" ]
then
if [ $Debug == 1 ]
then
echo "Making directory ${framework_python_dir}"
fi
mkdir -p "${framework_python_dir}"
else
if [ $Debug == 1 ]
then
echo "${framework_python_dir} already exists."
fi
fi
if [ ! -d "${framework_python_dir}" ]
then
echo "Error: Unable to find or create ${framework_python_dir}" >&2
exit 1
fi
if [ ! -L "${framework_python_dir}/_lldb.so" ]
then
if [ $Debug == 1 ]
then
echo "Creating symlink for _lldb.so"
fi
if [ ${OS_NAME} == "Darwin" ]
then
cd "${framework_python_dir}"
ln -s "../../LLDB" _lldb.so
else
cd "${TARGET_DIR}"
ln -s "./LLDB" _lldb.so
fi
else
if [ $Debug == 1 ]
then
echo "${framework_python_dir}/_lldb.so already exists."
fi
fi
if [ -f "${CONFIG_BUILD_DIR}/lldb.py" ]
then
if [ $Debug == 1 ]
then
echo "Copying lldb.py to ${framework_python_dir}"
fi
cp "${CONFIG_BUILD_DIR}/lldb.py" "${framework_python_dir}"
else
if [ $Debug == 1 ]
then
echo "Unable to find ${CONFIG_BUILD_DIR}/lldb.py"
fi
fi
if [ -f "${SRC_ROOT}/source/Interpreter/embedded_interpreter.py" ]
then
if [ $Debug == 1 ]
then
echo "Copying embedded_interpreter.py to ${framework_python_dir}"
fi
cp "${SRC_ROOT}/source/Interpreter/embedded_interpreter.py" "${framework_python_dir}"
else
if [ $Debug == 1 ]
then
echo "Unable to find ${SRC_ROOT}/source/Interpreter/embedded_interpreter.py"
fi
fi
exit 0