blob: 0c4d6bbc7e7ed19be8ac047577c46bb9f2c20618 [file] [log] [blame]
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001#!/bin/sh
2
3# build-swig-Python.sh
4
Caroline Ticed6ac3842010-06-16 19:26:52 +00005# SRC_ROOT is the root of the lldb source tree.
6# TARGET_DIR is where the lldb framework/shared library gets put.
Filipe Cabecinhasc281a3b2012-11-01 18:55:16 +00007# CONFIG_BUILD_DIR is where the build-swig-Python-LLDB.sh shell script
Caroline Ticed6ac3842010-06-16 19:26:52 +00008# 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 Cabecinhasc281a3b2012-11-01 18:55:16 +000011# debug_flag (optional) determines whether or not this script outputs
Caroline Ticed6ac3842010-06-16 19:26:52 +000012# additional information when running.
Chris Lattner30fdc8d2010-06-08 16:52:24 +000013
Caroline Ticed6ac3842010-06-16 19:26:52 +000014SRC_ROOT=$1
15TARGET_DIR=$2
16CONFIG_BUILD_DIR=$3
17PYTHON_INSTALL_DIR=$4
Filipe Cabecinhasc281a3b2012-11-01 18:55:16 +000018debug_flag=$5
Jim Ingham6b90ba42011-03-01 01:39:04 +000019SWIG=$6
Filipe Cabecinhasc281a3b2012-11-01 18:55:16 +000020makefile_flag=$7
21dependency_flag=$8
Caroline Ticed6ac3842010-06-16 19:26:52 +000022
Ed Masted010f9a2014-05-07 12:52:08 +000023PYTHON=${PYTHON_EXECUTABLE:-/usr/bin/env python}
24
Filipe Cabecinhasc281a3b2012-11-01 18:55:16 +000025if [ -n "$makefile_flag" -a "$makefile_flag" = "-m" ]
26then
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
36else
37 MakefileCalled=0
38 GenerateDependencies=0
39fi
40
Greg Clayton9bb8cb12014-03-14 18:24:30 +000041swig_output_file=${TARGET_DIR}/LLDBWrapPython.cpp
Caroline Ticed6ac3842010-06-16 19:26:52 +000042swig_input_file=${SRC_ROOT}/scripts/lldb.swig
Johnny Chen30123f12011-08-22 22:10:57 +000043swig_python_extensions=${SRC_ROOT}/scripts/Python/python-extensions.swig
44swig_python_wrapper=${SRC_ROOT}/scripts/Python/python-wrapper.swig
Enrico Granata9d2063e2012-02-02 17:26:00 +000045swig_python_typemaps=${SRC_ROOT}/scripts/Python/python-typemaps.swig
Enrico Granatac972c702013-06-21 18:57:30 +000046swig_python_swigsafecast=${SRC_ROOT}/scripts/Python/python-swigsafecast.swig
Chris Lattner30fdc8d2010-06-08 16:52:24 +000047
Filipe Cabecinhas3e9e0812012-09-14 17:09:15 +000048if [ "$LLDB_DISABLE_PYTHON" = "1" ] ; then
Jim Inghamde221822012-05-26 00:23:52 +000049 # 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 Ingham777e6d02012-05-24 01:16:09 +000053 rm -rf ${swig_output_file}
54 touch ${swig_output_file}
55
56else
Greg Claytondce502e2011-11-04 03:34:56 +000057
Jason Molenda47d114a2012-09-27 21:26:57 +000058if [ -n "$debug_flag" -a "$debug_flag" = "-debug" ]
Chris Lattner30fdc8d2010-06-08 16:52:24 +000059then
60 Debug=1
61else
62 Debug=0
63fi
64
Jason Molendacf7e2dc2012-02-21 05:33:55 +000065# 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
69if echo $GCC_PREPROCESSOR_DEFINITIONS | grep LLDB_DISABLE_PYTHON
70then
71 echo "" > "${swig_output_file}"
72 exit 0
73fi
Chris Lattner30fdc8d2010-06-08 16:52:24 +000074
Greg Claytone0d378b2011-03-24 21:19:54 +000075HEADER_FILES="${SRC_ROOT}/include/lldb/lldb.h"\
Caroline Ticee206be22010-10-18 23:00:51 +000076" ${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 Ticed6ac3842010-06-16 19:26:52 +000081" ${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 Ticed6ac3842010-06-16 19:26:52 +000086" ${SRC_ROOT}/include/lldb/API/SBCommandInterpreter.h"\
87" ${SRC_ROOT}/include/lldb/API/SBCommandReturnObject.h"\
Greg Clayton05faeb72010-10-07 04:19:01 +000088" ${SRC_ROOT}/include/lldb/API/SBCommunication.h"\
Caroline Ticed6ac3842010-06-16 19:26:52 +000089" ${SRC_ROOT}/include/lldb/API/SBCompileUnit.h"\
Enrico Granata9128ee22011-09-06 19:20:51 +000090" ${SRC_ROOT}/include/lldb/API/SBData.h"\
Caroline Ticed6ac3842010-06-16 19:26:52 +000091" ${SRC_ROOT}/include/lldb/API/SBDebugger.h"\
92" ${SRC_ROOT}/include/lldb/API/SBError.h"\
93" ${SRC_ROOT}/include/lldb/API/SBEvent.h"\
Enrico Granatae85e84a2014-10-01 20:43:45 +000094" ${SRC_ROOT}/include/lldb/API/SBExecutionContext.h"\
Jim Ingham35e1bda2012-10-16 21:41:58 +000095" ${SRC_ROOT}/include/lldb/API/SBExpressionOptions.h"\
Johnny Chen23fd10c2010-08-27 22:35:26 +000096" ${SRC_ROOT}/include/lldb/API/SBFileSpec.h"\
Caroline Ticed6ac3842010-06-16 19:26:52 +000097" ${SRC_ROOT}/include/lldb/API/SBFrame.h"\
98" ${SRC_ROOT}/include/lldb/API/SBFunction.h"\
Greg Clayton05faeb72010-10-07 04:19:01 +000099" ${SRC_ROOT}/include/lldb/API/SBHostOS.h"\
Greg Clayton1d273162010-10-06 03:09:58 +0000100" ${SRC_ROOT}/include/lldb/API/SBInstruction.h"\
101" ${SRC_ROOT}/include/lldb/API/SBInstructionList.h"\
Caroline Ticed6ac3842010-06-16 19:26:52 +0000102" ${SRC_ROOT}/include/lldb/API/SBLineEntry.h"\
103" ${SRC_ROOT}/include/lldb/API/SBListener.h"\
104" ${SRC_ROOT}/include/lldb/API/SBModule.h"\
Greg Clayton226cce22013-07-08 22:22:41 +0000105" ${SRC_ROOT}/include/lldb/API/SBModuleSpec.h"\
Caroline Ticed6ac3842010-06-16 19:26:52 +0000106" ${SRC_ROOT}/include/lldb/API/SBProcess.h"\
Jason Molenda5e8dce42013-12-13 00:29:16 +0000107" ${SRC_ROOT}/include/lldb/API/SBQueue.h"\
108" ${SRC_ROOT}/include/lldb/API/SBQueueItem.h"\
Caroline Ticed6ac3842010-06-16 19:26:52 +0000109" ${SRC_ROOT}/include/lldb/API/SBSourceManager.h"\
Caroline Tice77404122010-09-22 16:41:52 +0000110" ${SRC_ROOT}/include/lldb/API/SBStream.h"\
Caroline Ticed6ac3842010-06-16 19:26:52 +0000111" ${SRC_ROOT}/include/lldb/API/SBStringList.h"\
112" ${SRC_ROOT}/include/lldb/API/SBSymbol.h"\
113" ${SRC_ROOT}/include/lldb/API/SBSymbolContext.h"\
Greg Clayton05faeb72010-10-07 04:19:01 +0000114" ${SRC_ROOT}/include/lldb/API/SBSymbolContextList.h"\
Caroline Ticed6ac3842010-06-16 19:26:52 +0000115" ${SRC_ROOT}/include/lldb/API/SBTarget.h"\
116" ${SRC_ROOT}/include/lldb/API/SBThread.h"\
Kuba Breckaa5ea1e22014-09-06 01:21:19 +0000117" ${SRC_ROOT}/include/lldb/API/SBThreadCollection.h"\
Jim Ingham2bdbfd52014-09-29 23:17:18 +0000118" ${SRC_ROOT}/include/lldb/API/SBThreadPlan.h"\
Caroline Ticed6ac3842010-06-16 19:26:52 +0000119" ${SRC_ROOT}/include/lldb/API/SBType.h"\
Enrico Granata061858c2012-02-15 02:34:21 +0000120" ${SRC_ROOT}/include/lldb/API/SBTypeCategory.h"\
121" ${SRC_ROOT}/include/lldb/API/SBTypeFilter.h"\
122" ${SRC_ROOT}/include/lldb/API/SBTypeFormat.h"\
123" ${SRC_ROOT}/include/lldb/API/SBTypeNameSpecifier.h"\
124" ${SRC_ROOT}/include/lldb/API/SBTypeSummary.h"\
125" ${SRC_ROOT}/include/lldb/API/SBTypeSynthetic.h"\
Caroline Tice77404122010-09-22 16:41:52 +0000126" ${SRC_ROOT}/include/lldb/API/SBValue.h"\
Johnny Chend4dd7992011-09-27 01:19:20 +0000127" ${SRC_ROOT}/include/lldb/API/SBValueList.h"\
Todd Fiala802dc4022014-06-23 19:30:49 +0000128" ${SRC_ROOT}/include/lldb/API/SBWatchpoint.h"\
129" ${SRC_ROOT}/include/lldb/API/SBUnixSignals.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000130
Johnny Chen8a8ce4a2011-09-09 17:37:06 +0000131INTERFACE_FILES="${SRC_ROOT}/scripts/Python/interface/SBAddress.i"\
132" ${SRC_ROOT}/scripts/Python/interface/SBBlock.i"\
133" ${SRC_ROOT}/scripts/Python/interface/SBBreakpoint.i"\
134" ${SRC_ROOT}/scripts/Python/interface/SBBreakpointLocation.i"\
135" ${SRC_ROOT}/scripts/Python/interface/SBBroadcaster.i"\
136" ${SRC_ROOT}/scripts/Python/interface/SBCommandInterpreter.i"\
137" ${SRC_ROOT}/scripts/Python/interface/SBCommandReturnObject.i"\
138" ${SRC_ROOT}/scripts/Python/interface/SBCommunication.i"\
139" ${SRC_ROOT}/scripts/Python/interface/SBCompileUnit.i"\
140" ${SRC_ROOT}/scripts/Python/interface/SBData.i"\
141" ${SRC_ROOT}/scripts/Python/interface/SBDebugger.i"\
Enrico Granata10de0902012-10-10 22:54:17 +0000142" ${SRC_ROOT}/scripts/Python/interface/SBDeclaration.i"\
Johnny Chen8a8ce4a2011-09-09 17:37:06 +0000143" ${SRC_ROOT}/scripts/Python/interface/SBError.i"\
144" ${SRC_ROOT}/scripts/Python/interface/SBEvent.i"\
Enrico Granatae85e84a2014-10-01 20:43:45 +0000145" ${SRC_ROOT}/scripts/Python/interface/SBExecutionContext.i"\
Jim Ingham35e1bda2012-10-16 21:41:58 +0000146" ${SRC_ROOT}/scripts/Python/interface/SBExpressionOptions.i"\
Johnny Chen8a8ce4a2011-09-09 17:37:06 +0000147" ${SRC_ROOT}/scripts/Python/interface/SBFileSpec.i"\
148" ${SRC_ROOT}/scripts/Python/interface/SBFrame.i"\
149" ${SRC_ROOT}/scripts/Python/interface/SBFunction.i"\
150" ${SRC_ROOT}/scripts/Python/interface/SBHostOS.i"\
Johnny Chen8a8ce4a2011-09-09 17:37:06 +0000151" ${SRC_ROOT}/scripts/Python/interface/SBInstruction.i"\
152" ${SRC_ROOT}/scripts/Python/interface/SBInstructionList.i"\
153" ${SRC_ROOT}/scripts/Python/interface/SBLineEntry.i"\
154" ${SRC_ROOT}/scripts/Python/interface/SBListener.i"\
155" ${SRC_ROOT}/scripts/Python/interface/SBModule.i"\
Greg Clayton226cce22013-07-08 22:22:41 +0000156" ${SRC_ROOT}/scripts/Python/interface/SBModuleSpec.i"\
Greg Claytonfbb76342013-11-20 21:07:01 +0000157" ${SRC_ROOT}/scripts/Python/interface/SBPlatform.i"\
Johnny Chen8a8ce4a2011-09-09 17:37:06 +0000158" ${SRC_ROOT}/scripts/Python/interface/SBProcess.i"\
Jason Molenda5e8dce42013-12-13 00:29:16 +0000159" ${SRC_ROOT}/scripts/Python/interface/SBQueue.i"\
160" ${SRC_ROOT}/scripts/Python/interface/SBQueueItem.i"\
Johnny Chen8a8ce4a2011-09-09 17:37:06 +0000161" ${SRC_ROOT}/scripts/Python/interface/SBSourceManager.i"\
162" ${SRC_ROOT}/scripts/Python/interface/SBStream.i"\
163" ${SRC_ROOT}/scripts/Python/interface/SBStringList.i"\
164" ${SRC_ROOT}/scripts/Python/interface/SBSymbol.i"\
165" ${SRC_ROOT}/scripts/Python/interface/SBSymbolContext.i"\
166" ${SRC_ROOT}/scripts/Python/interface/SBTarget.i"\
167" ${SRC_ROOT}/scripts/Python/interface/SBThread.i"\
Kuba Breckaa5ea1e22014-09-06 01:21:19 +0000168" ${SRC_ROOT}/scripts/Python/interface/SBThreadCollection.i"\
Jim Ingham2bdbfd52014-09-29 23:17:18 +0000169" ${SRC_ROOT}/scripts/Python/interface/SBThreadPlan.i"\
Johnny Chen8a8ce4a2011-09-09 17:37:06 +0000170" ${SRC_ROOT}/scripts/Python/interface/SBType.i"\
Enrico Granata061858c2012-02-15 02:34:21 +0000171" ${SRC_ROOT}/scripts/Python/interface/SBTypeCategory.i"\
172" ${SRC_ROOT}/scripts/Python/interface/SBTypeFilter.i"\
173" ${SRC_ROOT}/scripts/Python/interface/SBTypeFormat.i"\
174" ${SRC_ROOT}/scripts/Python/interface/SBTypeNameSpecifier.i"\
175" ${SRC_ROOT}/scripts/Python/interface/SBTypeSummary.i"\
176" ${SRC_ROOT}/scripts/Python/interface/SBTypeSynthetic.i"\
Johnny Chen8a8ce4a2011-09-09 17:37:06 +0000177" ${SRC_ROOT}/scripts/Python/interface/SBValue.i"\
Johnny Chend4dd7992011-09-27 01:19:20 +0000178" ${SRC_ROOT}/scripts/Python/interface/SBValueList.i"\
Todd Fiala802dc4022014-06-23 19:30:49 +0000179" ${SRC_ROOT}/scripts/Python/interface/SBWatchpoint.i"\
180" ${SRC_ROOT}/scripts/Python/interface/SBUnixSignals.i"
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000181
Jason Molenda47d114a2012-09-27 21:26:57 +0000182if [ $Debug -eq 1 ]
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000183then
184 echo "Header files are:"
185 echo ${HEADER_FILES}
186fi
187
Jason Molenda47d114a2012-09-27 21:26:57 +0000188if [ $Debug -eq 1 ]
Enrico Granata9128ee22011-09-06 19:20:51 +0000189then
190 echo "SWIG interface files are:"
191 echo ${INTERFACE_FILES}
192fi
193
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000194NeedToUpdate=0
195
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000196
Johnny Chen5fca8ca2010-08-26 20:04:17 +0000197if [ ! -f ${swig_output_file} ]
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000198then
199 NeedToUpdate=1
Jason Molenda47d114a2012-09-27 21:26:57 +0000200 if [ $Debug -eq 1 ]
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000201 then
202 echo "Failed to find LLDBWrapPython.cpp"
203 fi
204fi
205
Jason Molenda47d114a2012-09-27 21:26:57 +0000206if [ $NeedToUpdate -eq 0 ]
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000207then
208 for hdrfile in ${HEADER_FILES}
209 do
Johnny Chen5fca8ca2010-08-26 20:04:17 +0000210 if [ $hdrfile -nt ${swig_output_file} ]
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000211 then
212 NeedToUpdate=1
Jason Molenda47d114a2012-09-27 21:26:57 +0000213 if [ $Debug -eq 1 ]
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000214 then
215 echo "${hdrfile} is newer than ${swig_output_file}"
216 echo "swig file will need to be re-built."
217 fi
Johnny Chen5fca8ca2010-08-26 20:04:17 +0000218 break
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000219 fi
220 done
221fi
222
Jason Molenda47d114a2012-09-27 21:26:57 +0000223if [ $NeedToUpdate -eq 0 ]
Johnny Chen5fca8ca2010-08-26 20:04:17 +0000224then
Enrico Granata9128ee22011-09-06 19:20:51 +0000225 for intffile in ${INTERFACE_FILES}
226 do
227 if [ $intffile -nt ${swig_output_file} ]
228 then
229 NeedToUpdate=1
Jason Molenda47d114a2012-09-27 21:26:57 +0000230 if [ $Debug -eq 1 ]
Enrico Granata9128ee22011-09-06 19:20:51 +0000231 then
232 echo "${intffile} is newer than ${swig_output_file}"
233 echo "swig file will need to be re-built."
234 fi
235 break
236 fi
237 done
238fi
239
Jason Molenda47d114a2012-09-27 21:26:57 +0000240if [ $NeedToUpdate -eq 0 ]
Enrico Granata9128ee22011-09-06 19:20:51 +0000241then
Johnny Chen5fca8ca2010-08-26 20:04:17 +0000242 if [ ${swig_input_file} -nt ${swig_output_file} ]
243 then
244 NeedToUpdate=1
Jason Molenda47d114a2012-09-27 21:26:57 +0000245 if [ $Debug -eq 1 ]
Johnny Chen5fca8ca2010-08-26 20:04:17 +0000246 then
247 echo "${swig_input_file} is newer than ${swig_output_file}"
248 echo "swig file will need to be re-built."
249 fi
250 fi
251fi
252
Jason Molenda47d114a2012-09-27 21:26:57 +0000253if [ $NeedToUpdate -eq 0 ]
Caroline Ticeceb6b132010-10-26 03:11:13 +0000254then
Johnny Chen30123f12011-08-22 22:10:57 +0000255 if [ ${swig_python_extensions} -nt ${swig_output_file} ]
Caroline Ticeceb6b132010-10-26 03:11:13 +0000256 then
257 NeedToUpdate=1
Jason Molenda47d114a2012-09-27 21:26:57 +0000258 if [ $Debug -eq 1 ]
Caroline Ticeceb6b132010-10-26 03:11:13 +0000259 then
Johnny Chen30123f12011-08-22 22:10:57 +0000260 echo "${swig_python_extensions} is newer than ${swig_output_file}"
261 echo "swig file will need to be re-built."
262 fi
263 fi
264fi
265
Jason Molenda47d114a2012-09-27 21:26:57 +0000266if [ $NeedToUpdate -eq 0 ]
Johnny Chen30123f12011-08-22 22:10:57 +0000267then
268 if [ ${swig_python_wrapper} -nt ${swig_output_file} ]
269 then
270 NeedToUpdate=1
Jason Molenda47d114a2012-09-27 21:26:57 +0000271 if [ $Debug -eq 1 ]
Johnny Chen30123f12011-08-22 22:10:57 +0000272 then
273 echo "${swig_python_wrapper} is newer than ${swig_output_file}"
Caroline Ticeceb6b132010-10-26 03:11:13 +0000274 echo "swig file will need to be re-built."
275 fi
276 fi
277fi
278
Jason Molenda47d114a2012-09-27 21:26:57 +0000279if [ $NeedToUpdate -eq 0 ]
Enrico Granata9d2063e2012-02-02 17:26:00 +0000280then
281 if [ ${swig_python_typemaps} -nt ${swig_output_file} ]
282 then
283 NeedToUpdate=1
Jason Molenda47d114a2012-09-27 21:26:57 +0000284 if [ $Debug -eq 1 ]
Enrico Granata9d2063e2012-02-02 17:26:00 +0000285 then
286 echo "${swig_python_typemaps} is newer than ${swig_output_file}"
287 echo "swig file will need to be re-built."
288 fi
289 fi
290fi
291
Enrico Granatac972c702013-06-21 18:57:30 +0000292if [ $NeedToUpdate -eq 0 ]
293then
294 if [ ${swig_python_swigsafecast} -nt ${swig_output_file} ]
295 then
296 NeedToUpdate=1
297 if [ $Debug -eq 1 ]
298 then
299 echo "${swig_python_swigsafecast} is newer than ${swig_output_file}"
300 echo "swig file will need to be re-built."
301 fi
302 fi
303fi
304
Ed Masted010f9a2014-05-07 12:52:08 +0000305python_version=`${PYTHON} --version 2>&1 | sed -e 's,Python ,,' -e 's,[.][0-9],,2' -e 's,[a-z][a-z][0-9],,'`
Caroline Ticed6ac3842010-06-16 19:26:52 +0000306
Filipe Cabecinhasc281a3b2012-11-01 18:55:16 +0000307if [ $MakefileCalled -eq 0 ]
Caroline Ticed6ac3842010-06-16 19:26:52 +0000308then
Filipe Cabecinhasc281a3b2012-11-01 18:55:16 +0000309 framework_python_dir="${TARGET_DIR}/LLDB.framework/Resources/Python/lldb"
Caroline Ticed6ac3842010-06-16 19:26:52 +0000310else
Filipe Cabecinhasc281a3b2012-11-01 18:55:16 +0000311 if [ -n "${PYTHON_INSTALL_DIR}" ]
312 then
Ed Masted010f9a2014-05-07 12:52:08 +0000313 framework_python_dir=`${PYTHON} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True, False, \"${PYTHON_INSTALL_DIR}\");"`/lldb
Filipe Cabecinhasc281a3b2012-11-01 18:55:16 +0000314 else
Ed Masted010f9a2014-05-07 12:52:08 +0000315 framework_python_dir=`${PYTHON} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True, False);"`/lldb
Filipe Cabecinhasc281a3b2012-11-01 18:55:16 +0000316 fi
Caroline Ticed6ac3842010-06-16 19:26:52 +0000317fi
318
Filipe Cabecinhasc281a3b2012-11-01 18:55:16 +0000319[ -n "${CONFIG_BUILD_DIR}" ] || CONFIG_BUILD_DIR=${framework_python_dir}
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000320
321if [ ! -L "${framework_python_dir}/_lldb.so" ]
322then
323 NeedToUpdate=1
324fi
325
Filipe Cabecinhasc281a3b2012-11-01 18:55:16 +0000326if [ ! -f "${framework_python_dir}/__init__.py" ]
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000327then
328 NeedToUpdate=1
329fi
330
331
Jason Molenda47d114a2012-09-27 21:26:57 +0000332if [ $NeedToUpdate -eq 0 ]
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000333then
334 echo "Everything is up-to-date."
335 exit 0
336else
337 echo "SWIG needs to be re-run."
Caroline Ticeceb6b132010-10-26 03:11:13 +0000338 if [ -f ${swig_output_file} ]
339 then
340 rm ${swig_output_file}
341 fi
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000342fi
343
344
345# Build the SWIG C++ wrapper file for Python.
346
Filipe Cabecinhasc281a3b2012-11-01 18:55:16 +0000347if [ $GenerateDependencies -eq 1 ]
348then
349 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}"
350 then
351 mv -f "${swig_depend_file}.tmp" "${swig_depend_file}"
352 else
353 rm -f "${swig_depend_file}.tmp"
354 exit 1
355 fi
356else
357 $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 $?
358fi
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000359
Johnny Chenf1c95f82011-04-29 19:22:24 +0000360# Implement the iterator protocol and/or eq/ne operators for some lldb objects.
Caroline Ticeebc1bb22010-06-30 16:22:25 +0000361# Append global variable to lldb Python module.
Johnny Chenfbc0d272011-04-28 21:31:18 +0000362# And initialize the lldb debugger subsystem.
Caroline Ticeebc1bb22010-06-30 16:22:25 +0000363current_dir=`pwd`
Johnny Chenfbc0d272011-04-28 21:31:18 +0000364if [ -f "${current_dir}/modify-python-lldb.py" ]
Caroline Ticeebc1bb22010-06-30 16:22:25 +0000365then
Ed Masted010f9a2014-05-07 12:52:08 +0000366 ${PYTHON} ${current_dir}/modify-python-lldb.py ${CONFIG_BUILD_DIR}
Caroline Ticeebc1bb22010-06-30 16:22:25 +0000367fi
Caroline Tice3cc87512010-10-28 21:51:20 +0000368
Greg Claytondce502e2011-11-04 03:34:56 +0000369
Greg Claytondce502e2011-11-04 03:34:56 +0000370fi