diff --git a/bin/compiler/1-clean.sh b/bin/compiler/1-clean.sh new file mode 100755 index 000000000..10c61b852 --- /dev/null +++ b/bin/compiler/1-clean.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +. "defines.sh" + +echo "Cleaning build files" + +CWD=$(pwd) + +cd $BUILDPATH + +make -f Makefile clean +make clean +find -iname '*cmake*' -not -name CMakeLists.txt -exec rm -rf {} \+ + +cd $CWD + diff --git a/bin/compiler/2-configure.sh b/bin/compiler/2-configure.sh new file mode 100755 index 000000000..c74b52f3e --- /dev/null +++ b/bin/compiler/2-configure.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +. "defines.sh" + +CWD=$(pwd) + +cd $BUILDPATH + +echo "Build path: $BUILDPATH" +echo "DEBUG info: $CDEBUG" +echo "Compilation type: $CCTYPE" +# -DCMAKE_BUILD_TYPE=$CCTYPE disable optimization "slow and huge amount of ram" +# -DWITH_COREDEBUG=$CDEBUG compiled with debug information + +cmake $SRCPATH -DCMAKE_INSTALL_PREFIX=$BINPATH -DCONF_DIR=$CONFDIR -DSERVERS=$CSERVERS -DSCRIPTS=$CSCRIPTS \ +-DCMAKE_C_COMPILER=$COMPILER_C -DCMAKE_CC_COMPILER=$COMPILER_CC -DCMAKE_CXX_COMPILER=$COMPILER_CXX \ +-DTOOLS=$CTOOLS -DUSE_SCRIPTPCH=$CSCRIPTPCH -DUSE_COREPCH=$CCOREPCH -DWITH_COREDEBUG=$CDEBUG -DCMAKE_BUILD_TYPE=$CCTYPE -DWITH_WARNINGS=$CWARNINGS + +cd $CWD diff --git a/bin/compiler/3-build.sh b/bin/compiler/3-build.sh new file mode 100755 index 000000000..2aee4d92b --- /dev/null +++ b/bin/compiler/3-build.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +. "defines.sh" + + +[ $MTHREADS == 0 ] && MTHREADS=`grep -c ^processor /proc/cpuinfo` && MTHREADS=$(($MTHREADS + 2)) + +echo "Using $MTHREADS threads" + +CWD=$(pwd) + +cd $BUILDPATH + +time make -j $MTHREADS +make -j $MTHREADS install + +cd $CWD diff --git a/bin/compiler/config.sh.dist b/bin/compiler/config.sh.dist new file mode 100644 index 000000000..cc7d6761a --- /dev/null +++ b/bin/compiler/config.sh.dist @@ -0,0 +1,34 @@ +#!/bin/bash + +# how many thread must be used for compilation ( leave zero to use all available ) +MTHREADS=0 +# enable/disable warnings during compilation +CWARNINGS=1 +# enable/disable some debug informations ( it's not a debug compilation ) +CDEBUG=0 +# specify compilation type +CCTYPE=Release +# compile scripts +CSCRIPTS=1 +# compile server +CSERVERS=1 +# compile tools +CTOOLS=0 +# use precompiled headers ( fatest compilation but not optimized if you change headers often ) +CSCRIPTPCH=1 +CCOREPCH=1 + +# AZTH +# compile azth plugins for custom features +CAZTH_PLG=1 +# compile azth plugins for trinitycore features +CAZTH_TC_PLG=1 +# enable unit test on TC load +CAZTH_UNIT_TEST=1 + +# absolute root path of your azerothshard repository +SRCPATH= +# absolute path where binary files must be stored +BINPATH= +# absolute path where config. files must be stored +CONFDIR= diff --git a/bin/compiler/defines.sh b/bin/compiler/defines.sh new file mode 100644 index 000000000..7fc6779bd --- /dev/null +++ b/bin/compiler/defines.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +source ./config.sh.dist # "hack" to avoid missing conf variables + +source ./config.sh # should overwrite previous + +# you can choose build type from cmd argument +if [ ! -z $1 ] +then + CCTYPE=$1 + CCTYPE=${CCTYPE^} # capitalize first letter if it's not yet +fi + +BUILDPATH=$BINPATH + +[ $CCTYPE == "Debug" ] && BUILDPATH="$BUILDPATH/debug/build/" || BUILDPATH="$BUILDPATH/release/build/" + +[ $CCTYPE == "Debug" ] && BINPATH="$BINPATH/debug" || BINPATH="$BINPATH/release" + +mkdir -p $BUILDPATH +mkdir -p $BINPATH