Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # build-swig-Python.sh |
| 4 | |
Caroline Tice | d6ac384 | 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. |
Filipe Cabecinhas | c281a3b | 2012-11-01 18:55:16 +0000 | [diff] [blame] | 7 | # CONFIG_BUILD_DIR is where the build-swig-Python-LLDB.sh shell script |
Caroline Tice | d6ac384 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 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. |
Filipe Cabecinhas | c281a3b | 2012-11-01 18:55:16 +0000 | [diff] [blame] | 11 | # debug_flag (optional) determines whether or not this script outputs |
Caroline Tice | d6ac384 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 12 | # additional information when running. |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 13 | |
Caroline Tice | d6ac384 | 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 |
Filipe Cabecinhas | c281a3b | 2012-11-01 18:55:16 +0000 | [diff] [blame] | 18 | debug_flag=$5 |
Jim Ingham | 6b90ba4 | 2011-03-01 01:39:04 +0000 | [diff] [blame] | 19 | SWIG=$6 |
Filipe Cabecinhas | c281a3b | 2012-11-01 18:55:16 +0000 | [diff] [blame] | 20 | makefile_flag=$7 |
| 21 | dependency_flag=$8 |
Caroline Tice | d6ac384 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 22 | |
Ed Maste | d010f9a | 2014-05-07 12:52:08 +0000 | [diff] [blame] | 23 | PYTHON=${PYTHON_EXECUTABLE:-/usr/bin/env python} |
| 24 | |
Filipe Cabecinhas | c281a3b | 2012-11-01 18:55:16 +0000 | [diff] [blame] | 25 | if [ -n "$makefile_flag" -a "$makefile_flag" = "-m" ] |
| 26 | then |
| 27 | MakefileCalled=1 |
| 28 | if [ -n "$dependency_flag" -a "$dependency_flag" = "-M" ] |
| 29 | then |
| 30 | GenerateDependencies=1 |
| 31 | swig_depend_file="${TARGET_DIR}/LLDBWrapPython.cpp.d" |
| 32 | SWIG_DEPEND_OPTIONS="-MMD -MF \"${swig_depend_file}.tmp\"" |
| 33 | else |
| 34 | GenerateDependencies=0 |
| 35 | fi |
| 36 | else |
| 37 | MakefileCalled=0 |
| 38 | GenerateDependencies=0 |
| 39 | fi |
| 40 | |
Greg Clayton | 9bb8cb1 | 2014-03-14 18:24:30 +0000 | [diff] [blame] | 41 | swig_output_file=${TARGET_DIR}/LLDBWrapPython.cpp |
Caroline Tice | d6ac384 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 42 | swig_input_file=${SRC_ROOT}/scripts/lldb.swig |
Johnny Chen | 30123f1 | 2011-08-22 22:10:57 +0000 | [diff] [blame] | 43 | swig_python_extensions=${SRC_ROOT}/scripts/Python/python-extensions.swig |
| 44 | swig_python_wrapper=${SRC_ROOT}/scripts/Python/python-wrapper.swig |
Enrico Granata | 9d2063e | 2012-02-02 17:26:00 +0000 | [diff] [blame] | 45 | swig_python_typemaps=${SRC_ROOT}/scripts/Python/python-typemaps.swig |
Enrico Granata | c972c70 | 2013-06-21 18:57:30 +0000 | [diff] [blame] | 46 | swig_python_swigsafecast=${SRC_ROOT}/scripts/Python/python-swigsafecast.swig |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 47 | |
Filipe Cabecinhas | 3e9e081 | 2012-09-14 17:09:15 +0000 | [diff] [blame] | 48 | if [ "$LLDB_DISABLE_PYTHON" = "1" ] ; then |
Jim Ingham | de22182 | 2012-05-26 00:23:52 +0000 | [diff] [blame] | 49 | # We don't want Python for this build, but touch the output file so we don't have to |
| 50 | # conditionalize the build on this as well. |
| 51 | # Note, at present iOS doesn't have Python, so if you're building for iOS be sure to |
| 52 | # set LLDB_DISABLE_PYTHON to 1. |
Jim Ingham | 777e6d0 | 2012-05-24 01:16:09 +0000 | [diff] [blame] | 53 | rm -rf ${swig_output_file} |
| 54 | touch ${swig_output_file} |
| 55 | |
| 56 | else |
Greg Clayton | dce502e | 2011-11-04 03:34:56 +0000 | [diff] [blame] | 57 | |
Jason Molenda | 47d114a | 2012-09-27 21:26:57 +0000 | [diff] [blame] | 58 | if [ -n "$debug_flag" -a "$debug_flag" = "-debug" ] |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 59 | then |
| 60 | Debug=1 |
| 61 | else |
| 62 | Debug=0 |
| 63 | fi |
| 64 | |
Jason Molenda | cf7e2dc | 2012-02-21 05:33:55 +0000 | [diff] [blame] | 65 | # If this project is being built with LLDB_DISABLE_PYTHON defined, |
| 66 | # don't bother generating Python swig bindings -- we don't have |
| 67 | # Python available. |
| 68 | |
| 69 | if echo $GCC_PREPROCESSOR_DEFINITIONS | grep LLDB_DISABLE_PYTHON |
| 70 | then |
| 71 | echo "" > "${swig_output_file}" |
| 72 | exit 0 |
| 73 | fi |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 74 | |
Greg Clayton | e0d378b | 2011-03-24 21:19:54 +0000 | [diff] [blame] | 75 | HEADER_FILES="${SRC_ROOT}/include/lldb/lldb.h"\ |
Caroline Tice | e206be2 | 2010-10-18 23:00:51 +0000 | [diff] [blame] | 76 | " ${SRC_ROOT}/include/lldb/lldb-defines.h"\ |
| 77 | " ${SRC_ROOT}/include/lldb/lldb-enumerations.h"\ |
| 78 | " ${SRC_ROOT}/include/lldb/lldb-forward.h"\ |
| 79 | " ${SRC_ROOT}/include/lldb/lldb-forward-rtti.h"\ |
| 80 | " ${SRC_ROOT}/include/lldb/lldb-types.h"\ |
Caroline Tice | d6ac384 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 81 | " ${SRC_ROOT}/include/lldb/API/SBAddress.h"\ |
| 82 | " ${SRC_ROOT}/include/lldb/API/SBBlock.h"\ |
| 83 | " ${SRC_ROOT}/include/lldb/API/SBBreakpoint.h"\ |
| 84 | " ${SRC_ROOT}/include/lldb/API/SBBreakpointLocation.h"\ |
| 85 | " ${SRC_ROOT}/include/lldb/API/SBBroadcaster.h"\ |
Caroline Tice | d6ac384 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 86 | " ${SRC_ROOT}/include/lldb/API/SBCommandInterpreter.h"\ |
| 87 | " ${SRC_ROOT}/include/lldb/API/SBCommandReturnObject.h"\ |
Greg Clayton | 05faeb7 | 2010-10-07 04:19:01 +0000 | [diff] [blame] | 88 | " ${SRC_ROOT}/include/lldb/API/SBCommunication.h"\ |
Caroline Tice | d6ac384 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 89 | " ${SRC_ROOT}/include/lldb/API/SBCompileUnit.h"\ |
Enrico Granata | 9128ee2 | 2011-09-06 19:20:51 +0000 | [diff] [blame] | 90 | " ${SRC_ROOT}/include/lldb/API/SBData.h"\ |
Caroline Tice | d6ac384 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 91 | " ${SRC_ROOT}/include/lldb/API/SBDebugger.h"\ |
| 92 | " ${SRC_ROOT}/include/lldb/API/SBError.h"\ |
| 93 | " ${SRC_ROOT}/include/lldb/API/SBEvent.h"\ |
Enrico Granata | e85e84a | 2014-10-01 20:43:45 +0000 | [diff] [blame] | 94 | " ${SRC_ROOT}/include/lldb/API/SBExecutionContext.h"\ |
Jim Ingham | 35e1bda | 2012-10-16 21:41:58 +0000 | [diff] [blame] | 95 | " ${SRC_ROOT}/include/lldb/API/SBExpressionOptions.h"\ |
Johnny Chen | 23fd10c | 2010-08-27 22:35:26 +0000 | [diff] [blame] | 96 | " ${SRC_ROOT}/include/lldb/API/SBFileSpec.h"\ |
Caroline Tice | d6ac384 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 97 | " ${SRC_ROOT}/include/lldb/API/SBFrame.h"\ |
| 98 | " ${SRC_ROOT}/include/lldb/API/SBFunction.h"\ |
Greg Clayton | 05faeb7 | 2010-10-07 04:19:01 +0000 | [diff] [blame] | 99 | " ${SRC_ROOT}/include/lldb/API/SBHostOS.h"\ |
Greg Clayton | 1d27316 | 2010-10-06 03:09:58 +0000 | [diff] [blame] | 100 | " ${SRC_ROOT}/include/lldb/API/SBInstruction.h"\ |
| 101 | " ${SRC_ROOT}/include/lldb/API/SBInstructionList.h"\ |
Oleksiy Vyalov | 1ef7b2c | 2015-02-04 23:19:15 +0000 | [diff] [blame^] | 102 | " ${SRC_ROOT}/include/lldb/API/SBLaunchInfo.h"\ |
Caroline Tice | d6ac384 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 103 | " ${SRC_ROOT}/include/lldb/API/SBLineEntry.h"\ |
| 104 | " ${SRC_ROOT}/include/lldb/API/SBListener.h"\ |
| 105 | " ${SRC_ROOT}/include/lldb/API/SBModule.h"\ |
Greg Clayton | 226cce2 | 2013-07-08 22:22:41 +0000 | [diff] [blame] | 106 | " ${SRC_ROOT}/include/lldb/API/SBModuleSpec.h"\ |
Caroline Tice | d6ac384 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 107 | " ${SRC_ROOT}/include/lldb/API/SBProcess.h"\ |
Jason Molenda | 5e8dce4 | 2013-12-13 00:29:16 +0000 | [diff] [blame] | 108 | " ${SRC_ROOT}/include/lldb/API/SBQueue.h"\ |
| 109 | " ${SRC_ROOT}/include/lldb/API/SBQueueItem.h"\ |
Caroline Tice | d6ac384 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 110 | " ${SRC_ROOT}/include/lldb/API/SBSourceManager.h"\ |
Caroline Tice | 7740412 | 2010-09-22 16:41:52 +0000 | [diff] [blame] | 111 | " ${SRC_ROOT}/include/lldb/API/SBStream.h"\ |
Caroline Tice | d6ac384 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 112 | " ${SRC_ROOT}/include/lldb/API/SBStringList.h"\ |
| 113 | " ${SRC_ROOT}/include/lldb/API/SBSymbol.h"\ |
| 114 | " ${SRC_ROOT}/include/lldb/API/SBSymbolContext.h"\ |
Greg Clayton | 05faeb7 | 2010-10-07 04:19:01 +0000 | [diff] [blame] | 115 | " ${SRC_ROOT}/include/lldb/API/SBSymbolContextList.h"\ |
Caroline Tice | d6ac384 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 116 | " ${SRC_ROOT}/include/lldb/API/SBTarget.h"\ |
| 117 | " ${SRC_ROOT}/include/lldb/API/SBThread.h"\ |
Kuba Brecka | a5ea1e2 | 2014-09-06 01:21:19 +0000 | [diff] [blame] | 118 | " ${SRC_ROOT}/include/lldb/API/SBThreadCollection.h"\ |
Jim Ingham | 2bdbfd5 | 2014-09-29 23:17:18 +0000 | [diff] [blame] | 119 | " ${SRC_ROOT}/include/lldb/API/SBThreadPlan.h"\ |
Caroline Tice | d6ac384 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 120 | " ${SRC_ROOT}/include/lldb/API/SBType.h"\ |
Enrico Granata | 061858c | 2012-02-15 02:34:21 +0000 | [diff] [blame] | 121 | " ${SRC_ROOT}/include/lldb/API/SBTypeCategory.h"\ |
| 122 | " ${SRC_ROOT}/include/lldb/API/SBTypeFilter.h"\ |
| 123 | " ${SRC_ROOT}/include/lldb/API/SBTypeFormat.h"\ |
| 124 | " ${SRC_ROOT}/include/lldb/API/SBTypeNameSpecifier.h"\ |
| 125 | " ${SRC_ROOT}/include/lldb/API/SBTypeSummary.h"\ |
| 126 | " ${SRC_ROOT}/include/lldb/API/SBTypeSynthetic.h"\ |
Caroline Tice | 7740412 | 2010-09-22 16:41:52 +0000 | [diff] [blame] | 127 | " ${SRC_ROOT}/include/lldb/API/SBValue.h"\ |
Johnny Chen | d4dd799 | 2011-09-27 01:19:20 +0000 | [diff] [blame] | 128 | " ${SRC_ROOT}/include/lldb/API/SBValueList.h"\ |
Todd Fiala | 802dc402 | 2014-06-23 19:30:49 +0000 | [diff] [blame] | 129 | " ${SRC_ROOT}/include/lldb/API/SBWatchpoint.h"\ |
| 130 | " ${SRC_ROOT}/include/lldb/API/SBUnixSignals.h" |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 131 | |
Johnny Chen | 8a8ce4a | 2011-09-09 17:37:06 +0000 | [diff] [blame] | 132 | INTERFACE_FILES="${SRC_ROOT}/scripts/Python/interface/SBAddress.i"\ |
| 133 | " ${SRC_ROOT}/scripts/Python/interface/SBBlock.i"\ |
| 134 | " ${SRC_ROOT}/scripts/Python/interface/SBBreakpoint.i"\ |
| 135 | " ${SRC_ROOT}/scripts/Python/interface/SBBreakpointLocation.i"\ |
| 136 | " ${SRC_ROOT}/scripts/Python/interface/SBBroadcaster.i"\ |
| 137 | " ${SRC_ROOT}/scripts/Python/interface/SBCommandInterpreter.i"\ |
| 138 | " ${SRC_ROOT}/scripts/Python/interface/SBCommandReturnObject.i"\ |
| 139 | " ${SRC_ROOT}/scripts/Python/interface/SBCommunication.i"\ |
| 140 | " ${SRC_ROOT}/scripts/Python/interface/SBCompileUnit.i"\ |
| 141 | " ${SRC_ROOT}/scripts/Python/interface/SBData.i"\ |
| 142 | " ${SRC_ROOT}/scripts/Python/interface/SBDebugger.i"\ |
Enrico Granata | 10de090 | 2012-10-10 22:54:17 +0000 | [diff] [blame] | 143 | " ${SRC_ROOT}/scripts/Python/interface/SBDeclaration.i"\ |
Johnny Chen | 8a8ce4a | 2011-09-09 17:37:06 +0000 | [diff] [blame] | 144 | " ${SRC_ROOT}/scripts/Python/interface/SBError.i"\ |
| 145 | " ${SRC_ROOT}/scripts/Python/interface/SBEvent.i"\ |
Enrico Granata | e85e84a | 2014-10-01 20:43:45 +0000 | [diff] [blame] | 146 | " ${SRC_ROOT}/scripts/Python/interface/SBExecutionContext.i"\ |
Jim Ingham | 35e1bda | 2012-10-16 21:41:58 +0000 | [diff] [blame] | 147 | " ${SRC_ROOT}/scripts/Python/interface/SBExpressionOptions.i"\ |
Johnny Chen | 8a8ce4a | 2011-09-09 17:37:06 +0000 | [diff] [blame] | 148 | " ${SRC_ROOT}/scripts/Python/interface/SBFileSpec.i"\ |
| 149 | " ${SRC_ROOT}/scripts/Python/interface/SBFrame.i"\ |
| 150 | " ${SRC_ROOT}/scripts/Python/interface/SBFunction.i"\ |
| 151 | " ${SRC_ROOT}/scripts/Python/interface/SBHostOS.i"\ |
Johnny Chen | 8a8ce4a | 2011-09-09 17:37:06 +0000 | [diff] [blame] | 152 | " ${SRC_ROOT}/scripts/Python/interface/SBInstruction.i"\ |
| 153 | " ${SRC_ROOT}/scripts/Python/interface/SBInstructionList.i"\ |
Oleksiy Vyalov | 1ef7b2c | 2015-02-04 23:19:15 +0000 | [diff] [blame^] | 154 | " ${SRC_ROOT}/scripts/Python/interface/SBLaunchInfo.i"\ |
Johnny Chen | 8a8ce4a | 2011-09-09 17:37:06 +0000 | [diff] [blame] | 155 | " ${SRC_ROOT}/scripts/Python/interface/SBLineEntry.i"\ |
| 156 | " ${SRC_ROOT}/scripts/Python/interface/SBListener.i"\ |
| 157 | " ${SRC_ROOT}/scripts/Python/interface/SBModule.i"\ |
Greg Clayton | 226cce2 | 2013-07-08 22:22:41 +0000 | [diff] [blame] | 158 | " ${SRC_ROOT}/scripts/Python/interface/SBModuleSpec.i"\ |
Greg Clayton | fbb7634 | 2013-11-20 21:07:01 +0000 | [diff] [blame] | 159 | " ${SRC_ROOT}/scripts/Python/interface/SBPlatform.i"\ |
Johnny Chen | 8a8ce4a | 2011-09-09 17:37:06 +0000 | [diff] [blame] | 160 | " ${SRC_ROOT}/scripts/Python/interface/SBProcess.i"\ |
Jason Molenda | 5e8dce4 | 2013-12-13 00:29:16 +0000 | [diff] [blame] | 161 | " ${SRC_ROOT}/scripts/Python/interface/SBQueue.i"\ |
| 162 | " ${SRC_ROOT}/scripts/Python/interface/SBQueueItem.i"\ |
Johnny Chen | 8a8ce4a | 2011-09-09 17:37:06 +0000 | [diff] [blame] | 163 | " ${SRC_ROOT}/scripts/Python/interface/SBSourceManager.i"\ |
| 164 | " ${SRC_ROOT}/scripts/Python/interface/SBStream.i"\ |
| 165 | " ${SRC_ROOT}/scripts/Python/interface/SBStringList.i"\ |
| 166 | " ${SRC_ROOT}/scripts/Python/interface/SBSymbol.i"\ |
| 167 | " ${SRC_ROOT}/scripts/Python/interface/SBSymbolContext.i"\ |
| 168 | " ${SRC_ROOT}/scripts/Python/interface/SBTarget.i"\ |
| 169 | " ${SRC_ROOT}/scripts/Python/interface/SBThread.i"\ |
Kuba Brecka | a5ea1e2 | 2014-09-06 01:21:19 +0000 | [diff] [blame] | 170 | " ${SRC_ROOT}/scripts/Python/interface/SBThreadCollection.i"\ |
Jim Ingham | 2bdbfd5 | 2014-09-29 23:17:18 +0000 | [diff] [blame] | 171 | " ${SRC_ROOT}/scripts/Python/interface/SBThreadPlan.i"\ |
Johnny Chen | 8a8ce4a | 2011-09-09 17:37:06 +0000 | [diff] [blame] | 172 | " ${SRC_ROOT}/scripts/Python/interface/SBType.i"\ |
Enrico Granata | 061858c | 2012-02-15 02:34:21 +0000 | [diff] [blame] | 173 | " ${SRC_ROOT}/scripts/Python/interface/SBTypeCategory.i"\ |
| 174 | " ${SRC_ROOT}/scripts/Python/interface/SBTypeFilter.i"\ |
| 175 | " ${SRC_ROOT}/scripts/Python/interface/SBTypeFormat.i"\ |
| 176 | " ${SRC_ROOT}/scripts/Python/interface/SBTypeNameSpecifier.i"\ |
| 177 | " ${SRC_ROOT}/scripts/Python/interface/SBTypeSummary.i"\ |
| 178 | " ${SRC_ROOT}/scripts/Python/interface/SBTypeSynthetic.i"\ |
Johnny Chen | 8a8ce4a | 2011-09-09 17:37:06 +0000 | [diff] [blame] | 179 | " ${SRC_ROOT}/scripts/Python/interface/SBValue.i"\ |
Johnny Chen | d4dd799 | 2011-09-27 01:19:20 +0000 | [diff] [blame] | 180 | " ${SRC_ROOT}/scripts/Python/interface/SBValueList.i"\ |
Todd Fiala | 802dc402 | 2014-06-23 19:30:49 +0000 | [diff] [blame] | 181 | " ${SRC_ROOT}/scripts/Python/interface/SBWatchpoint.i"\ |
| 182 | " ${SRC_ROOT}/scripts/Python/interface/SBUnixSignals.i" |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 183 | |
Jason Molenda | 47d114a | 2012-09-27 21:26:57 +0000 | [diff] [blame] | 184 | if [ $Debug -eq 1 ] |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 185 | then |
| 186 | echo "Header files are:" |
| 187 | echo ${HEADER_FILES} |
| 188 | fi |
| 189 | |
Jason Molenda | 47d114a | 2012-09-27 21:26:57 +0000 | [diff] [blame] | 190 | if [ $Debug -eq 1 ] |
Enrico Granata | 9128ee2 | 2011-09-06 19:20:51 +0000 | [diff] [blame] | 191 | then |
| 192 | echo "SWIG interface files are:" |
| 193 | echo ${INTERFACE_FILES} |
| 194 | fi |
| 195 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 196 | NeedToUpdate=0 |
| 197 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 198 | |
Johnny Chen | 5fca8ca | 2010-08-26 20:04:17 +0000 | [diff] [blame] | 199 | if [ ! -f ${swig_output_file} ] |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 200 | then |
| 201 | NeedToUpdate=1 |
Jason Molenda | 47d114a | 2012-09-27 21:26:57 +0000 | [diff] [blame] | 202 | if [ $Debug -eq 1 ] |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 203 | then |
| 204 | echo "Failed to find LLDBWrapPython.cpp" |
| 205 | fi |
| 206 | fi |
| 207 | |
Jason Molenda | 47d114a | 2012-09-27 21:26:57 +0000 | [diff] [blame] | 208 | if [ $NeedToUpdate -eq 0 ] |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 209 | then |
| 210 | for hdrfile in ${HEADER_FILES} |
| 211 | do |
Johnny Chen | 5fca8ca | 2010-08-26 20:04:17 +0000 | [diff] [blame] | 212 | if [ $hdrfile -nt ${swig_output_file} ] |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 213 | then |
| 214 | NeedToUpdate=1 |
Jason Molenda | 47d114a | 2012-09-27 21:26:57 +0000 | [diff] [blame] | 215 | if [ $Debug -eq 1 ] |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 216 | then |
| 217 | echo "${hdrfile} is newer than ${swig_output_file}" |
| 218 | echo "swig file will need to be re-built." |
| 219 | fi |
Johnny Chen | 5fca8ca | 2010-08-26 20:04:17 +0000 | [diff] [blame] | 220 | break |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 221 | fi |
| 222 | done |
| 223 | fi |
| 224 | |
Jason Molenda | 47d114a | 2012-09-27 21:26:57 +0000 | [diff] [blame] | 225 | if [ $NeedToUpdate -eq 0 ] |
Johnny Chen | 5fca8ca | 2010-08-26 20:04:17 +0000 | [diff] [blame] | 226 | then |
Enrico Granata | 9128ee2 | 2011-09-06 19:20:51 +0000 | [diff] [blame] | 227 | for intffile in ${INTERFACE_FILES} |
| 228 | do |
| 229 | if [ $intffile -nt ${swig_output_file} ] |
| 230 | then |
| 231 | NeedToUpdate=1 |
Jason Molenda | 47d114a | 2012-09-27 21:26:57 +0000 | [diff] [blame] | 232 | if [ $Debug -eq 1 ] |
Enrico Granata | 9128ee2 | 2011-09-06 19:20:51 +0000 | [diff] [blame] | 233 | then |
| 234 | echo "${intffile} is newer than ${swig_output_file}" |
| 235 | echo "swig file will need to be re-built." |
| 236 | fi |
| 237 | break |
| 238 | fi |
| 239 | done |
| 240 | fi |
| 241 | |
Jason Molenda | 47d114a | 2012-09-27 21:26:57 +0000 | [diff] [blame] | 242 | if [ $NeedToUpdate -eq 0 ] |
Enrico Granata | 9128ee2 | 2011-09-06 19:20:51 +0000 | [diff] [blame] | 243 | then |
Johnny Chen | 5fca8ca | 2010-08-26 20:04:17 +0000 | [diff] [blame] | 244 | if [ ${swig_input_file} -nt ${swig_output_file} ] |
| 245 | then |
| 246 | NeedToUpdate=1 |
Jason Molenda | 47d114a | 2012-09-27 21:26:57 +0000 | [diff] [blame] | 247 | if [ $Debug -eq 1 ] |
Johnny Chen | 5fca8ca | 2010-08-26 20:04:17 +0000 | [diff] [blame] | 248 | then |
| 249 | echo "${swig_input_file} is newer than ${swig_output_file}" |
| 250 | echo "swig file will need to be re-built." |
| 251 | fi |
| 252 | fi |
| 253 | fi |
| 254 | |
Jason Molenda | 47d114a | 2012-09-27 21:26:57 +0000 | [diff] [blame] | 255 | if [ $NeedToUpdate -eq 0 ] |
Caroline Tice | ceb6b13 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 256 | then |
Johnny Chen | 30123f1 | 2011-08-22 22:10:57 +0000 | [diff] [blame] | 257 | if [ ${swig_python_extensions} -nt ${swig_output_file} ] |
Caroline Tice | ceb6b13 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 258 | then |
| 259 | NeedToUpdate=1 |
Jason Molenda | 47d114a | 2012-09-27 21:26:57 +0000 | [diff] [blame] | 260 | if [ $Debug -eq 1 ] |
Caroline Tice | ceb6b13 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 261 | then |
Johnny Chen | 30123f1 | 2011-08-22 22:10:57 +0000 | [diff] [blame] | 262 | echo "${swig_python_extensions} is newer than ${swig_output_file}" |
| 263 | echo "swig file will need to be re-built." |
| 264 | fi |
| 265 | fi |
| 266 | fi |
| 267 | |
Jason Molenda | 47d114a | 2012-09-27 21:26:57 +0000 | [diff] [blame] | 268 | if [ $NeedToUpdate -eq 0 ] |
Johnny Chen | 30123f1 | 2011-08-22 22:10:57 +0000 | [diff] [blame] | 269 | then |
| 270 | if [ ${swig_python_wrapper} -nt ${swig_output_file} ] |
| 271 | then |
| 272 | NeedToUpdate=1 |
Jason Molenda | 47d114a | 2012-09-27 21:26:57 +0000 | [diff] [blame] | 273 | if [ $Debug -eq 1 ] |
Johnny Chen | 30123f1 | 2011-08-22 22:10:57 +0000 | [diff] [blame] | 274 | then |
| 275 | echo "${swig_python_wrapper} is newer than ${swig_output_file}" |
Caroline Tice | ceb6b13 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 276 | echo "swig file will need to be re-built." |
| 277 | fi |
| 278 | fi |
| 279 | fi |
| 280 | |
Jason Molenda | 47d114a | 2012-09-27 21:26:57 +0000 | [diff] [blame] | 281 | if [ $NeedToUpdate -eq 0 ] |
Enrico Granata | 9d2063e | 2012-02-02 17:26:00 +0000 | [diff] [blame] | 282 | then |
| 283 | if [ ${swig_python_typemaps} -nt ${swig_output_file} ] |
| 284 | then |
| 285 | NeedToUpdate=1 |
Jason Molenda | 47d114a | 2012-09-27 21:26:57 +0000 | [diff] [blame] | 286 | if [ $Debug -eq 1 ] |
Enrico Granata | 9d2063e | 2012-02-02 17:26:00 +0000 | [diff] [blame] | 287 | then |
| 288 | echo "${swig_python_typemaps} is newer than ${swig_output_file}" |
| 289 | echo "swig file will need to be re-built." |
| 290 | fi |
| 291 | fi |
| 292 | fi |
| 293 | |
Enrico Granata | c972c70 | 2013-06-21 18:57:30 +0000 | [diff] [blame] | 294 | if [ $NeedToUpdate -eq 0 ] |
| 295 | then |
| 296 | if [ ${swig_python_swigsafecast} -nt ${swig_output_file} ] |
| 297 | then |
| 298 | NeedToUpdate=1 |
| 299 | if [ $Debug -eq 1 ] |
| 300 | then |
| 301 | echo "${swig_python_swigsafecast} is newer than ${swig_output_file}" |
| 302 | echo "swig file will need to be re-built." |
| 303 | fi |
| 304 | fi |
| 305 | fi |
| 306 | |
Ed Maste | d010f9a | 2014-05-07 12:52:08 +0000 | [diff] [blame] | 307 | python_version=`${PYTHON} --version 2>&1 | sed -e 's,Python ,,' -e 's,[.][0-9],,2' -e 's,[a-z][a-z][0-9],,'` |
Caroline Tice | d6ac384 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 308 | |
Filipe Cabecinhas | c281a3b | 2012-11-01 18:55:16 +0000 | [diff] [blame] | 309 | if [ $MakefileCalled -eq 0 ] |
Caroline Tice | d6ac384 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 310 | then |
Filipe Cabecinhas | c281a3b | 2012-11-01 18:55:16 +0000 | [diff] [blame] | 311 | framework_python_dir="${TARGET_DIR}/LLDB.framework/Resources/Python/lldb" |
Caroline Tice | d6ac384 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 312 | else |
Filipe Cabecinhas | c281a3b | 2012-11-01 18:55:16 +0000 | [diff] [blame] | 313 | if [ -n "${PYTHON_INSTALL_DIR}" ] |
| 314 | then |
Ed Maste | d010f9a | 2014-05-07 12:52:08 +0000 | [diff] [blame] | 315 | framework_python_dir=`${PYTHON} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True, False, \"${PYTHON_INSTALL_DIR}\");"`/lldb |
Filipe Cabecinhas | c281a3b | 2012-11-01 18:55:16 +0000 | [diff] [blame] | 316 | else |
Ed Maste | d010f9a | 2014-05-07 12:52:08 +0000 | [diff] [blame] | 317 | framework_python_dir=`${PYTHON} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True, False);"`/lldb |
Filipe Cabecinhas | c281a3b | 2012-11-01 18:55:16 +0000 | [diff] [blame] | 318 | fi |
Caroline Tice | d6ac384 | 2010-06-16 19:26:52 +0000 | [diff] [blame] | 319 | fi |
| 320 | |
Filipe Cabecinhas | c281a3b | 2012-11-01 18:55:16 +0000 | [diff] [blame] | 321 | [ -n "${CONFIG_BUILD_DIR}" ] || CONFIG_BUILD_DIR=${framework_python_dir} |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 322 | |
| 323 | if [ ! -L "${framework_python_dir}/_lldb.so" ] |
| 324 | then |
| 325 | NeedToUpdate=1 |
| 326 | fi |
| 327 | |
Filipe Cabecinhas | c281a3b | 2012-11-01 18:55:16 +0000 | [diff] [blame] | 328 | if [ ! -f "${framework_python_dir}/__init__.py" ] |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 329 | then |
| 330 | NeedToUpdate=1 |
| 331 | fi |
| 332 | |
| 333 | |
Jason Molenda | 47d114a | 2012-09-27 21:26:57 +0000 | [diff] [blame] | 334 | if [ $NeedToUpdate -eq 0 ] |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 335 | then |
| 336 | echo "Everything is up-to-date." |
| 337 | exit 0 |
| 338 | else |
| 339 | echo "SWIG needs to be re-run." |
Caroline Tice | ceb6b13 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 340 | if [ -f ${swig_output_file} ] |
| 341 | then |
| 342 | rm ${swig_output_file} |
| 343 | fi |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 344 | fi |
| 345 | |
| 346 | |
| 347 | # Build the SWIG C++ wrapper file for Python. |
| 348 | |
Filipe Cabecinhas | c281a3b | 2012-11-01 18:55:16 +0000 | [diff] [blame] | 349 | if [ $GenerateDependencies -eq 1 ] |
| 350 | then |
| 351 | if $SWIG -c++ -shadow -python -threads -I"${SRC_ROOT}/include" -I./. -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -MMD -MF "${swig_depend_file}.tmp" -outdir "${CONFIG_BUILD_DIR}" -o "${swig_output_file}" "${swig_input_file}" |
| 352 | then |
| 353 | mv -f "${swig_depend_file}.tmp" "${swig_depend_file}" |
| 354 | else |
| 355 | rm -f "${swig_depend_file}.tmp" |
| 356 | exit 1 |
| 357 | fi |
| 358 | else |
| 359 | $SWIG -c++ -shadow -python -threads -I"${SRC_ROOT}/include" -I./. -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -outdir "${CONFIG_BUILD_DIR}" -o "${swig_output_file}" "${swig_input_file}" || exit $? |
| 360 | fi |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 361 | |
Johnny Chen | f1c95f8 | 2011-04-29 19:22:24 +0000 | [diff] [blame] | 362 | # Implement the iterator protocol and/or eq/ne operators for some lldb objects. |
Caroline Tice | ebc1bb2 | 2010-06-30 16:22:25 +0000 | [diff] [blame] | 363 | # Append global variable to lldb Python module. |
Johnny Chen | fbc0d27 | 2011-04-28 21:31:18 +0000 | [diff] [blame] | 364 | # And initialize the lldb debugger subsystem. |
Caroline Tice | ebc1bb2 | 2010-06-30 16:22:25 +0000 | [diff] [blame] | 365 | current_dir=`pwd` |
Johnny Chen | fbc0d27 | 2011-04-28 21:31:18 +0000 | [diff] [blame] | 366 | if [ -f "${current_dir}/modify-python-lldb.py" ] |
Caroline Tice | ebc1bb2 | 2010-06-30 16:22:25 +0000 | [diff] [blame] | 367 | then |
Ed Maste | d010f9a | 2014-05-07 12:52:08 +0000 | [diff] [blame] | 368 | ${PYTHON} ${current_dir}/modify-python-lldb.py ${CONFIG_BUILD_DIR} |
Caroline Tice | ebc1bb2 | 2010-06-30 16:22:25 +0000 | [diff] [blame] | 369 | fi |
Caroline Tice | 3cc8751 | 2010-10-28 21:51:20 +0000 | [diff] [blame] | 370 | |
Greg Clayton | dce502e | 2011-11-04 03:34:56 +0000 | [diff] [blame] | 371 | |
Greg Clayton | dce502e | 2011-11-04 03:34:56 +0000 | [diff] [blame] | 372 | fi |