Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | |
| 3 | # build-swig-wrapper-classes.sh |
| 4 | # |
| 5 | # For each scripting language liblldb supports, we need to create the |
| 6 | # appropriate Script Bridge wrapper classes for that language so that |
| 7 | # users can call Script Bridge functions from within the script interpreter. |
| 8 | # |
| 9 | # We use SWIG to help create the appropriate wrapper classes/functions for |
| 10 | # the scripting language. In some cases the file generated by SWIG may |
| 11 | # need some tweaking before it is completely ready to use. |
| 12 | |
| 13 | debug_flag=$1 |
| 14 | |
| 15 | if [ -n "$debug_flag" -a "$debug_flag" == "-debug" ] |
| 16 | then |
| 17 | Debug=1 |
| 18 | else |
| 19 | Debug=0 |
| 20 | fi |
| 21 | |
| 22 | # |
| 23 | # Verify that 'lldb.swig' exists. |
| 24 | # |
| 25 | |
| 26 | if [ ! -f ${SRCROOT}/scripts/lldb.swig ] |
| 27 | then |
| 28 | echo Error: unable to find file 'lldb.swig' >&2 |
| 29 | exit 1 |
| 30 | fi |
| 31 | |
| 32 | if [ $Debug == 1 ] |
| 33 | then |
| 34 | echo "Found lldb.swig file" |
| 35 | fi |
| 36 | |
| 37 | # |
| 38 | # For each scripting language, make sure the build script for that language |
| 39 | # exists, and if so, call it. |
| 40 | # |
| 41 | # For now the only language we support is Python, but we expect this to |
| 42 | # change. |
| 43 | |
| 44 | languages="Python" |
| 45 | cwd=${SRCROOT}/scripts |
| 46 | |
| 47 | for curlang in $languages |
| 48 | do |
| 49 | if [ $Debug == 1 ] |
| 50 | then |
| 51 | echo "Current language is $curlang" |
| 52 | fi |
| 53 | |
| 54 | if [ ! -d "$cwd/$curlang" ] |
| 55 | then |
| 56 | echo "Error: unable to find $curlang script sub-dirctory" >&2 |
| 57 | continue |
| 58 | else |
| 59 | |
| 60 | if [ $Debug == 1 ] |
| 61 | then |
| 62 | echo "Found $curlang sub-directory" |
| 63 | fi |
| 64 | |
| 65 | cd $cwd/$curlang |
| 66 | |
| 67 | filename="./build-swig-${curlang}.sh" |
| 68 | |
| 69 | if [ ! -f $filename ] |
| 70 | then |
| 71 | echo "Error: unable to find swig build script for $curlang: $filename" >&2 |
| 72 | continue |
| 73 | else |
| 74 | |
| 75 | if [ $Debug == 1 ] |
| 76 | then |
| 77 | echo "Found $curlang build script." |
| 78 | echo "Executing $curlang build script..." |
| 79 | fi |
| 80 | |
| 81 | ./build-swig-${curlang}.sh |
| 82 | fi |
| 83 | fi |
| 84 | done |
| 85 | |