blob: a9065b202c5c8dbafadce0377073e4a268351954 [file] [log] [blame]
Chris Lattner24943d22010-06-08 16:52:24 +00001#! /bin/sh
2
3# finish-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 create a C++ file containing the appropriate wrapper classes
10# and funcitons for each scripting language, before liblldb is built (thus
11# the C++ file can be compiled into liblldb. In some cases, additional work
12# may need to be done after liblldb has been compiled, to make the scripting
13# language stuff fully functional. Any such post-processing is handled through
14# the shell scripts called here.
15
Caroline Tice9dbe7172010-06-16 19:26:52 +000016# SRC_ROOT is the root of the lldb source tree.
17# TARGET_DIR is where the lldb framework/shared library gets put.
18# CONFIG_BUILD_DIR is where the build-swig-Python-LLDB.sh shell script
19# put the lldb.py file it generated from running SWIG.
20# PREFIX is the root directory used to determine where third-party modules
21# for scripting languages should be installed.
22# debug_flag (optional) determines whether or not this script outputs
23# additional information when running.
24
25SRC_ROOT=$1
26TARGET_DIR=$2
27CONFIG_BUILD_DIR=$3
28PREFIX=$4
29debug_flag=$5
Chris Lattner24943d22010-06-08 16:52:24 +000030
31if [ -n "$debug_flag" -a "$debug_flag" == "-debug" ]
32then
33 Debug=1
34else
35 Debug=0
36fi
37
38
39#
40# For each scripting language, see if a post-processing script for that
41# language exists, and if so, call it.
42#
43# For now the only language we support is Python, but we expect this to
44# change.
45
46languages="Python"
Caroline Tice9dbe7172010-06-16 19:26:52 +000047cwd=${SRC_ROOT}/scripts
Chris Lattner24943d22010-06-08 16:52:24 +000048
49for curlang in $languages
50do
51 if [ $Debug == 1 ]
52 then
53 echo "Current language is $curlang"
54 fi
55
56 if [ ! -d "$cwd/$curlang" ]
57 then
58 echo "error: unable to find $curlang script sub-dirctory" >&2
59 continue
60 else
61
62 if [ $Debug == 1 ]
63 then
64 echo "Found $curlang sub-directory"
65 fi
66
67 cd $cwd/$curlang
68
Caroline Tice9dbe7172010-06-16 19:26:52 +000069 filename="./finish-swig-${curlang}-LLDB.sh"
Chris Lattner24943d22010-06-08 16:52:24 +000070
71 if [ -f $filename ]
72 then
73 if [ $Debug == 1 ]
74 then
Caroline Tice9dbe7172010-06-16 19:26:52 +000075 echo "Found $curlang post-processing script for LLDB"
Chris Lattner24943d22010-06-08 16:52:24 +000076 echo "Executing $curlang post-processing script..."
77 fi
78
Caroline Tice9dbe7172010-06-16 19:26:52 +000079
80 ./finish-swig-${curlang}-LLDB.sh $SRC_ROOT $TARGET_DIR $CONFIG_BUILD_DIR "${PREFIX}" "${debug_flag}"
Chris Lattner24943d22010-06-08 16:52:24 +000081 fi
82 fi
83done
84
85exit 0