blob: 5582ba0a6622023efc9519689a5c1703e8dc9107 [file] [log] [blame]
Chris Lattner24943d22010-06-08 16:52:24 +00001#!/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
Caroline Tice9dbe7172010-06-16 19:26:52 +000013# Below are the arguments/parameters that this script takes (and passes along
14# to all the language-specific build scripts that it calls):
15#
16# 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 was generated from running SWIG.
20# PREFIX is where non-Darwin systems want to put the .py and .so
21# files so that Python can find them automatically.
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
30
31#
32# Check to see if we are in debug-mode or not.
33#
Chris Lattner24943d22010-06-08 16:52:24 +000034
35if [ -n "$debug_flag" -a "$debug_flag" == "-debug" ]
36then
37 Debug=1
38else
39 Debug=0
40fi
41
42#
43# Verify that 'lldb.swig' exists.
44#
45
Caroline Tice9dbe7172010-06-16 19:26:52 +000046if [ ! -f ${SRC_ROOT}/scripts/lldb.swig ]
Chris Lattner24943d22010-06-08 16:52:24 +000047then
48 echo Error: unable to find file 'lldb.swig' >&2
49 exit 1
50fi
51
52if [ $Debug == 1 ]
53then
54 echo "Found lldb.swig file"
55fi
56
57#
58# For each scripting language, make sure the build script for that language
59# exists, and if so, call it.
60#
61# For now the only language we support is Python, but we expect this to
62# change.
63
64languages="Python"
Caroline Tice9dbe7172010-06-16 19:26:52 +000065cwd=${SRC_ROOT}/scripts
Chris Lattner24943d22010-06-08 16:52:24 +000066
67for curlang in $languages
68do
69 if [ $Debug == 1 ]
70 then
71 echo "Current language is $curlang"
72 fi
73
74 if [ ! -d "$cwd/$curlang" ]
75 then
76 echo "Error: unable to find $curlang script sub-dirctory" >&2
77 continue
78 else
79
80 if [ $Debug == 1 ]
81 then
82 echo "Found $curlang sub-directory"
83 fi
84
85 cd $cwd/$curlang
86
87 filename="./build-swig-${curlang}.sh"
88
89 if [ ! -f $filename ]
90 then
91 echo "Error: unable to find swig build script for $curlang: $filename" >&2
92 continue
93 else
94
95 if [ $Debug == 1 ]
96 then
97 echo "Found $curlang build script."
98 echo "Executing $curlang build script..."
99 fi
100
Caroline Tice9dbe7172010-06-16 19:26:52 +0000101 ./build-swig-${curlang}.sh $SRC_ROOT $TARGET_DIR $CONFIG_BUILD_DIR "${PREFIX}" "${debug_flag}"
Chris Lattner24943d22010-06-08 16:52:24 +0000102 fi
103 fi
104done
105