Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # build-swig-Python.sh |
| 4 | |
Caroline Tice | 9dbe717 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 5 | # SRC_ROOT is the root of the lldb source tree. |
| 6 | # TARGET_DIR is where the lldb framework/shared library gets put. |
| 7 | # CONFIG_BUILD_DIR is where the build-swig-Python-LLDB.sh shell script |
| 8 | # put the lldb.py file it was generated from running SWIG. |
| 9 | # PREFIX is the root directory used to determine where third-party modules |
| 10 | # for scripting languages should be installed. |
| 11 | # debug_flag (optional) determines whether or not this script outputs |
| 12 | # additional information when running. |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 13 | |
Caroline Tice | 9dbe717 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 14 | SRC_ROOT=$1 |
| 15 | TARGET_DIR=$2 |
| 16 | CONFIG_BUILD_DIR=$3 |
| 17 | PYTHON_INSTALL_DIR=$4 |
| 18 | debug_flag=$5 |
Jim Ingham | 2396b9f | 2011-03-01 01:39:04 +0000 | [diff] [blame] | 19 | SWIG=$6 |
Caroline Tice | 9dbe717 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 20 | |
Filipe Cabecinhas | 4bb4f30 | 2012-09-14 17:09:15 +0000 | [diff] [blame] | 21 | os_name=`uname -s` |
Jason Molenda | e2801e1 | 2012-09-27 21:26:57 +0000 | [diff] [blame^] | 22 | if [ "$os_name" = "Darwin" ] |
Filipe Cabecinhas | 4bb4f30 | 2012-09-14 17:09:15 +0000 | [diff] [blame] | 23 | then |
| 24 | swig_output_file=${SRC_ROOT}/source/LLDBWrapPython.cpp |
| 25 | else |
| 26 | swig_output_file=${TARGET_DIR}/LLDBWrapPython.cpp |
| 27 | fi |
Caroline Tice | 9dbe717 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 28 | swig_input_file=${SRC_ROOT}/scripts/lldb.swig |
Johnny Chen | f530bfe | 2011-08-22 22:10:57 +0000 | [diff] [blame] | 29 | swig_python_extensions=${SRC_ROOT}/scripts/Python/python-extensions.swig |
| 30 | swig_python_wrapper=${SRC_ROOT}/scripts/Python/python-wrapper.swig |
Enrico Granata | b62d4c6 | 2012-02-02 17:26:00 +0000 | [diff] [blame] | 31 | swig_python_typemaps=${SRC_ROOT}/scripts/Python/python-typemaps.swig |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 32 | |
Filipe Cabecinhas | 4bb4f30 | 2012-09-14 17:09:15 +0000 | [diff] [blame] | 33 | if [ "$LLDB_DISABLE_PYTHON" = "1" ] ; then |
Jim Ingham | f4ec2ea | 2012-05-26 00:23:52 +0000 | [diff] [blame] | 34 | # We don't want Python for this build, but touch the output file so we don't have to |
| 35 | # conditionalize the build on this as well. |
| 36 | # Note, at present iOS doesn't have Python, so if you're building for iOS be sure to |
| 37 | # set LLDB_DISABLE_PYTHON to 1. |
Jim Ingham | b7e62f8 | 2012-05-24 01:16:09 +0000 | [diff] [blame] | 38 | rm -rf ${swig_output_file} |
| 39 | touch ${swig_output_file} |
| 40 | |
| 41 | else |
Greg Clayton | 3e4238d | 2011-11-04 03:34:56 +0000 | [diff] [blame] | 42 | |
Jason Molenda | e2801e1 | 2012-09-27 21:26:57 +0000 | [diff] [blame^] | 43 | if [ -n "$debug_flag" -a "$debug_flag" = "-debug" ] |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 44 | then |
| 45 | Debug=1 |
| 46 | else |
| 47 | Debug=0 |
| 48 | fi |
| 49 | |
Jason Molenda | c48ca82 | 2012-02-21 05:33:55 +0000 | [diff] [blame] | 50 | # If this project is being built with LLDB_DISABLE_PYTHON defined, |
| 51 | # don't bother generating Python swig bindings -- we don't have |
| 52 | # Python available. |
| 53 | |
| 54 | if echo $GCC_PREPROCESSOR_DEFINITIONS | grep LLDB_DISABLE_PYTHON |
| 55 | then |
| 56 | echo "" > "${swig_output_file}" |
| 57 | exit 0 |
| 58 | fi |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 59 | |
Greg Clayton | b344843 | 2011-03-24 21:19:54 +0000 | [diff] [blame] | 60 | HEADER_FILES="${SRC_ROOT}/include/lldb/lldb.h"\ |
Caroline Tice | c8b0e90 | 2010-10-18 23:00:51 +0000 | [diff] [blame] | 61 | " ${SRC_ROOT}/include/lldb/lldb-defines.h"\ |
| 62 | " ${SRC_ROOT}/include/lldb/lldb-enumerations.h"\ |
| 63 | " ${SRC_ROOT}/include/lldb/lldb-forward.h"\ |
| 64 | " ${SRC_ROOT}/include/lldb/lldb-forward-rtti.h"\ |
| 65 | " ${SRC_ROOT}/include/lldb/lldb-types.h"\ |
Caroline Tice | 9dbe717 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 66 | " ${SRC_ROOT}/include/lldb/API/SBAddress.h"\ |
| 67 | " ${SRC_ROOT}/include/lldb/API/SBBlock.h"\ |
| 68 | " ${SRC_ROOT}/include/lldb/API/SBBreakpoint.h"\ |
| 69 | " ${SRC_ROOT}/include/lldb/API/SBBreakpointLocation.h"\ |
| 70 | " ${SRC_ROOT}/include/lldb/API/SBBroadcaster.h"\ |
Caroline Tice | 9dbe717 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 71 | " ${SRC_ROOT}/include/lldb/API/SBCommandInterpreter.h"\ |
| 72 | " ${SRC_ROOT}/include/lldb/API/SBCommandReturnObject.h"\ |
Greg Clayton | d8c6253 | 2010-10-07 04:19:01 +0000 | [diff] [blame] | 73 | " ${SRC_ROOT}/include/lldb/API/SBCommunication.h"\ |
Caroline Tice | 9dbe717 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 74 | " ${SRC_ROOT}/include/lldb/API/SBCompileUnit.h"\ |
Enrico Granata | 9154480 | 2011-09-06 19:20:51 +0000 | [diff] [blame] | 75 | " ${SRC_ROOT}/include/lldb/API/SBData.h"\ |
Caroline Tice | 9dbe717 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 76 | " ${SRC_ROOT}/include/lldb/API/SBDebugger.h"\ |
| 77 | " ${SRC_ROOT}/include/lldb/API/SBError.h"\ |
| 78 | " ${SRC_ROOT}/include/lldb/API/SBEvent.h"\ |
Johnny Chen | 4ead2e9 | 2010-08-27 22:35:26 +0000 | [diff] [blame] | 79 | " ${SRC_ROOT}/include/lldb/API/SBFileSpec.h"\ |
Caroline Tice | 9dbe717 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 80 | " ${SRC_ROOT}/include/lldb/API/SBFrame.h"\ |
| 81 | " ${SRC_ROOT}/include/lldb/API/SBFunction.h"\ |
Greg Clayton | d8c6253 | 2010-10-07 04:19:01 +0000 | [diff] [blame] | 82 | " ${SRC_ROOT}/include/lldb/API/SBHostOS.h"\ |
| 83 | " ${SRC_ROOT}/include/lldb/API/SBInputReader.h"\ |
Greg Clayton | 5c4c746 | 2010-10-06 03:09:58 +0000 | [diff] [blame] | 84 | " ${SRC_ROOT}/include/lldb/API/SBInstruction.h"\ |
| 85 | " ${SRC_ROOT}/include/lldb/API/SBInstructionList.h"\ |
Caroline Tice | 9dbe717 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 86 | " ${SRC_ROOT}/include/lldb/API/SBLineEntry.h"\ |
| 87 | " ${SRC_ROOT}/include/lldb/API/SBListener.h"\ |
| 88 | " ${SRC_ROOT}/include/lldb/API/SBModule.h"\ |
| 89 | " ${SRC_ROOT}/include/lldb/API/SBProcess.h"\ |
| 90 | " ${SRC_ROOT}/include/lldb/API/SBSourceManager.h"\ |
Caroline Tice | 1ca48b0 | 2010-09-22 16:41:52 +0000 | [diff] [blame] | 91 | " ${SRC_ROOT}/include/lldb/API/SBStream.h"\ |
Caroline Tice | 9dbe717 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 92 | " ${SRC_ROOT}/include/lldb/API/SBStringList.h"\ |
| 93 | " ${SRC_ROOT}/include/lldb/API/SBSymbol.h"\ |
| 94 | " ${SRC_ROOT}/include/lldb/API/SBSymbolContext.h"\ |
Greg Clayton | d8c6253 | 2010-10-07 04:19:01 +0000 | [diff] [blame] | 95 | " ${SRC_ROOT}/include/lldb/API/SBSymbolContextList.h"\ |
Caroline Tice | 9dbe717 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 96 | " ${SRC_ROOT}/include/lldb/API/SBTarget.h"\ |
| 97 | " ${SRC_ROOT}/include/lldb/API/SBThread.h"\ |
| 98 | " ${SRC_ROOT}/include/lldb/API/SBType.h"\ |
Enrico Granata | 16376ed | 2012-02-15 02:34:21 +0000 | [diff] [blame] | 99 | " ${SRC_ROOT}/include/lldb/API/SBTypeCategory.h"\ |
| 100 | " ${SRC_ROOT}/include/lldb/API/SBTypeFilter.h"\ |
| 101 | " ${SRC_ROOT}/include/lldb/API/SBTypeFormat.h"\ |
| 102 | " ${SRC_ROOT}/include/lldb/API/SBTypeNameSpecifier.h"\ |
| 103 | " ${SRC_ROOT}/include/lldb/API/SBTypeSummary.h"\ |
| 104 | " ${SRC_ROOT}/include/lldb/API/SBTypeSynthetic.h"\ |
Caroline Tice | 1ca48b0 | 2010-09-22 16:41:52 +0000 | [diff] [blame] | 105 | " ${SRC_ROOT}/include/lldb/API/SBValue.h"\ |
Johnny Chen | 092bd15 | 2011-09-27 01:19:20 +0000 | [diff] [blame] | 106 | " ${SRC_ROOT}/include/lldb/API/SBValueList.h"\ |
Greg Clayton | 1fa6b3d | 2011-10-13 18:08:26 +0000 | [diff] [blame] | 107 | " ${SRC_ROOT}/include/lldb/API/SBWatchpoint.h"\ |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 108 | |
Johnny Chen | c39793d | 2011-09-09 17:37:06 +0000 | [diff] [blame] | 109 | INTERFACE_FILES="${SRC_ROOT}/scripts/Python/interface/SBAddress.i"\ |
| 110 | " ${SRC_ROOT}/scripts/Python/interface/SBBlock.i"\ |
| 111 | " ${SRC_ROOT}/scripts/Python/interface/SBBreakpoint.i"\ |
| 112 | " ${SRC_ROOT}/scripts/Python/interface/SBBreakpointLocation.i"\ |
| 113 | " ${SRC_ROOT}/scripts/Python/interface/SBBroadcaster.i"\ |
| 114 | " ${SRC_ROOT}/scripts/Python/interface/SBCommandInterpreter.i"\ |
| 115 | " ${SRC_ROOT}/scripts/Python/interface/SBCommandReturnObject.i"\ |
| 116 | " ${SRC_ROOT}/scripts/Python/interface/SBCommunication.i"\ |
| 117 | " ${SRC_ROOT}/scripts/Python/interface/SBCompileUnit.i"\ |
| 118 | " ${SRC_ROOT}/scripts/Python/interface/SBData.i"\ |
| 119 | " ${SRC_ROOT}/scripts/Python/interface/SBDebugger.i"\ |
| 120 | " ${SRC_ROOT}/scripts/Python/interface/SBError.i"\ |
| 121 | " ${SRC_ROOT}/scripts/Python/interface/SBEvent.i"\ |
| 122 | " ${SRC_ROOT}/scripts/Python/interface/SBFileSpec.i"\ |
| 123 | " ${SRC_ROOT}/scripts/Python/interface/SBFrame.i"\ |
| 124 | " ${SRC_ROOT}/scripts/Python/interface/SBFunction.i"\ |
| 125 | " ${SRC_ROOT}/scripts/Python/interface/SBHostOS.i"\ |
| 126 | " ${SRC_ROOT}/scripts/Python/interface/SBInputReader.i"\ |
| 127 | " ${SRC_ROOT}/scripts/Python/interface/SBInstruction.i"\ |
| 128 | " ${SRC_ROOT}/scripts/Python/interface/SBInstructionList.i"\ |
| 129 | " ${SRC_ROOT}/scripts/Python/interface/SBLineEntry.i"\ |
| 130 | " ${SRC_ROOT}/scripts/Python/interface/SBListener.i"\ |
| 131 | " ${SRC_ROOT}/scripts/Python/interface/SBModule.i"\ |
| 132 | " ${SRC_ROOT}/scripts/Python/interface/SBProcess.i"\ |
| 133 | " ${SRC_ROOT}/scripts/Python/interface/SBSourceManager.i"\ |
| 134 | " ${SRC_ROOT}/scripts/Python/interface/SBStream.i"\ |
| 135 | " ${SRC_ROOT}/scripts/Python/interface/SBStringList.i"\ |
| 136 | " ${SRC_ROOT}/scripts/Python/interface/SBSymbol.i"\ |
| 137 | " ${SRC_ROOT}/scripts/Python/interface/SBSymbolContext.i"\ |
| 138 | " ${SRC_ROOT}/scripts/Python/interface/SBTarget.i"\ |
| 139 | " ${SRC_ROOT}/scripts/Python/interface/SBThread.i"\ |
| 140 | " ${SRC_ROOT}/scripts/Python/interface/SBType.i"\ |
Enrico Granata | 16376ed | 2012-02-15 02:34:21 +0000 | [diff] [blame] | 141 | " ${SRC_ROOT}/scripts/Python/interface/SBTypeCategory.i"\ |
| 142 | " ${SRC_ROOT}/scripts/Python/interface/SBTypeFilter.i"\ |
| 143 | " ${SRC_ROOT}/scripts/Python/interface/SBTypeFormat.i"\ |
| 144 | " ${SRC_ROOT}/scripts/Python/interface/SBTypeNameSpecifier.i"\ |
| 145 | " ${SRC_ROOT}/scripts/Python/interface/SBTypeSummary.i"\ |
| 146 | " ${SRC_ROOT}/scripts/Python/interface/SBTypeSynthetic.i"\ |
Johnny Chen | c39793d | 2011-09-09 17:37:06 +0000 | [diff] [blame] | 147 | " ${SRC_ROOT}/scripts/Python/interface/SBValue.i"\ |
Johnny Chen | 092bd15 | 2011-09-27 01:19:20 +0000 | [diff] [blame] | 148 | " ${SRC_ROOT}/scripts/Python/interface/SBValueList.i"\ |
Greg Clayton | 1fa6b3d | 2011-10-13 18:08:26 +0000 | [diff] [blame] | 149 | " ${SRC_ROOT}/scripts/Python/interface/SBWatchpoint.i" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 150 | |
Jason Molenda | e2801e1 | 2012-09-27 21:26:57 +0000 | [diff] [blame^] | 151 | if [ $Debug -eq 1 ] |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 152 | then |
| 153 | echo "Header files are:" |
| 154 | echo ${HEADER_FILES} |
| 155 | fi |
| 156 | |
Jason Molenda | e2801e1 | 2012-09-27 21:26:57 +0000 | [diff] [blame^] | 157 | if [ $Debug -eq 1 ] |
Enrico Granata | 9154480 | 2011-09-06 19:20:51 +0000 | [diff] [blame] | 158 | then |
| 159 | echo "SWIG interface files are:" |
| 160 | echo ${INTERFACE_FILES} |
| 161 | fi |
| 162 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 163 | NeedToUpdate=0 |
| 164 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 165 | |
Johnny Chen | b4d1fff | 2010-08-26 20:04:17 +0000 | [diff] [blame] | 166 | if [ ! -f ${swig_output_file} ] |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 167 | then |
| 168 | NeedToUpdate=1 |
Jason Molenda | e2801e1 | 2012-09-27 21:26:57 +0000 | [diff] [blame^] | 169 | if [ $Debug -eq 1 ] |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 170 | then |
| 171 | echo "Failed to find LLDBWrapPython.cpp" |
| 172 | fi |
| 173 | fi |
| 174 | |
Jason Molenda | e2801e1 | 2012-09-27 21:26:57 +0000 | [diff] [blame^] | 175 | if [ $NeedToUpdate -eq 0 ] |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 176 | then |
| 177 | for hdrfile in ${HEADER_FILES} |
| 178 | do |
Johnny Chen | b4d1fff | 2010-08-26 20:04:17 +0000 | [diff] [blame] | 179 | if [ $hdrfile -nt ${swig_output_file} ] |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 180 | then |
| 181 | NeedToUpdate=1 |
Jason Molenda | e2801e1 | 2012-09-27 21:26:57 +0000 | [diff] [blame^] | 182 | if [ $Debug -eq 1 ] |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 183 | then |
| 184 | echo "${hdrfile} is newer than ${swig_output_file}" |
| 185 | echo "swig file will need to be re-built." |
| 186 | fi |
Johnny Chen | b4d1fff | 2010-08-26 20:04:17 +0000 | [diff] [blame] | 187 | break |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 188 | fi |
| 189 | done |
| 190 | fi |
| 191 | |
Jason Molenda | e2801e1 | 2012-09-27 21:26:57 +0000 | [diff] [blame^] | 192 | if [ $NeedToUpdate -eq 0 ] |
Johnny Chen | b4d1fff | 2010-08-26 20:04:17 +0000 | [diff] [blame] | 193 | then |
Enrico Granata | 9154480 | 2011-09-06 19:20:51 +0000 | [diff] [blame] | 194 | for intffile in ${INTERFACE_FILES} |
| 195 | do |
| 196 | if [ $intffile -nt ${swig_output_file} ] |
| 197 | then |
| 198 | NeedToUpdate=1 |
Jason Molenda | e2801e1 | 2012-09-27 21:26:57 +0000 | [diff] [blame^] | 199 | if [ $Debug -eq 1 ] |
Enrico Granata | 9154480 | 2011-09-06 19:20:51 +0000 | [diff] [blame] | 200 | then |
| 201 | echo "${intffile} is newer than ${swig_output_file}" |
| 202 | echo "swig file will need to be re-built." |
| 203 | fi |
| 204 | break |
| 205 | fi |
| 206 | done |
| 207 | fi |
| 208 | |
Jason Molenda | e2801e1 | 2012-09-27 21:26:57 +0000 | [diff] [blame^] | 209 | if [ $NeedToUpdate -eq 0 ] |
Enrico Granata | 9154480 | 2011-09-06 19:20:51 +0000 | [diff] [blame] | 210 | then |
Johnny Chen | b4d1fff | 2010-08-26 20:04:17 +0000 | [diff] [blame] | 211 | if [ ${swig_input_file} -nt ${swig_output_file} ] |
| 212 | then |
| 213 | NeedToUpdate=1 |
Jason Molenda | e2801e1 | 2012-09-27 21:26:57 +0000 | [diff] [blame^] | 214 | if [ $Debug -eq 1 ] |
Johnny Chen | b4d1fff | 2010-08-26 20:04:17 +0000 | [diff] [blame] | 215 | then |
| 216 | echo "${swig_input_file} is newer than ${swig_output_file}" |
| 217 | echo "swig file will need to be re-built." |
| 218 | fi |
| 219 | fi |
| 220 | fi |
| 221 | |
Jason Molenda | e2801e1 | 2012-09-27 21:26:57 +0000 | [diff] [blame^] | 222 | if [ $NeedToUpdate -eq 0 ] |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 223 | then |
Johnny Chen | f530bfe | 2011-08-22 22:10:57 +0000 | [diff] [blame] | 224 | if [ ${swig_python_extensions} -nt ${swig_output_file} ] |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 225 | then |
| 226 | NeedToUpdate=1 |
Jason Molenda | e2801e1 | 2012-09-27 21:26:57 +0000 | [diff] [blame^] | 227 | if [ $Debug -eq 1 ] |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 228 | then |
Johnny Chen | f530bfe | 2011-08-22 22:10:57 +0000 | [diff] [blame] | 229 | echo "${swig_python_extensions} is newer than ${swig_output_file}" |
| 230 | echo "swig file will need to be re-built." |
| 231 | fi |
| 232 | fi |
| 233 | fi |
| 234 | |
Jason Molenda | e2801e1 | 2012-09-27 21:26:57 +0000 | [diff] [blame^] | 235 | if [ $NeedToUpdate -eq 0 ] |
Johnny Chen | f530bfe | 2011-08-22 22:10:57 +0000 | [diff] [blame] | 236 | then |
| 237 | if [ ${swig_python_wrapper} -nt ${swig_output_file} ] |
| 238 | then |
| 239 | NeedToUpdate=1 |
Jason Molenda | e2801e1 | 2012-09-27 21:26:57 +0000 | [diff] [blame^] | 240 | if [ $Debug -eq 1 ] |
Johnny Chen | f530bfe | 2011-08-22 22:10:57 +0000 | [diff] [blame] | 241 | then |
| 242 | echo "${swig_python_wrapper} is newer than ${swig_output_file}" |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 243 | echo "swig file will need to be re-built." |
| 244 | fi |
| 245 | fi |
| 246 | fi |
| 247 | |
Jason Molenda | e2801e1 | 2012-09-27 21:26:57 +0000 | [diff] [blame^] | 248 | if [ $NeedToUpdate -eq 0 ] |
Enrico Granata | b62d4c6 | 2012-02-02 17:26:00 +0000 | [diff] [blame] | 249 | then |
| 250 | if [ ${swig_python_typemaps} -nt ${swig_output_file} ] |
| 251 | then |
| 252 | NeedToUpdate=1 |
Jason Molenda | e2801e1 | 2012-09-27 21:26:57 +0000 | [diff] [blame^] | 253 | if [ $Debug -eq 1 ] |
Enrico Granata | b62d4c6 | 2012-02-02 17:26:00 +0000 | [diff] [blame] | 254 | then |
| 255 | echo "${swig_python_typemaps} is newer than ${swig_output_file}" |
| 256 | echo "swig file will need to be re-built." |
| 257 | fi |
| 258 | fi |
| 259 | fi |
| 260 | |
Filipe Cabecinhas | 4bb4f30 | 2012-09-14 17:09:15 +0000 | [diff] [blame] | 261 | 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],,'` |
Caroline Tice | 9dbe717 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 262 | |
Jason Molenda | e2801e1 | 2012-09-27 21:26:57 +0000 | [diff] [blame^] | 263 | if [ "$os_name" = "Darwin" ] |
Caroline Tice | 9dbe717 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 264 | then |
| 265 | framework_python_dir="${TARGET_DIR}/LLDB.framework/Resources/Python" |
| 266 | else |
| 267 | framework_python_dir="${PYTHON_INSTALL_DIR}/python${python_version}" |
| 268 | fi |
| 269 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 270 | |
| 271 | if [ ! -L "${framework_python_dir}/_lldb.so" ] |
| 272 | then |
| 273 | NeedToUpdate=1 |
| 274 | fi |
| 275 | |
| 276 | if [ ! -f "${framework_python_dir}/lldb.py" ] |
| 277 | then |
| 278 | NeedToUpdate=1 |
| 279 | fi |
| 280 | |
| 281 | |
Jason Molenda | e2801e1 | 2012-09-27 21:26:57 +0000 | [diff] [blame^] | 282 | if [ $NeedToUpdate -eq 0 ] |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 283 | then |
| 284 | echo "Everything is up-to-date." |
| 285 | exit 0 |
| 286 | else |
| 287 | echo "SWIG needs to be re-run." |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 288 | if [ -f ${swig_output_file} ] |
| 289 | then |
| 290 | rm ${swig_output_file} |
| 291 | fi |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 292 | fi |
| 293 | |
| 294 | |
| 295 | # Build the SWIG C++ wrapper file for Python. |
| 296 | |
Johnny Chen | 8165d43 | 2012-08-18 04:14:54 +0000 | [diff] [blame] | 297 | $SWIG -c++ -shadow -python -threads -I"/usr/include" -I"${SRC_ROOT}/include" -I./. -outdir "${CONFIG_BUILD_DIR}" -o "${swig_output_file}" "${swig_input_file}" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 298 | |
Johnny Chen | 22e418a | 2011-04-29 19:22:24 +0000 | [diff] [blame] | 299 | # Implement the iterator protocol and/or eq/ne operators for some lldb objects. |
Caroline Tice | 558be58 | 2010-06-30 16:22:25 +0000 | [diff] [blame] | 300 | # Append global variable to lldb Python module. |
Johnny Chen | 1409780 | 2011-04-28 21:31:18 +0000 | [diff] [blame] | 301 | # And initialize the lldb debugger subsystem. |
Caroline Tice | 558be58 | 2010-06-30 16:22:25 +0000 | [diff] [blame] | 302 | current_dir=`pwd` |
Johnny Chen | 1409780 | 2011-04-28 21:31:18 +0000 | [diff] [blame] | 303 | if [ -f "${current_dir}/modify-python-lldb.py" ] |
Caroline Tice | 558be58 | 2010-06-30 16:22:25 +0000 | [diff] [blame] | 304 | then |
Johnny Chen | 1409780 | 2011-04-28 21:31:18 +0000 | [diff] [blame] | 305 | python ${current_dir}/modify-python-lldb.py ${CONFIG_BUILD_DIR} |
Caroline Tice | 558be58 | 2010-06-30 16:22:25 +0000 | [diff] [blame] | 306 | fi |
Caroline Tice | 5790e06 | 2010-10-28 21:51:20 +0000 | [diff] [blame] | 307 | |
| 308 | # Fix the "#include" statement in the swig output file |
| 309 | |
| 310 | if [ -f "${current_dir}/edit-swig-python-wrapper-file.py" ] |
| 311 | then |
| 312 | python ${current_dir}/edit-swig-python-wrapper-file.py |
| 313 | if [ -f "${swig_output_file}.edited" ] |
| 314 | then |
| 315 | mv "${swig_output_file}.edited" ${swig_output_file} |
| 316 | fi |
| 317 | fi |
Greg Clayton | 3e4238d | 2011-11-04 03:34:56 +0000 | [diff] [blame] | 318 | |
Greg Clayton | 3e4238d | 2011-11-04 03:34:56 +0000 | [diff] [blame] | 319 | fi |