1
0
Fork 0

Updated compile.sh

This commit is contained in:
Julian Laubstein 2015-08-16 11:07:18 +02:00
parent cdcc5fe9a7
commit d06f7f19ce
1 changed files with 16 additions and 19 deletions

View File

@ -1,11 +1,11 @@
#|| goto :windows_detected #|| goto :windows_detected
# Do we already have a repo? # Do we already have a repo?
if [[ -d .git && -f easyinstall.sh && -f src/BlockArea.cpp ]]; then # A good enough indicator that we're in the MCServer git repo. if [[ -d .git && -f easyinstall.sh && -f src/BlockArea.cpp ]]; then # A good enough indicator that we're in the Cuberite git repo.
cd ../ cd ../
echo "MCServer repository detected. This should make the process faster, especially if you compiled before." echo "Cuberite repository detected. This should make the process faster, especially if you compiled before."
fi fi
# Error functions. # Error functions.
function error function error
{ {
@ -27,14 +27,13 @@ function missingDepsExit
# Echo: Greetings. # Echo: Greetings.
echo echo
echo "Hello, this script will download and compile Cuberite/MCServer." echo "Hello, this script will download and compile Cuberite."
echo "On subsequent runs, it will update your MCServer." echo "On subsequent runs, it will update your Cuberite."
echo "The compilation and download will occur in the current directory." echo "The compilation and download will occur in the current directory."
echo "If you're updating, you should run <Path to MCServer>/MCServer/compile.sh" echo "If you're updating, you should run <Path to Cuberite>/cuberite/compile.sh"
echo "Compiling from source takes time, but it usually generates better executables." echo "Compiling from source takes time, but it usually generates better executables."
echo "If you prefer ready-to-use binaries or if you want more info, please visit:" echo "If you prefer ready-to-use binaries or if you want more info, please visit:"
echo "http://cuberite.org/" echo "http://cuberite.org/"
echo "http://mc-server.org/"
MISSING_PROGRAMS="" MISSING_PROGRAMS=""
@ -140,18 +139,18 @@ fi
# Echo: Downloading began. # Echo: Downloading began.
echo echo
echo " --- Downloading MCServer's source code from the $BRANCH branch..." echo " --- Downloading Cuberite's source code from the $BRANCH branch..."
# Git: Clone. # Git: Clone.
if [ ! -d MCServer ]; then if [ ! -d cuberite ]; then
echo " --- Looks like your first run, cloning the whole code..." echo " --- Looks like your first run, cloning the whole code..."
git clone https://github.com/mc-server/MCServer.git git clone https://github.com/cuberite/cuberite.git
fi fi
# Git: Fetch. # Git: Fetch.
pushd MCServer pushd cuberite
echo " --- Updating the $BRANCH branch..." echo " --- Updating the $BRANCH branch..."
git fetch origin $BRANCH || error "git fetch failed" git fetch origin $BRANCH || error "git fetch failed"
git checkout $BRANCH || error "git checkout failed" git checkout $BRANCH || error "git checkout failed"
@ -160,16 +159,15 @@ git merge origin/$BRANCH || error "git merge failed"
# Git: Submodules. # Git: Submodules.
echo " --- Updating submodules..." echo " --- Updating submodules..."
git submodule init git submodule update --init
git submodule update
# Cmake. # Cmake.
echo " --- Running cmake..." echo " --- Running cmake..."
popd popd
if [ ! -d build-mcserver ]; then mkdir build-mcserver; fi if [ ! -d build-cuberite ]; then mkdir build-cuberite; fi
pushd build-mcserver pushd build-cuberite
cmake ../MCServer/ -DCMAKE_BUILD_TYPE=$BUILDTYPE || error "cmake failed" cmake ../cuberite/ -DCMAKE_BUILD_TYPE=$BUILDTYPE || error "cmake failed"
# Make. # Make.
@ -180,7 +178,7 @@ echo
# Echo: Compilation complete. # Echo: Compilation complete.
popd popd
pushd MCServer/MCServer pushd cuberite/MCServer
echo echo
echo "-----------------" echo "-----------------"
echo "Compilation done!" echo "Compilation done!"
@ -194,5 +192,4 @@ exit 0
:windows_detected :windows_detected
echo "This script is not available for Windows yet, sorry." echo "This script is not available for Windows yet, sorry."
echo "You can still download the Windows binaries from: http://mc-server.org" echo "You can still download the Windows binaries from: http://cuberite.org"