#!/bin/sh

# builds rpm package
#
# the purpose of this script is to make it easier for distribution builders to
# generate their RPM files; custom BuidRoot- settings are supported.
# It should be possible to make all adatpions by just setting the variables
# here at the beginning appropriately.
# all command line parameters are passed down to the CVS checkout/update commands
# so you can easily select different versions ( provided I did not forget to tag them )

#set RPM top directory ( needed to have a place to unpack the sources )
test $PRMTOPDIR || RPMTOPDIR=/usr/src/redhat

#prefix to install the program to
test $PREFIX || PREFIX=/usr/local

#default build root
test $PRMBUILDROOT || RPMBUILDROOT="%{_tmppath}/%{name}-%{version}-root"

#set program and package name
test $PROGNAME || PROGNAME=Armagetron
test $PACKAGENAME || PACKAGENAME=armagetron

#additional options to configure
test $CONFIGURE_OPTIONS || CONFIGURE_OPTIONS="--enable-etc --disable-music"

#where to find the config files after installation
test $CONFIGFILES || CONFIGFILES=/etc/$PACKAGENAME

#alternative setting for location of config files
#test $CONFIGURE_OPTIONS || CONFIGURE_OPTIONS=--disable-etc
#test $CONFIGFILES || CONFIGFILES=$PREFIX/games/$PACKAGENAME/config

#get sources from here ( change it to anything else to just copy the sources from the directory of the script )
test $SOURCE || SOURCE=CVS

#packager
test $PACKAGER || PACKAGER="klaxnek < klaxnek@users.sf.net >"

#set C compiler flags
test $CXXFLAGS || CXXFLAGS="-Os"

export RPMTOPDIR
export PROGNAME
export PACKAGENAME
export CXXFLAGS
export RPMBUILDROOT
export PREFIX
export CONFIGURE_OPTIONS
export PACKAGER
export ROOT
export SOURCE
export CONFIGFILES

#get current sources
./getsources $*

#build normal
DEDICATED=no
export DEDICATED
./buildsingle

#build dedicated
#DEDICATED=yes
#export DEDICATED
#./buildsingle

#cleanup
#rm -rf version
#rm -rf armagetron.spec
