Skip to content

Instantly share code, notes, and snippets.

@mschlumpp
Last active August 29, 2015 13:57
Show Gist options
  • Save mschlumpp/9622861 to your computer and use it in GitHub Desktop.
Save mschlumpp/9622861 to your computer and use it in GitHub Desktop.
OpenSpades Ubuntu 13.10 Build Script
#!/bin/bash
######################################
# Download this into a empty directory
# Then run from an terminal:
# chmod +x build.sh
# ./build.sh
# ./build.sh run
set -e # Exit on non-zero return
if [[ $1 = "clean" ]]; then
rm -rf openspades
exit 0
fi
if [[ $1 = "run" ]]; then
pushd openspades
build/bin/OpenSpades
popd # openspades
exit 0
fi
echo "==========================="
echo "= Installing dependencies ="
echo "==========================="
sudo apt-get install build-essential cmake pkg-config libfltk1.3-dev libglew-dev libcurl3-openssl-dev libjpeg-dev libxinerama-dev libxft-dev mercurial git-core libopenal1 libopenal-dev libpng12-dev libjpeg-turbo8-dev --yes
echo "================="
echo "= Building SDL2 ="
echo "================="
if [[ ! -d SDL ]]; then
hg clone http://hg.libsdl.org/SDL SDL
pushd SDL
else
pushd SDL
hg pull
hg update --clean
fi
./configure
make
sudo make install
popd # SDL
echo "======================="
echo "= Building SDL2_image ="
echo "======================="
if [[ ! -f SDL2_image-2.0.0.tar.gz ]]; then
wget https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.0.tar.gz
else
rm -rf SDL2_image-2.0.0
fi
tar xvf SDL2_image-2.0.0.tar.gz
pushd SDL2_image-2.0.0
./configure
make
sudo make install
popd # SDL2_image-2.0.0
echo "======================="
echo "= Building OpenSpades ="
echo "======================="
if [[ ! -d openspades ]]; then
git clone https://github.com/yvt/openspades.git
pushd openspades
else
pushd openspades
git clean -xdf
git pull --ff-only
fi
mkdir build
pushd build
cmake -DCMAKE_CXX_FLAGS="-std=c++11 -mtune=native -flto=4 -ftree-vectorize -ffast-math -ftree-slp-vectorize -floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block -fgraphite-identity -Wno-unused-function -Wno-unused-parameter -Wno-reorder" ..
make
popd # build
popd # openspades
DEVPAKURL=$(sed -n '/http.*DevPaks.*/p' openspades/Resources/PakLocation.txt)
DEVPAK=$(basename "$DEVPAKURL")
if [[ ! -f "$DEVPAK" ]]; then
echo "========================="
echo "= Downloading resources ="
echo "========================="
wget -c "$DEVPAKURL"
fi
unzip -o $DEVPAK -d ./openspades/Resources/
echo "=========================================="
echo "= Built OpenSpades! Have fun! ="
echo "= Run './build.sh run' to start the game ="
echo "=========================================="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment