User Tools

Site Tools


server:server_compiling_script
#!/usr/bin/env bash
 
 
die() {
        echo "Error: $@" >&2
        exit 1
}
 
checkout_or_up() {
        if [[ ! -d "${1}.svn" ]]; then
                svn co https://crossfire.svn.sourceforge.net/svnroot/crossfire/"${1}"/trunk "${1}.svn"
        else
                ( cd "${1}.svn" && svn up )
        fi
}
 
export CFLAGS="-O0 -ggdb3"
export PATH="/usr/local:$PATH"
cd || die "Couldn't go to home"
checkout_or_up arch || die "Checkout arch failed"
checkout_or_up server || die "Checkout server failed"
checkout_or_up maps || die "Checkout maps failed"
 
cd server.svn/ || die "Couldn't change directory to server.svn"
#patch -R -p0 -i ../automess.patch
[[ -d /usr/games/crossfire ]] || ( echo "/usr/games/crossfire does not exist create this directory and make sure it is owned by this user as root" &&\
        echo " mkdir -p /usr/games/crossfire &&  chown "`whoami`"."`whoami`" /usr/games/crossfire/" && echo "" &&\
        echo "If you want server loging run this command as root" &&\
        echo " mkdir -p /var/log/crossfire &&  chown "`whoami`"."`whoami`" /var/log/crossfire/" && echo "" &&\
        echo "when this is done re-run his script" ) 
[[ -d /usr/games/crossfire ]] || exit 1
 
[[ -d lib/arch ]] || (cd lib && ln -s ../../arch.svn arch )
[[ -d maps ]] || ( ln -s ../maps.svn maps )
[[ -d /usr/games/crossfire/share/crossfire ]] || ( mkdir -p /usr/games/crossfire/share/crossfire )
[[ -d /usr/games/crossfire/share/crossfire/maps ]] || ( ln -s ~/maps.svn /usr/games/crossfire/share/crossfire/maps )
 
 
[[ -e macros/libtool.m4 ]] || ( bash autogen.sh )
##uncoment if you are using a special build of automes like required on centos5
#[[ -f macros/libtool.m4 ]] || cp /usr/share/aclocal/libtool.m4 macros/
#/usr/local/bin/autoreconf --install || die "Autoreconf failed"
autoreconf --install || die "Autoreconf failed"
[[ -f Makefile ]] && make distclean
#export CFLAGS=-DEXP_DEBUG
./configure || die "Configure failed"
cd lib || die "Couldn't change directory to lib"
make collect || die "Make collect failed"
cd .. || die "Couldn't change directory to back up from lib"
nice -n 19 make -j 4 || die "Server compile failed"
 
cp /usr/games/crossfire/bin/crossfire-server /usr/games/crossfire/bin/`date +%F`-crossfire-server
make install || die "Make install failed"
make check
#remove varios things here
#rm -f /usr/games/crossfire/lib/crossfire/plugins/citylife*
#rm -f /usr/games/crossfire/lib/crossfire/plugins/*darcap*
rm -f /usr/games/crossfire/share/crossfire/maps/python/*pyc
 
echo ""
echo "If the compile did not end in errors"
echo "Your crossfire server has been installed in /usr/games/crossfire/bin/"
echo "Running crossfire processes"
echo ""
 
ps -ef | grep crossfire
 
echo $'\a \a'
server/server_compiling_script.txt · Last modified: 2014/09/11 01:39 (external edit)