Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1 | #! /bin/sh |
| 2 | |
| 3 | # finish-swig-Python.sh |
| 4 | # |
| 5 | # For the Python script interpreter (external to liblldb) to be able to import |
| 6 | # and use the lldb module, there must be a "_lldb.so" in the framework |
| 7 | # resources directory. Here we make a symlink called "_lldb.so" that just |
| 8 | # points to the executable in the LLDB.framework and copy over the needed |
| 9 | # .py files. |
| 10 | |
| 11 | if [ ! -d "${TARGET_BUILD_DIR}/LLDB.framework" ] |
| 12 | then |
| 13 | echo "Error: Unable to find LLDB.framework" >&2 |
| 14 | exit 1 |
| 15 | fi |
| 16 | |
| 17 | # Make the Python directory down in the framework if it doesn't already exist |
| 18 | framework_python_dir="${TARGET_BUILD_DIR}/LLDB.framework/Versions/A/Resources/Python" |
| 19 | if [ ! -d "${framework_python_dir}" ] |
| 20 | then |
| 21 | mkdir -p "${framework_python_dir}" |
| 22 | fi |
| 23 | |
| 24 | # Make the symlink that the script bridge for Python will need in the Python |
| 25 | # framework directory |
| 26 | if [ ! -L "${framework_python_dir}/_lldb.so" ] |
| 27 | then |
| 28 | cd "${framework_python_dir}" |
| 29 | ln -s "../../LLDB" _lldb.so |
| 30 | fi |
| 31 | |
| 32 | # Copy the python module (lldb.py) that was generated by SWIG |
| 33 | # over to the framework Python directory |
| 34 | if [ -f "${CONFIGURATION_BUILD_DIR}/lldb.py" ] |
| 35 | then |
| 36 | cp "${CONFIGURATION_BUILD_DIR}/lldb.py" "${framework_python_dir}" |
| 37 | fi |
| 38 | |
| 39 | # Copy the embedded interpreter script over to the framework Python directory |
| 40 | if [ -f "${SRCROOT}/source/Interpreter/embedded_interpreter.py" ] |
| 41 | then |
| 42 | cp "${SRCROOT}/source/Interpreter/embedded_interpreter.py" "${framework_python_dir}" |
| 43 | fi |
| 44 | |
| 45 | exit 0 |