]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - scripts/finish-swig-wrapper-classes.sh
Vendor import of lldb trunk r256945:
[FreeBSD/FreeBSD.git] / scripts / finish-swig-wrapper-classes.sh
1 #! /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
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 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
25 SRC_ROOT=$1
26 TARGET_DIR=$2
27 CONFIG_BUILD_DIR=$3
28 PREFIX=$4
29
30 shift 4
31
32 if [ -n "$1" -a "$1" = "-debug" ]
33 then
34     debug_flag=$1
35     Debug=1
36     shift
37 else
38     debug_flag=""
39     Debug=0
40 fi
41
42 if [ -n "$1" -a "$1" = "-m" ]
43 then
44     makefile_flag="$1"
45     shift
46 else
47     makefile_flag=""
48 fi
49
50 #
51 # For each scripting language, see if a post-processing script for that
52 # language exists, and if so, call it.
53 #
54 # For now the only language we support is Python, but we expect this to
55 # change.
56
57 languages="Python"
58 cwd=${SRC_ROOT}/scripts
59
60 for curlang in $languages
61 do
62     if [ $Debug -eq 1 ]
63     then
64         echo "Current language is $curlang"
65     fi
66
67     if [ ! -d "$cwd/$curlang" ]
68     then
69         echo "error:  unable to find $curlang script sub-dirctory" >&2
70         continue
71     else
72
73         if [ $Debug -eq 1 ]
74         then
75             echo "Found $curlang sub-directory"
76         fi
77
78         cd $cwd/$curlang
79
80         filename="./finish-swig-${curlang}-LLDB.sh"
81
82         if [ -f $filename ]
83         then
84             if [ $Debug -eq 1 ]
85             then
86                 echo "Found $curlang post-processing script for LLDB"
87                 echo "Executing $curlang post-processing script..."
88             fi
89
90
91             ./finish-swig-${curlang}-LLDB.sh $SRC_ROOT $TARGET_DIR $CONFIG_BUILD_DIR "${PREFIX}" "${debug_flag}" "${makefile_flag}"
92             retval=$?
93             if [ $retval -ne 0 ]; then
94                 echo "$(pwd)/finish-swig-${curlang}-LLDB.sh failed with exit code $retval"
95                 exit $retval
96             fi
97         fi
98     fi
99 done
100
101 exit 0