mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
203 lines
5.3 KiB
Bash
Executable File
203 lines
5.3 KiB
Bash
Executable File
#!/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"
|
|
|