build-swig-wrapper-classes.sh [plain text]
#!/bin/sh
SRC_ROOT=$1
TARGET_DIR=$2
CONFIG_BUILD_DIR=$3
PREFIX=$4
shift 4
if [ -n "$1" -a "$1" = "-debug" ]
then
debug_flag="$1"
Debug=1
shift
else
debug_flag=""
Debug=0
fi
if [ -n "$1" -a "$1" = "-m" ]
then
makefile_flag="$1"
shift
if [ -n "$1" -a "$1" = "-M" ]
then
dependency_flag="$1"
shift
else
dependency_flag=""
fi
else
makefile_flag=""
dependency_flag=""
fi
if [ ! -f ${SRC_ROOT}/scripts/lldb.swig ]
then
echo Error: unable to find file 'lldb.swig' >&2
exit 1
fi
if [ $Debug -eq 1 ]
then
echo "Found lldb.swig file"
fi
SWIG=`which swig`
if [ ! -x "$SWIG" -a -f /usr/bin/swig ]
then
SWIG=/usr/bin/swig
else
if [ -f /usr/local/bin/swig ]
then
SWIG=/usr/local/bin/swig
fi
fi
if [ ${SWIG}a = a ]
then
echo Error: could not find the swig binary
exit 1
fi
languages="Python"
cwd=${SRC_ROOT}/scripts
for curlang in $languages
do
if [ $Debug -eq 1 ]
then
echo "Current language is $curlang"
fi
if [ ! -d "$cwd/$curlang" ]
then
echo "Error: unable to find $curlang script sub-dirctory" >&2
continue
else
if [ $Debug -eq 1 ]
then
echo "Found $curlang sub-directory"
fi
cd $cwd/$curlang
filename="./build-swig-${curlang}.sh"
if [ ! -f $filename ]
then
echo "Error: unable to find swig build script for $curlang: $filename" >&2
continue
else
if [ $Debug -eq 1 ]
then
echo "Found $curlang build script."
echo "Executing $curlang build script..."
fi
./build-swig-${curlang}.sh "$SRC_ROOT" "$TARGET_DIR" "$CONFIG_BUILD_DIR" "${PREFIX}" "${debug_flag}" "${SWIG}" "${makefile_flag}" "${dependency_flag}" || exit $?
fi
fi
done