Created
August 28, 2015 00:51
-
-
Save mrdaemon/3637c6e91150d03489b6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
BUILDROOT="/media/store/buildroot/zandronum-build" | |
SOURCETREE="/home/supernaut/code/hg/zandronum" | |
BUILDTREE="$BUILDROOT/buildserver" | |
CMAKEOPTS="-DCMAKE_BUILD_TYPE=Release -DSERVERONLY=ON" | |
HG=$(which hg) | |
if [[ $? -ne 0 ]] ; then | |
echo "Could not find mercurial in \$PATH, aborting." | |
exit 1 | |
fi | |
CMAKE=$(which cmake) | |
if [[ $? -ne 0 ]] ; then | |
echo "Could not find cmake in \$PATH, aborting." | |
exit 1 | |
fi | |
# Sanity checks | |
[[ -d $BUILDROOT ]] || { echo "Invalid buildroot: $BUILDROOT" ; exit 1 ; } | |
[[ -d $SOURCETREE ]] || { echo "Invalid source tree: $SOURCETREE" ; exit 1 ; } | |
# Prepare source tree | |
# TODO: Check sqlite and fmod, maybe extract if necessary. | |
echo "Preparing source tree..." | |
cd $SOURCETREE || { echo "Cannot enter $SOURCETREE" ; exit 1 ; } | |
# Update source | |
$HG pull && $HG update | |
if [ $? -ne 0 ] ; then | |
echo "Failed to update source tree, aborting." | |
exit 1 | |
fi | |
echo "Latest stable version is: $($HG identify -r 'max(tagged())')" | |
echo "Checking out tag..." | |
$HG update -cr "max(tagged())" | |
if [[ $? -ne 0 ]] ; then | |
echo "An error occured while checking out latest stable." | |
exit 1 | |
fi | |
# Prepare build directory | |
if [[ -d "$BUILDTREE" ]] ; then | |
echo "Removing old build tree in $BUILDTREE" | |
rm -rf "$BUILDTREE" | |
fi | |
echo "Creating buildtree..." | |
mkdir -pv "$BUILDTREE" | |
cd "$BUILDTREE" \ | |
|| { echo "Failed to enter build tree in $BUILDTREE" ; exit 1 ; } | |
echo "Building $SOURCETREE in $BUILDTREE" | |
echo "Configuring" | |
eval "$CMAKE $CMAKEOPTS $SOURCETREE" | |
if [[ $? -ne 0 ]] ; then | |
echo "CMAKE Configuration failed, aborting." | |
exit 1 | |
fi | |
echo "Compiling" | |
make | |
#TODO: Check status,do stuff with binaries, etc | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment