| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- #!/bin/bash
- # This script is an experiment. It is designed to automate the
- # Panda3D build process for Linux or Unix users, or for Windows users
- # who have Cygwin installed. If you want to build Panda3D on a
- # Windows machine without Cygwin, please refer to the INSTALL document
- # instead of attempting to run this script.
- # Before you run this script, you must set up your Config.pp file and
- # Config.prc files as described in the INSTALL document, and you must
- # build and install ppremake (or ppremake.exe), before running this
- # script.
- # You should ensure that the install bin directory,
- # e.g. /usr/local/panda/bin, is on your PATH, and that the install lib
- # directory, /usr/local/panda/lib, is on your LD_LIBRARY_PATH (for
- # Unix) or your PATH (for Windows). If you are building Python
- # interfaces, you should also ensure that /usr/local/panda/lib is on
- # your PYTHONPATH.
- # Finally, you must have write permission to the /usr/local/panda
- # directory hierarchy in order for this script to run successfully.
- # As with any automatic process, this script may not work in every
- # environment. An effort has been made to make the script as
- # trouble-free as possible, but things can always go wrong. If you
- # have difficulty running this script, you are encouraged to follow
- # the step-by-step instructions in the INSTALL document to build
- # Panda3D by hand.
- usage="build [\"\"|new|uninstall|install|clean|only|genpy [\"\"|dtool|panda|direct|<relative path>] ]"
- usage=$(cat <<-EOS
- Usage: ./$(basename $0) [ mode [ module [ package ] ] ]
-
- [Be sure to cd to the panda3d directory first.]
-
- mode ""|new|uninstall|install|clean|only|genpy|--help
- module ""|dtool|panda|direct|<relative path>
- package one of the */src/* directories.
- Examples:
- ./build new
- ./build install
- ./build install panda
- ./build clean
- ./build clean panda
- ./build genpy
- ./build only panda express
- ./build quick panda express
- EOS
- )
- mode=$1
- module=$2
- base=$(pwd)
- wantGenPy=1
- #trap "exit" INT
- if [ "$mode" == "--help" ]; then
- echo "$usage"
- exit
- fi
- echo -e "\nSetting up build environment\n"
- if [ -f ./build_env ]; then
- source ./build_env || exit
- fi
- modules="dtool panda pandatool direct $modules"
- if [ "$module" != "" ]; then
- modules="$module"
- fi
- case "$mode" in
- ( only )
- cd $base/$module || exit
- ppremake || exit
- make uninstall install || exit
- modules_ppremake=""
- modules_clean=""
- modules_uninstall=""
- modules_install=""
- ;;
- ( quick )
- cd $base/$module/src/$3 || exit
- make || exit
- cd $base/$module || exit
- make install || exit
- wantGenPy=0
- modules_ppremake=""
- modules_clean=""
- modules_uninstall=""
- modules_install=""
- ;;
- ( new )
- # ...build the newest version of the code:
- echo -e "\nUpdating cvs\n"
- cd "$base" || exit
- ./cvs_update || exit
- cd "$base" || exit
- # This next command is allowed to fail (no || exit):
- echo -e "\nBuilding tags file\n"
- ctags -nR -h '+.I' --langmap='c:+.I' -h '+.T' --langmap='c:+.T' --fields=fmisS
- modules_ppremake=$modules
- modules_clean="direct $modules_clean"
- modules_uninstall=$modules
- modules_install=$modules
- ;;
- ( ppremake )
- wantGenPy=0
- modules_ppremake=$modules
- modules_clean=""
- modules_uninstall=""
- modules_install=""
- ;;
- ( clean )
- wantGenPy=0
- modules_ppremake=$modules
- modules_clean=$modules
- modules_uninstall=""
- modules_install=""
- ;;
- ( uninstall )
- wantGenPy=0
- modules_ppremake=$modules
- modules_clean=""
- modules_uninstall=$modules
- modules_install=""
- ;;
- ( install )
- modules_ppremake=$modules
- modules_clean=""
- modules_uninstall=$modules
- modules_install=$modules
- ;;
- ( "" )
- modules_ppremake=$modules
- # Some modules are small enough that we clean them for good measure:
- modules_clean="direct $modules_clean"
- modules_uninstall=$modules
- modules_install=$modules
- ;;
- ( genpy )
- wantGenPy=1
- modules_ppremake=""
- modules_clean=""
- modules_uninstall=""
- modules_install=""
- ;;
- ( * )
- echo -e "\nThat mode is not recognized ($mode)"
- echo "$usage"
- exit 1
- ;;
- esac
- echo " modules_ppremake =$modules_ppremake"
- echo " modules_clean =$modules_clean"
- echo " modules_uninstall =$modules_uninstall"
- echo " modules_install =$modules_install"
- for i in $modules_ppremake; do
- echo -e "\nStarting Ppremake of $i\n"
- cd "$base/$i" || exit
- ppremake $ppremake_args || exit
- done
- for i in $modules_clean; do
- echo -e "\nStarting Clean of $i\n"
- cd "$base/$i" || exit
- make clean || exit
- done
- for i in $modules_uninstall; do
- echo -e "\nStarting Uninstall of $i\n"
- cd "$base/$i" || exit
- make uninstall || exit
- done
- for i in $modules_install; do
- echo -e "\nStarting Install (build) of $i\n"
- cd "$base/$i" || exit
- make install || exit
- done
- cd "$base"
- if (($wantGenPy)); then
- # Generate Python code:
- echo "Generating Python/C++ interface code"
- #cd $base || exit
- genPyCode || exit
- fi
- if [ ! -f "$INSTALL_DIR/etc/config.prc" -a -f "$HOME/config.prc" ]; then
- echo ""
- echo "A .prc file was found at '$HOME/config.prc' creating a hard link from '$INSTALL_DIR/etc/'"
- ( cd "$INSTALL_DIR/etc" && ln "$HOME/config.prc" . );
- fi
- echo "done"
|