diff options
Diffstat (limited to 'lldb/scripts/build-swig-wrapper-classes.sh')
-rwxr-xr-x | lldb/scripts/build-swig-wrapper-classes.sh | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/lldb/scripts/build-swig-wrapper-classes.sh b/lldb/scripts/build-swig-wrapper-classes.sh new file mode 100755 index 00000000000..3d1cf74344f --- /dev/null +++ b/lldb/scripts/build-swig-wrapper-classes.sh @@ -0,0 +1,85 @@ +#!/bin/sh + +# build-swig-wrapper-classes.sh +# +# For each scripting language liblldb supports, we need to create the +# appropriate Script Bridge wrapper classes for that language so that +# users can call Script Bridge functions from within the script interpreter. +# +# We use SWIG to help create the appropriate wrapper classes/functions for +# the scripting language. In some cases the file generated by SWIG may +# need some tweaking before it is completely ready to use. + +debug_flag=$1 + +if [ -n "$debug_flag" -a "$debug_flag" == "-debug" ] +then + Debug=1 +else + Debug=0 +fi + +# +# Verify that 'lldb.swig' exists. +# + +if [ ! -f ${SRCROOT}/scripts/lldb.swig ] +then + echo Error: unable to find file 'lldb.swig' >&2 + exit 1 +fi + +if [ $Debug == 1 ] +then + echo "Found lldb.swig file" +fi + +# +# For each scripting language, make sure the build script for that language +# exists, and if so, call it. +# +# For now the only language we support is Python, but we expect this to +# change. + +languages="Python" +cwd=${SRCROOT}/scripts + +for curlang in $languages +do + if [ $Debug == 1 ] + then + echo "Current language is $curlang" + fi + + if [ ! -d "$cwd/$curlang" ] + then + echo "Error: unable to find $curlang script sub-dirctory" >&2 + continue + else + + if [ $Debug == 1 ] + then + echo "Found $curlang sub-directory" + fi + + cd $cwd/$curlang + + filename="./build-swig-${curlang}.sh" + + if [ ! -f $filename ] + then + echo "Error: unable to find swig build script for $curlang: $filename" >&2 + continue + else + + if [ $Debug == 1 ] + then + echo "Found $curlang build script." + echo "Executing $curlang build script..." + fi + + ./build-swig-${curlang}.sh + fi + fi +done + |