forked from github/server
44 lines
953 B
Bash
Executable File
44 lines
953 B
Bash
Executable File
#!/bin/sh
|
|
ROOT=`pwd`
|
|
while [ ! -d $ROOT/.git ]; do
|
|
ROOT=`dirname $ROOT`
|
|
done
|
|
|
|
[ -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"
|
|
|
|
if [ ! -d $ROOT/$BUILD ]; then
|
|
echo "cannot find build directory $BUILD in $ROOT. did you run cmake-init?"
|
|
exit
|
|
fi
|
|
|
|
git submodule update
|
|
|
|
echo "build eressea"
|
|
cd $ROOT/$BUILD
|
|
VERSION=$(git describe --match 'v*.*.*' --tags | sed 's/^v//')
|
|
cmake -DERESSEA_VERSION="$VERSION" ..
|
|
make -k $MAKEOPTS && make test
|
|
cd $OLDPWD
|