diff options
author | Filipe Cabecinhas <me@filcab.net> | 2012-11-01 18:55:16 +0000 |
---|---|---|
committer | Filipe Cabecinhas <me@filcab.net> | 2012-11-01 18:55:16 +0000 |
commit | c281a3bf431083706eeef2c60fb7af2e1812eef1 (patch) | |
tree | c98c70b756f6bc5543583a6d2526686072944672 /lldb/scripts/Python/finish-swig-Python-LLDB.sh | |
parent | 23290b0570e085739f7e783dabefc5fef120657a (diff) | |
download | bcm5719-llvm-c281a3bf431083706eeef2c60fb7af2e1812eef1.tar.gz bcm5719-llvm-c281a3bf431083706eeef2c60fb7af2e1812eef1.zip |
Makefile patches from Charles Davis and Daniel Malea (+ one or two tweaks).
llvm-svn: 167242
Diffstat (limited to 'lldb/scripts/Python/finish-swig-Python-LLDB.sh')
-rwxr-xr-x | lldb/scripts/Python/finish-swig-Python-LLDB.sh | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/lldb/scripts/Python/finish-swig-Python-LLDB.sh b/lldb/scripts/Python/finish-swig-Python-LLDB.sh index 12ffb412567..8c1fb4e5107 100755 --- a/lldb/scripts/Python/finish-swig-Python-LLDB.sh +++ b/lldb/scripts/Python/finish-swig-Python-LLDB.sh @@ -5,10 +5,10 @@ # For the Python script interpreter (external to liblldb) to be able to import # and use the lldb module, there must be two files, lldb.py and _lldb.so, that # it can find. lldb.py is generated by SWIG at the same time it generates the -# C++ file. _lldb.so is actually a symlink file that points to the +# C++ file. _lldb.so is actually a symlink file that points to the # LLDB shared library/framework. # -# The Python script interpreter needs to be able to automatically find +# The Python script interpreter needs to be able to automatically find # these two files. On Darwin systems it searches in the LLDB.framework, as # well as in all the normal Python search paths. On non-Darwin systems # these files will need to be put someplace where Python will find them. @@ -20,11 +20,11 @@ # SRC_ROOT is the root of the lldb source tree. # TARGET_DIR is where the lldb framework/shared library gets put. -# CONFIG_BUILD_DIR is where the build-swig-Python-LLDB.sh shell script +# CONFIG_BUILD_DIR is where the build-swig-Python-LLDB.sh shell script # put the lldb.py file it was generated from running SWIG. # PYTHON_INSTALL_DIR is where non-Darwin systems want to put the .py and .so # files so that Python can find them automatically. -# debug_flag (optional) determines whether or not this script outputs +# debug_flag (optional) determines whether or not this script outputs # additional information when running. SRC_ROOT=$1 @@ -32,6 +32,7 @@ TARGET_DIR=$2 CONFIG_BUILD_DIR=$3 PYTHON_INSTALL_DIR=$4 debug_flag=$5 +makefile_flag=$6 # If we don't want Python, then just do nothing here. # Note, at present iOS doesn't have Python, so if you're building for iOS be sure to @@ -46,6 +47,13 @@ else Debug=0 fi +if [ -n "$makefile_flag" -a "$makefile_flag" = "-m" ] +then + MakefileCalled=1 +else + MakefileCalled=0 +fi + OS_NAME=`uname -s` PYTHON_VERSION=`/usr/bin/env python --version 2>&1 | sed -e 's,Python ,,' -e 's,[.][0-9],,2' -e 's,[a-z][a-z][0-9],,'` @@ -56,12 +64,19 @@ then echo "The Python version is $PYTHON_VERSION" fi +if [ ${OS_NAME} = "Darwin" ] +then + SOEXT=".dylib" +else + SOEXT=".so" +fi + # # Determine where to put the files. -if [ ${OS_NAME} = "Darwin" ] +if [ $MakefileCalled -eq 0 ] then - # We are on a Darwin system, so all the lldb Python files can go + # We are being built by Xcode, so all the lldb Python files can go # into the LLDB.framework/Resources/Python subdirectory. if [ ! -d "${TARGET_DIR}/LLDB.framework" ] @@ -79,13 +94,20 @@ then framework_python_dir="${TARGET_DIR}/LLDB.framework/Resources/Python/lldb" else - # We are on a non-Darwin system, so use the PYTHON_INSTALL_DIR argument, + # We are being built by LLVM, so use the PYTHON_INSTALL_DIR argument, # and append the python version directory to the end of it. Depending on # the system other stuff may need to be put here as well. - framework_python_dir="${PYTHON_INSTALL_DIR}/python${PYTHON_VERSION}/lldb" + if [ -n "${PYTHON_INSTALL_DIR}" ] + then + framework_python_dir=`/usr/bin/env python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True, False, \"${PYTHON_INSTALL_DIR}\");"`/lldb + else + framework_python_dir=`/usr/bin/env python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True, False);"`/lldb + fi fi +[ -n "${CONFIG_BUILD_DIR}" ] || CONFIG_BUILD_DIR=${framework_python_dir} + # # Look for the directory in which to put the Python files; if it does not # already exist, attempt to make it. @@ -130,10 +152,12 @@ then then echo "Creating symlink for _lldb.so" fi - if [ ${OS_NAME} = "Darwin" ] + cd "${framework_python_dir}" + if [ $MakefileCalled -eq 0 ] then - cd "${framework_python_dir}" ln -s "../../../LLDB" _lldb.so + else + ln -s "../../../liblldb${SOEXT}" _lldb.so fi else if [ $Debug -eq 1 ] |