#!/bin/bash
# install and build planeshift from cvs
#
CODATE="2005-05-18"
#
if [ $USER = "root" ]; then
echo "installing required packages..."
apt-get install bison-1.35 flex-old libmng-dev libmikmod2-dev libogg-dev libvorbis-dev zlib1g-dev libpng3-dev libjpeg62-dev xlibmesa-glu-dev python2.3-dev autoconf automake1.8 libcurl3-dev jam cvs
exit;
else
MYPSHOME=/home/$USER/ps
fi
if [ $1 ]; then
if [ $1 eq "--help" ]; then
echo "Usage: psinst [noconf] [PSHOME=path]"
echo "Install and build planeshift"
echo "Run it as root to install required packages"
echo "Run it as a normal user to checkout and build"
echo " noconf : script will not configure targets"
echo " path : the path where you want to checkout and build planeshift components (for ex : /home/me/ps)"
exit;
fi
if [ $1 eq "noconf" ]; then
NOCONF=1
fi
fi
if [ -z $PSHOME ]; then
PSHOME=$MYPSHOME
fi
if [ -d $PSHOME ]; then
echo "found ps home dir"
else
mkdir -p $PSHOME
fi
export LD_LIBRARY_PATH=$PSHOME/cal3d/src/cal3d/.libs/:$LD_LIBRARY_PATH
export CRYSTAL=$PSHOME/CS
export CEL=$PSHOME/cel
export CSCONFPATH=$PSHOME/cel
# checkout sources
echo "checking out"
if [ -d "$PSHOME/cal3d" ]; then
echo "...found cal3d..."
else
cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/cal3d login
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/cal3d co -D$CODATE cal3d
fi
if [ -d $PSHOME/CS ]; then
echo "...found CS..."
else
cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/crystal login
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/crystal co -D$CODATE CS
fi
if [ -d $PSHOME/cel ]; then
echo "...found cel..."
else
cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/cel login
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/cel co -D$CODATE cel
fi
if [ -d $PSHOME/planeshift ]; then
echo "...found planeshift..."
else
cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/planeshift login
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/planeshift co -D$CODATE planeshift
fi
# build targets
echo "...building targets..."
cd cal3d
if [ $NOCONF ]; then
./autogen.sh
./configure
fi
echo "...building cal3d..."
make
cd ../CS
if [ $NOCONF ]; then
./configure --enable-debug --with-libcal3d=../cal3d/src/cal3d/.libs/ CPPFLAGS="-I ../cal3d/src/"
fi
echo "...building CS..."
jam libs
jam plugins
jam cs-config
cd ../cel
if [ $NOCONF ]; then
./configure --enable-debug
fi
echo "...building cel..."
jam -a
cd ../planeshift
if [ -h $PSHOME/planeshift/cal3d ]; then
echo "...found cal3d link in planeshift dir..."
else
ln -s ../cal3d/src/cal3d/ cal3d
fi
if [ $NOCONF ]; then
./autogen.sh
./configure --enable-debug --with-libcal3d=$PSHOME/cal3d
fi
echo "...building planeshift..."
jam -a
cd ..
# updater
cd planeshift
if [ -e "updater" ]; then
echo "...running updater..."
./updater --auto
cd ..
echo "finished"