open_toontown_panda3d/direct/src/ffi/genPyCode

103 lines
3.5 KiB
Bash
Executable File

#! /bin/bash
# This is just a helper script to generatePythonCode to cover
# the three or four cases we use all the time
# usage: genPyCode [-t] [-v] [-n] [linux|win-debug|win-release|win-publish|install|release] [other libs]
# -t adds libtoontown
# -v adds libvrpn
# -n doesn't perform a squeeze
base_dir=$(pwd)
extra_genPyCode_libs=""
fSqueeze="squeezeMe"
optimizeFlag=""
ppython=ppython
ppythonOptimizeFlag=""
while getopts tvn flag; do
case $flag in
t) extra_genPyCode_libs="$extra_genPyCode_libs libtoontown" ;;
v) extra_genPyCode_libs="$extra_genPyCode_libs libvrpn" ;;
n) fSqueeze="" ;;
esac
done
shift `expr $OPTIND - 1`
buildType="$1"
shift
extra_genPyCode_libs="$extra_genPyCode_libs $*"
if [ "$INSTALL_DIR" != "" ]; then
install_dir=$INSTALL_DIR
elif [ "$PANDA_INSTALL" != "" ]; then
install_dir="$PANDA_INSTALL
elif [ "$DIRECT" != "" ]; then
install_dir=$DIRECT"
else
install_dir=./install
fi
pyDir=$DIRECT/lib/py
extDir=$DIRECT/src/extensions
pSqueezer=$DIRECT/src/showbase/pandaSqueezer.py
if [ $(uname) = "CYGWIN_NT-5.0" ]; then
install_dir=$(cygpath -am $install_dir)
pyDir=$(cygpath -m $pyDir)
extDir=$(cygpath -m $extDir)
pSqueezer=$(cygpath -m $pSqueezer)
fi
if [ "$buildType" = "linux" ]; then
cd $DIRECT/bin
ppython -d generatePythonCode -v -d $pyDir -e $extDir -i libdtoolconfig libpandaexpress libpanda libpandaphysics libdirect $extra_genPyCode_libs || exit
pSqueezer=$DIRECT/src/showbase/pandaSqueezer.py
elif [ "$buildType" = "win-debug" ]; then
cd $DIRECT/bin
ppython -d generatePythonCode -v -d $pyDir -e $extDir -i libdtoolconfig libpandaexpress libpanda libpandaphysics libdirect $extra_genPyCode_libs || exit
elif [ "$buildType" = "win-release" ]; then
cd $DIRECT/bin
ppython generatePythonCode -v -d $pyDir -e $extDir -i libdtoolconfig libpandaexpress libpanda libpandaphysics libdirect $extra_genPyCode_libs || exit
elif [ "$buildType" = "win-publish" ]; then
# no assertions, no comments, no docstrings
cd $DIRECT/bin
ppython -OO generatePythonCode -O -v -d $pyDir -e $extDir -i libdtoolconfig libpandaexpress libpanda libpandaphysics libdirect $extra_genPyCode_libs || exit
optimizeFlag="-O"
ppythonOptimizeFlag="-OO"
elif [ "$buildType" = "install" ]; then
# Use relative paths; as installed on a machine without ctattach etc.
pyDir=$install_dir/lib/py
ppython=$install_dir/bin/ppython
$ppython -d $install_dir/bin/generatePythonCode -O -v -d $pyDir -e direct/src/extensions -i libdtoolconfig libpandaexpress libpanda libpandaphysics libdirect $extra_genPyCode_libs || exit
elif [ "$buildType" = "release" ]; then
# Use relative paths; as installed on a machine without ctattach etc.
pyDir=$install_dir/lib/py
ppython=$install_dir/bin/ppython
$ppython $install_dir/bin/generatePythonCode -v -d $pyDir -e direct/src/extensions -i libdtoolconfig libpandaexpress libpanda libpandaphysics libdirect $extra_genPyCode_libs || exit
pSqueezer=$(cygpath -m $base_dir/direct/src/showbase/pandaSqueezer.py) || exit
else
echo "Invalid parameter: $buildType"
exit 1
fi
if [ "$fSqueeze" = "squeezeMe" ]; then
echo SQUEEZING PandaModules
cd $pyDir || exit
rm -f PandaModules.py* || exit
$ppython $ppythonOptimizeFlag $pSqueezer $optimizeFlag || exit
else
echo RENAMING PandaModulesUnsqueezed.py to PandaModules.py
cd $pyDir || exit
rm -f PandaModules.py* || exit
mv PandaModulesUnsqueezed.py PandaModules.py || exit
fi
echo DONE