restructured repository based on following standards:

https://github.com/HW-Core/directory-structure
This commit is contained in:
Yehonal 2016-07-08 23:58:11 +02:00
parent eda1171939
commit 9fd22872c0
2536 changed files with 433 additions and 2158 deletions

View File

@ -1,8 +1,8 @@
# Copyright (C)
# Copyright (C)
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
@ -26,7 +26,7 @@ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH 1)
# set macro-directory
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/macros")
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/src/cmake/macros")
# build in Release-mode by default if not explicitly set
if( NOT CMAKE_BUILD_TYPE )
@ -37,7 +37,7 @@ include(CheckCXXSourceRuns)
include(CheckIncludeFiles)
# set default buildoptions and print them
include(cmake/options.cmake)
include(src/cmake/options.cmake)
# turn off PCH totally if enabled (hidden setting, mainly for devs)
if( NOPCH )
@ -71,13 +71,13 @@ endif()
#endif()
# Find revision ID and hash of the sourcetree
include(cmake/genrev.cmake)
include(src/cmake/genrev.cmake)
# print out the results before continuing
include(cmake/showoptions.cmake)
include(src/cmake/showoptions.cmake)
# add dependencies
add_subdirectory(dep)
add_subdirectory(modules/dep)
# add core sources
add_subdirectory(src)

View File

@ -0,0 +1,5 @@
AZTH_PATH_ROOT=$(readlink -f "$AZTH_PATH_BIN/../")
AZTH_PATH_CONF="$AZTH_PATH_ROOT/conf"
AZTH_PATH_CUSTOM=$(readlink -f "$AZTH_PATH_ROOT/../azth_custom")

View File

@ -0,0 +1,16 @@
# par 1: hook_name
function runHooks() {
hook_name="HOOKS_MAP_$1"
read -r -a SRCS <<< ${!hook_name}
echo "Running hooks: $hook_name"
for i in "${SRCS[@]}"
do
$i # run registered hook
done
}
function registerHooks() {
hook_name="HOOKS_MAP_$1"
hooks=${@:2}
declare -g "$hook_name+=$hooks "
}

View File

@ -0,0 +1,7 @@
AZTH_PATH_BIN="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
AZTH_PATH_SHARED="$AZTH_PATH_BIN/bash_shared"
source "$AZTH_PATH_SHARED/defines.sh"
source "$AZTH_PATH_SHARED/functions.sh"

View File

@ -1,16 +1,8 @@
#!/bin/bash
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. "defines.sh"
source "$CURRENT_PATH/includes/common.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
source "$CURRENT_PATH/includes/includes.sh"
clean

View File

@ -1,19 +1,8 @@
#!/bin/bash
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. "defines.sh"
source "$CURRENT_PATH/includes/common.sh"
CWD=$(pwd)
source "$CURRENT_PATH/includes/includes.sh"
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
configure

View File

@ -1,17 +1,8 @@
#!/bin/bash
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. "defines.sh"
source "$CURRENT_PATH/includes/common.sh"
source "$CURRENT_PATH/includes/includes.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
build

View File

@ -1,8 +1,9 @@
#!/bin/bash
COMPILER_C="/usr/bin/gcc"
COMPILER_CC="/usr/bin/gcc"
COMPILER_CXX="/usr/bin/g++"
# set preferred compilers
CCOMPILERC="/usr/bin/clang-3.6"
CCOMPILERCXX="/usr/bin/clang++-3.6"
# how many thread must be used for compilation ( leave zero to use all available )
MTHREADS=0
@ -23,12 +24,12 @@ CSCRIPTPCH=1
CCOREPCH=1
# AZTH
# compile azth plugins for custom features
# compile azth custom plugins
CAZTH_CUSTOM_PLG=1
# compile azth plugins
CAZTH_PLG=1
# compile azth plugins for trinitycore features
CAZTH_TC_PLG=1
# enable unit test on TC load
CAZTH_UNIT_TEST=1
CAZTH_UNIT_TEST=0
# absolute root path of your azerothshard repository
SRCPATH=

View File

@ -0,0 +1,5 @@
source "./config.sh.dist" # "hack" to avoid missing conf variables
if [ -f "./config.sh" ]; then
source "./config.sh" # should overwrite previous
fi

View File

@ -1,21 +1,16 @@
#!/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
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/"
INSTALL_PATH=$(readlink -f "$BINPATH/../")
[ $CCTYPE == "Debug" ] && BINPATH="$BINPATH/debug" || BINPATH="$BINPATH/release"
[ $CCTYPE == "Debug" ] && BUILDPATH="$BUILDPATH/debug/build/" || BUILDPATH="$BUILDPATH/release/build/"
mkdir -p $BUILDPATH
mkdir -p $BINPATH
[ $CCTYPE == "Debug" ] && BINPATH="$BINPATH/debug" || BINPATH="$BINPATH/release"

View File

@ -0,0 +1,55 @@
function clean() {
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
}
function configure() {
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 -DSCRIPTS_COMMANDS=$CSCRIPTS -DSCRIPTS_CUSTOM=$CSCRIPTS -DSCRIPTS_EASTERNKINGDOMS=$CSCRIPTS -DSCRIPTS_EVENTS=$CSCRIPTS -DSCRIPTS_KALIMDOR=$CSCRIPTS \
-DSCRIPTS_NORTHREND=$CSCRIPTS -DSCRIPTS_OUTDOORPVP=$CSCRIPTS -DSCRIPTS_OUTLAND=$CSCRIPTS -DSCRIPTS_PET=$CSCRIPTS -DSCRIPTS_SPELLS=$CSCRIPTS -DSCRIPTS_WORLD=$CSCRIPTS \
-DTOOLS=$CTOOLS -DUSE_SCRIPTPCH=$CSCRIPTPCH -DUSE_COREPCH=$CCOREPCH -DWITH_COREDEBUG=$CDEBUG -DCMAKE_BUILD_TYPE=$CCTYPE -DWITH_WARNINGS=$CWARNINGS \
-DAZTH_WITH_UNIT_TEST=$CAZTH_UNIT_TEST -DAZTH_WITH_CUSTOM_PLUGINS=$CAZTH_CUSTOM_PLG -DAZTH_WITH_PLUGINS=$CAZTH_PLG \
-DCMAKE_C_COMPILER=$CCOMPILERC -DCMAKE_CXX_COMPILER=$CCOMPILERCXX
cd $CWD
runHooks "ON_AFTER_CONFIG"
}
function build() {
[ $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
runHooks "ON_AFTER_BUILD"
}

View File

@ -0,0 +1,19 @@
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_PATH/../../bash_shared/includes.sh"
AZTH_PATH_COMPILER="$AZTH_PATH_BIN/compiler"
function azth_on_after_build() {
# move the run engine
cp -rvf "$AZTH_PATH_BIN/runners/"* "$INSTALL_PATH/bin/"
}
registerHooks "ON_AFTER_BUILD" azth_on_after_build
source "$AZTH_PATH_COMPILER/includes/defines.sh"
source "$AZTH_PATH_COMPILER/includes/functions.sh"
mkdir -p $BUILDPATH
mkdir -p $BINPATH

31
bin/runners/config.dist Normal file
View File

@ -0,0 +1,31 @@
#!/bin/bash
######################
# enable/disable GDB execution
export GDB_ENABLED=0
# gdb file
export GDB=""
# directory where binary are stored
exoirt BINPATH=""
### Put here the pid you configured on your worldserver.conf file ###
export SERVERPID=""
# path to conf file
export CONFIG=""
# path of log files
export LOGS_PATH="";
# exec name
export SERVERBIN=""
# name of screen service ( for restarter )
export SCREEN_NAME=""
######################

68
bin/runners/run-engine Executable file
View File

@ -0,0 +1,68 @@
#!/bin/bash
function checkStatus() {
if [ -d "/proc/"$1 ]; then
eval "TEST=1"
else
eval "TEST=0"
fi
}
function starter() {
local CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $BINPATH
mkdir -p "$LOGS_PATH"
TRACE_BEGIN_STRING="SIGSEGV"
TRACE_FILE="$LOGS_PATH/"$SCREEN_NAME"_trace.log"
ERR_FILE="$LOGS_PATH/"$SCREEN_NAME"_error.log"
SYSLOG="$LOGS_PATH/"$SCREEN_NAME"_system.log"
SYSERR="$LOGS_PATH/"$SCREEN_NAME"_system.err"
LINKS_FILE="$LOGS_PATH/"$SCREEN_NAME"_crash_links.link"
$CURRENT_PATH/starter $SERVERBIN $GDB "$CONFIG" "$SYSLOG" "$SYSERR" $GDB_ENABLED
}
function restarter() {
local CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $BINPATH
mkdir -p "$LOGS_PATH"
TRACE_BEGIN_STRING="SIGSEGV"
TRACE_FILE="$LOGS_PATH/"$SCREEN_NAME"_trace.log"
ERR_FILE="$LOGS_PATH/"$SCREEN_NAME"_error.log"
SYSLOG="$LOGS_PATH/"$SCREEN_NAME"_system.log"
SYSERR="$LOGS_PATH/"$SCREEN_NAME"_system.err"
LINKS_FILE="$LOGS_PATH/"$SCREEN_NAME"_crash_links.link"
if [ ! -f $TRACE_FILE ]; then
touch $TRACE_FILE
fi
while :
do
PID=$(cat $SERVERPID)
checkStatus $PID
if [ $TEST -eq 0 ]; then
DATE=$(date)
echo "Restarting $SCREEN_NAME Core blizz($DATE)"
if [ $GDB_ENABLED -eq 1 ]; then
echo "GDB enabled"
grep -B 10 -A 1800 "$TRACE_BEGIN_STRING" "$SYSLOG" >> "$TRACE_FILE"
cat "$SYSERR" > "$ERR_FILE"
screen -A -m -d -S $SCREEN_NAME "$CURRENT_PATH/starter" $SERVERBIN $GDB "$CONFIG" "$SYSLOG" "$SYSERR" 1
fi
if [ $GDB_ENABLED -eq 0 ]; then
echo "GDB disabled"
screen -A -m -d -S $SCREEN_NAME "$CURRENT_PATH/starter" $SERVERBIN null "$CONFIG" null null 0
fi
fi
sleep 15
done
}

22
bin/runners/starter Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
GDB_FILE="$2"
CONFIG="$3"
SYSLOG="$4"
SYSERR="$5"
GBD_ENABLED="$6"
if [ $GBD_ENABLED -eq 1 ]; then
echo "run -c $3" > "$GDB_FILE"
echo "bt" >> "$GDB_FILE"
echo "bt full" >> "$GDB_FILE"
echo "info threads" >> "$GDB_FILE"
echo "thread apply all bt full" >> "$GDB_FILE"
[ ! -f "$SYSLOG" ] && touch "$SYSLOG"
[ ! -f "$SYSERR" ] && touch "$SYSERR"
gdb -x $GDB_FILE --batch $1 >> "$SYSLOG" 2>> "$SYSERR"
elif [ $GBD_ENABLED -eq 0 ]; then
"./$1" -c "$CONFIG"
fi

View File

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 130 KiB

View File

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 102 KiB

View File

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 142 KiB

View File

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 103 KiB

View File

Before

Width:  |  Height:  |  Size: 261 KiB

After

Width:  |  Height:  |  Size: 261 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 140 KiB

After

Width:  |  Height:  |  Size: 140 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB