#!/bin/bash MACHINE=`uname -m` [ -z "$CC" ] && [ ! -z `which clang` ] && CC="clang" [ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc" [ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc" [ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc" BUILD="build-$MACHINE-$CC-Debug" function usage() { cat <] [-g ] [-f ] command [args] commands: build -- pull and rebuild the code version -- print the current build number setup -- create base directory and config files run -- run a turn send [id ...] -- send reports to one or more factions, or to all ids in HEREDOC exit 1 } function abort() { echo $1 [ -z $2 ] && exit -1 exit $2 # otherwise } function build() { assert_dir $SOURCE cd $SOURCE git fetch || abort "failed to update source. do you have local changes?" [ -z $1 ] || git checkout $1 git submodule update s/build || abort "build failed." } function assert_file() { [ -e $1 ] || abort "missing file: $1" } function assert_files() { while [ ! -z $1 ] ; do assert_file $1 shift done } function assert_dir() { [ -d $1 ] || abort "missing directory: $1" } function version() { assert_dir $SOURCE cd $SOURCE build=$(grep BUILD src/buildno.h | awk '{ print $3 }') echo "eressea build $build" } function setup() { assert_dir $SOURCE assert_dir $LIVE mkdir -p $TESTROOT assert_dir $TESTROOT cd $TESTROOT cat >| eressea.ini <