2010-06-09 00:52:24 +08:00
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
# finish-swig-wrapper-classes.sh
|
|
|
|
#
|
|
|
|
# For each scripting language liblldb supports, we need to create the
|
2012-11-02 02:55:16 +08:00
|
|
|
# appropriate Script Bridge wrapper classes for that language so that
|
2010-06-09 00:52:24 +08:00
|
|
|
# users can call Script Bridge functions from within the script interpreter.
|
2012-11-02 02:55:16 +08:00
|
|
|
#
|
2010-06-09 00:52:24 +08:00
|
|
|
# We use SWIG to create a C++ file containing the appropriate wrapper classes
|
|
|
|
# and funcitons for each scripting language, before liblldb is built (thus
|
|
|
|
# the C++ file can be compiled into liblldb. In some cases, additional work
|
|
|
|
# may need to be done after liblldb has been compiled, to make the scripting
|
|
|
|
# language stuff fully functional. Any such post-processing is handled through
|
|
|
|
# the shell scripts called here.
|
|
|
|
|
2010-06-17 03:26:52 +08:00
|
|
|
# SRC_ROOT is the root of the lldb source tree.
|
|
|
|
# TARGET_DIR is where the lldb framework/shared library gets put.
|
|
|
|
# CONFIG_BUILD_DIR is where the build-swig-Python-LLDB.sh shell script
|
|
|
|
# put the lldb.py file it generated from running SWIG.
|
|
|
|
# PREFIX is the root directory used to determine where third-party modules
|
|
|
|
# for scripting languages should be installed.
|
|
|
|
# debug_flag (optional) determines whether or not this script outputs
|
|
|
|
# additional information when running.
|
|
|
|
|
|
|
|
SRC_ROOT=$1
|
|
|
|
TARGET_DIR=$2
|
|
|
|
CONFIG_BUILD_DIR=$3
|
|
|
|
PREFIX=$4
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2012-11-02 02:55:16 +08:00
|
|
|
shift 4
|
|
|
|
|
|
|
|
if [ -n "$1" -a "$1" = "-debug" ]
|
2010-06-09 00:52:24 +08:00
|
|
|
then
|
2012-11-02 02:55:16 +08:00
|
|
|
debug_flag=$1
|
2010-06-09 00:52:24 +08:00
|
|
|
Debug=1
|
2012-11-02 02:55:16 +08:00
|
|
|
shift
|
2010-06-09 00:52:24 +08:00
|
|
|
else
|
2012-11-02 02:55:16 +08:00
|
|
|
debug_flag=""
|
2010-06-09 00:52:24 +08:00
|
|
|
Debug=0
|
|
|
|
fi
|
|
|
|
|
2012-11-02 02:55:16 +08:00
|
|
|
if [ -n "$1" -a "$1" = "-m" ]
|
|
|
|
then
|
|
|
|
makefile_flag="$1"
|
|
|
|
shift
|
|
|
|
else
|
|
|
|
makefile_flag=""
|
|
|
|
fi
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
#
|
2012-11-02 02:55:16 +08:00
|
|
|
# For each scripting language, see if a post-processing script for that
|
2010-06-09 00:52:24 +08:00
|
|
|
# language exists, and if so, call it.
|
|
|
|
#
|
|
|
|
# For now the only language we support is Python, but we expect this to
|
|
|
|
# change.
|
|
|
|
|
|
|
|
languages="Python"
|
2010-06-17 03:26:52 +08:00
|
|
|
cwd=${SRC_ROOT}/scripts
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
for curlang in $languages
|
|
|
|
do
|
2012-09-28 05:26:57 +08:00
|
|
|
if [ $Debug -eq 1 ]
|
2010-06-09 00:52:24 +08:00
|
|
|
then
|
|
|
|
echo "Current language is $curlang"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d "$cwd/$curlang" ]
|
|
|
|
then
|
|
|
|
echo "error: unable to find $curlang script sub-dirctory" >&2
|
|
|
|
continue
|
|
|
|
else
|
|
|
|
|
2012-09-28 05:26:57 +08:00
|
|
|
if [ $Debug -eq 1 ]
|
2010-06-09 00:52:24 +08:00
|
|
|
then
|
|
|
|
echo "Found $curlang sub-directory"
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd $cwd/$curlang
|
|
|
|
|
2010-06-17 03:26:52 +08:00
|
|
|
filename="./finish-swig-${curlang}-LLDB.sh"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
if [ -f $filename ]
|
|
|
|
then
|
2012-09-28 05:26:57 +08:00
|
|
|
if [ $Debug -eq 1 ]
|
2010-06-09 00:52:24 +08:00
|
|
|
then
|
2010-06-17 03:26:52 +08:00
|
|
|
echo "Found $curlang post-processing script for LLDB"
|
2010-06-09 00:52:24 +08:00
|
|
|
echo "Executing $curlang post-processing script..."
|
|
|
|
fi
|
|
|
|
|
2012-11-02 02:55:16 +08:00
|
|
|
|
|
|
|
./finish-swig-${curlang}-LLDB.sh $SRC_ROOT $TARGET_DIR $CONFIG_BUILD_DIR "${PREFIX}" "${debug_flag}" "${makefile_flag}"
|
2010-06-09 00:52:24 +08:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
exit 0
|