server/s/build

45 lines
1.1 KiB
Text
Raw Normal View History

2014-04-11 18:50:12 +02:00
#!/bin/sh
ROOT=$(git rev-parse --show-toplevel)
2014-04-11 18:50:12 +02:00
2015-07-11 23:25:09 +02:00
[ -z "$BUILD" ] && BUILD=Debug
if [ -z "$JOBS" ] ; then
if [ -e /usr/sbin/sysctl ]; then
JOBS=`sysctl -n hw.ncpu`
else
JOBS=`nproc`
fi
fi
DISTCC=`which distcc`
if [ ! -z "$DISTCC" ] ; then
JOBS=`distcc -j`
if [ -z "$JOBS" ] ; then
JOBS=1
elif [ $JOBS -gt 1 ] ; then
[ -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"
CC="$DISTCC $CC"
MAKEOPTS=-j$JOBS
fi
fi
echo "Building with $JOBS jobs"
2015-07-11 23:25:09 +02:00
if [ ! -d $ROOT/$BUILD ]; then
echo "cannot find build directory $BUILD in $ROOT. did you run cmake-init?"
2014-04-11 18:50:12 +02:00
exit
fi
echo "build eressea"
2015-07-11 23:25:09 +02:00
cd $ROOT/$BUILD
BRANCH=$(git status -s -b | head -1 | cut -d\ -f 2 | sed 's/\..*//')
2017-03-28 16:11:45 +02:00
if [ "$BRANCH" = "master" ] ; then
VERSION=$(git describe --match 'v*.*.*' --tags | sed 's/^v//')
2016-09-10 18:44:08 +02:00
cmake -DERESSEA_VERSION="$VERSION" ..
else
REV=$(git rev-parse --short HEAD)
cmake -DERESSEA_BUILDNO="$REV" ..
fi
2016-11-25 21:17:10 +01:00
make $MAKEOPTS && make test
cd $OLDPWD