Merge branch 'master' into git

This commit is contained in:
ShinDarth
2016-08-07 14:55:21 +02:00
84 changed files with 1531 additions and 680 deletions

View File

@@ -2,4 +2,6 @@ AZTH_PATH_ROOT=$(readlink -f "$AZTH_PATH_BIN/../")
AZTH_PATH_CONF="$AZTH_PATH_ROOT/conf"
AZTH_PATH_MODULES="$AZTH_PATH_ROOT/modules"
AZTH_PATH_CUSTOM=$(readlink -f "$AZTH_PATH_ROOT/../azth_custom")

View File

@@ -5,3 +5,20 @@ AZTH_PATH_SHARED="$AZTH_PATH_BIN/bash_shared"
source "$AZTH_PATH_SHARED/defines.sh"
source "$AZTH_PATH_SHARED/functions.sh"
source "$AZTH_PATH_CONF/config.sh.dist" # "hack" to avoid missing conf variables
if [ -f "$AZTH_PATH_CONF/config.sh" ]; then
source "$AZTH_PATH_CONF/config.sh" # should overwrite previous
fi
#
# Load modules
#
for entry in "$AZTH_PATH_MODULES/"*/include.sh
do
if [ -e $entry ]; then
source $entry
fi
done

2
bin/compiler/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
config.sh

View File

@@ -1,8 +1,5 @@
#!/bin/bash
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_PATH/includes/common.sh"
source "$CURRENT_PATH/includes/includes.sh"
clean
bash "$CURRENT_PATH/compiler.sh" 1

View File

@@ -1,8 +1,5 @@
#!/bin/bash
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_PATH/includes/common.sh"
source "$CURRENT_PATH/includes/includes.sh"
configure
bash "$CURRENT_PATH/compiler.sh" 2

View File

@@ -1,8 +1,5 @@
#!/bin/bash
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_PATH/includes/common.sh"
source "$CURRENT_PATH/includes/includes.sh"
build
bash "$CURRENT_PATH/compiler.sh" 3

View File

@@ -1,7 +1,7 @@
## How to compile:
first of all, if you need some custom configuration you have to copy and rename
config.sh.dist in config.sh and configure it
/conf/config.sh.dist in /conf/config.sh and configure it
* for a "clean" compilation you must run all scripts in their order:
@@ -21,4 +21,4 @@ config.sh.dist in config.sh and configure it
## Note:
For an optimal development process and **really faster** compilation time, is suggested to use clang instead of gcc
For an optimal development process and **really faster** compilation time, is suggested to use clang instead of gcc

43
bin/compiler/compiler.sh Executable file
View File

@@ -0,0 +1,43 @@
#!/bin/bash
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_PATH/includes/includes.sh"
function all() {
clean
configure
build
}
function run_option() {
if test "${comp_functions[$1-1]+'test'}"; then
${comp_functions[$1-1]}
else
echo "invalid option"
fi
}
comp_options=("Clean" "Configure" "Build" "All")
comp_functions=("clean" "configure" "build" "all")
runHooks "ON_AFTER_OPTIONS" #you can create your custom options
# push exit after custom options
comp_options+=('Exit')
comp_functions+=('exit 0')
# run option directly if specified in argument
[ ! -z $1 ] && run_option $1 && exit 0
PS3='[ Please enter your choice ]: '
select opt in "${comp_options[@]}"
do
case $opt in
'Exit')
break
;;
*)
run_option $REPLY
;;
esac
done

View File

@@ -1,38 +0,0 @@
#!/bin/bash
# set preferred compilers
#CCOMPILERC="/usr/bin/clang-3.6"
#CCOMPILERCC="/usr/bin/clang-3.6"
#CCOMPILERCXX="/usr/bin/clang++-3.6"
CCOMPILERC="/usr/bin/gcc"
CCOMPILERCC="/usr/bin/gcc"
CCOMPILERCXX="/usr/bin/g++"
# 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
# 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=

View File

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

View File

@@ -11,6 +11,6 @@ BUILDPATH=$BINPATH
INSTALL_PATH=$(readlink -f "$BINPATH/../")
[ $CCTYPE == "Debug" ] && BUILDPATH="$BUILDPATH/debug/build/" || BUILDPATH="$BUILDPATH/release/build/"
[ $CTYPE == "Debug" ] && BUILDPATH="$BUILDPATH/debug/build/" || BUILDPATH="$BUILDPATH/release/build/"
[ $CCTYPE == "Debug" ] && BINPATH="$BINPATH/debug" || BINPATH="$BINPATH/release"
[ $CTYPE == "Debug" ] && BINPATH="$BINPATH/debug" || BINPATH="$BINPATH/release"

View File

@@ -20,7 +20,7 @@ function configure() {
echo "Build path: $BUILDPATH"
echo "DEBUG info: $CDEBUG"
echo "Compilation type: $CCTYPE"
echo "Compilation type: $CTYPE"
# -DCMAKE_BUILD_TYPE=$CCTYPE disable optimization "slow and huge amount of ram"
# -DWITH_COREDEBUG=$CDEBUG compiled with debug information
@@ -30,8 +30,8 @@ function configure() {
cmake $SRCPATH -DCMAKE_INSTALL_PREFIX=$BINPATH -DCONF_DIR=$CONFDIR -DSERVERS=$CSERVERS \
-DSCRIPTS=$CSCRIPTS \
-DTOOLS=$CTOOLS -DUSE_SCRIPTPCH=$CSCRIPTPCH -DUSE_COREPCH=$CCOREPCH -DWITH_COREDEBUG=$CDEBUG -DCMAKE_BUILD_TYPE=$CCTYPE -DWITH_WARNINGS=$CWARNINGS \
-DCMAKE_C_COMPILER=$CCOMPILERC -DCMAKE_CXX_COMPILER=$CCOMPILERCXX
-DTOOLS=$CTOOLS -DUSE_SCRIPTPCH=$CSCRIPTPCH -DUSE_COREPCH=$CCOREPCH -DWITH_COREDEBUG=$CDEBUG -DCMAKE_BUILD_TYPE=$CTYPE -DWITH_WARNINGS=$CWARNINGS \
-DCMAKE_C_COMPILER=$CCOMPILERC -DCMAKE_CXX_COMPILER=$CCOMPILERCXX $CCUSTOMOPTIONS
cd $CWD

View File

@@ -4,6 +4,10 @@ source "$CURRENT_PATH/../../bash_shared/includes.sh"
AZTH_PATH_COMPILER="$AZTH_PATH_BIN/compiler"
if [ -f "$AZTH_PATH_COMPILER/config.sh" ]; then
source "$AZTH_PATH_COMPILER/config.sh" # should overwrite previous
fi
function azth_on_after_build() {
# move the run engine
cp -rvf "$AZTH_PATH_BIN/runners/"* "$INSTALL_PATH/bin/"

View File

@@ -1,49 +0,0 @@
#!/bin/bash
# 0 if you want create an sql for each kind of following categories
# 1 to create a single big file to import ( suggested for new installations )
ALL_IN_ONE=0
DATABASES=(
"AUTH"
"CHARACTERS"
"WORLD"
)
OUTPUT_FOLDER="output/"
# FULL DB
DB_CHARACTERS_PATHS=(
$SRCPATH"/data/sql/databases/characters.sql"
)
DB_AUTH_PATHS=(
$SRCPATH"/data/sql/databases/auth.sql"
)
DB_WORLD_PATHS=(
$SRCPATH"/data/sql/databases/world.sql"
)
# UPDATES
DB_CHARACTERS_UPDATE_PATHS=(
$SRCPATH"/data/sql/updates/characters/"
)
DB_AUTH_UPDATE_PATHS=(
$SRCPATH"/data/sql/updates/auth/"
)
DB_WORLD_UPDATE_PATHS=(
$SRCPATH"/data/sql/updates/world/"
)
# CUSTOM
DB_CHARACTERS_CUSTOM_PATHS=(
)
DB_AUTH_CUSTOM_PATHS=(
)
DB_WORLD_CUSTOM_PATHS=(
)

View File

@@ -7,128 +7,148 @@ else
SRCPATH=$(readlink -f "../../")
fi
#
# You can pass latest version as first argument of this script
#
if [ -z "$1" ]; then
read -p "Enter latest sql version ( leave blank to use : 0000_00_00_00 )" $version
version=${version:-0000_00_00_00}
else
version=$1
fi
source "./config.sh.dist" # "hack" to avoid missing conf variables
source $SRCPATH"/bin/bash_shared/includes.sh"
if [ -f "./config.sh" ]; then
source "./config.sh" # should overwrite previous
fi
unamestr=`uname`
if [[ "$unamestr" == 'Darwin' ]]; then
MD5_CMD="md5"
else
MD5_CMD="md5sum"
fi
reg_file="$OUTPUT_FOLDER/.zzz_db_assembler_registry.sh"
declare -A registry
if [ -f "$reg_file" ]; then
source "$reg_file"
fi
echo "===== STARTING PROCESS ====="
gtversion=""
function assemble() {
database=$1
start_sql=$2
database=$1
start_sql=$2
var_full="DB_"$database"_PATHS"
full=${!var_full}
var_base="DB_"$database"_PATHS"
base=${!var_base}
var_updates="DB_"$database"_UPDATE_PATHS"
updates=${!var_updates}
var_updates="DB_"$database"_UPDATE_PATHS"
updates=${!var_updates}
var_custom="DB_"$database"_CUSTOM_PATHS"
custom=${!var_custom}
var_custom="DB_"$database"_CUSTOM_PATHS"
custom=${!var_custom}
suffix_base=""
suffix_upd=""
suffix_custom=""
suffix_base=""
suffix_upd=""
suffix_custom=""
if (( $ALL_IN_ONE == 0 )); then
suffix_base="_base"
fi;
if (( $ALL_IN_ONE == 0 )); then
suffix_base="_base"
fi;
echo "" > $OUTPUT_FOLDER$database$suffix_base".sql"
echo "" > $OUTPUT_FOLDER$database$suffix_base".sql"
if [ ! ${#full[@]} -eq 0 ]; then
echo "Generating $OUTPUT_FOLDER$database$suffix_based ..."
if [ ! ${#base[@]} -eq 0 ]; then
echo "Generating $OUTPUT_FOLDER$database$suffix_base ..."
for entry in "${full[@]}"
do
if [ ! -z $entry ]; then
if [ -e $entry ]; then
cat "$entry" >> $OUTPUT_FOLDER$database$suffix_base".sql"
fi
fi
done
fi
for d in "${base[@]}"
do
if [ ! -z $d ]; then
for entry in "$d"/*.sql "$d"/**/*.sql
do
if [[ -e $entry ]]; then
cat "$entry" >> $OUTPUT_FOLDER$database$suffix_base".sql"
fi
done
fi
done
fi
if (( $ALL_IN_ONE == 0 )); then
suffix_upd="_updates"
if (( $ALL_IN_ONE == 0 )); then
suffix_upd="_updates"
echo "" > $OUTPUT_FOLDER$database$suffix_upd".sql"
fi;
echo "" > $OUTPUT_FOLDER$database$suffix_upd".sql"
fi;
if [ ! ${#updates[@]} -eq 0 ]; then
echo "Generating $OUTPUT_FOLDER$database$suffix_upd ..."
if [ ! ${#updates[@]} -eq 0 ]; then
echo "Generating $OUTPUT_FOLDER$database$suffix_upd ..."
for d in "${updates[@]}"
do
for entry in "$d"/*.sql "$d"/**/*.sql
do
if [ ! -z $d ]; then
file=$(basename $entry)
if [[ "$file" > "$start_sql" ]]
then
if [ -e $entry ]; then
if [[ "$gtversion" < "$file" ]]; then
gtversion=$file
fi
for d in "${updates[@]}"
do
if [ ! -z $d ]; then
for entry in "$d"/*.sql "$d"/**/*.sql
do
if [[ ! -e $entry ]]; then
continue
fi
cat "$entry" >> $OUTPUT_FOLDER$database$suffix_upd".sql"
fi
fi
fi
done
done
fi
file=$(basename "$entry")
hash=$($MD5_CMD "$entry")
hash="${hash%% *}" #remove file path
if [[ -z ${registry[$hash]} ]]; then
registry["$hash"]="$file"
echo "-- New update sql: "$file
cat "$entry" >> $OUTPUT_FOLDER$database$suffix_upd".sql"
fi
done
fi
done
fi
if (( $ALL_IN_ONE == 0 )); then
suffix_custom="_custom"
if (( $ALL_IN_ONE == 0 )); then
suffix_custom="_custom"
echo "" > $OUTPUT_FOLDER$database$suffix_custom".sql"
fi;
echo "" > $OUTPUT_FOLDER$database$suffix_custom".sql"
fi;
if [ ! ${#custom[@]} -eq 0 ]; then
echo "Generating $OUTPUT_FOLDER$database$suffix_custom ..."
for d in "${custom[@]}"
do
if [ ! -z $d ]; then
for entry in "$d"/*.sql "$d"/**/*.sql
do
if [ -e $entry ]; then
cat "$entry" >> $OUTPUT_FOLDER$database$suffix_custom".sql"
fi
done
fi
done
fi
if [ ! ${#custom[@]} -eq 0 ]; then
echo "Generating $OUTPUT_FOLDER$database$suffix_custom ..."
for d in "${custom[@]}"
do
if [ ! -z $d ]; then
for entry in "$d"/*.sql "$d"/**/*.sql
do
if [[ ! -e $entry ]]; then
continue
fi
file=$(basename "$entry")
hash=$($MD5_CMD "$entry")
hash="${hash%% *}" #remove file path
if [[ -z ${registry[$hash]} ]]; then
registry["$hash"]="$file"
echo "-- New custom sql: "$file
cat "$entry" >> $OUTPUT_FOLDER$database$suffix_custom".sql"
fi
done
fi
done
fi
}
mkdir -p $OUTPUT_FOLDER
for db in ${DATABASES[@]}
do
assemble "$db" $version".sql"
assemble "$db" $version".sql"
done
rm $OUTPUT_FOLDER"ZZZ_latest_version_"*
echo $gtversion > $OUTPUT_FOLDER"ZZZ_latest_version_"${gtversion%.*}
echo "" > $reg_file
for i in "${!registry[@]}"
do
echo "registry['"$i"']='"${registry[$i]}"'" >> "$reg_file"
done
echo "===== DONE ====="

View File

@@ -1,31 +0,0 @@
#!/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=""
######################

View File

@@ -7,11 +7,10 @@ SYSERR="$5"
GBD_ENABLED="$6"
if [ $GBD_ENABLED -eq 1 ]; then
echo "run -c $3" > "$GDB_FILE"
echo "set logging on" > "$GDB_FILE"
echo "set debug timestamp" >> "$GDB_FILE"
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"
@@ -19,4 +18,4 @@ if [ $GBD_ENABLED -eq 1 ]; then
gdb -x $GDB_FILE --batch $1 >> "$SYSLOG" 2>> "$SYSERR"
elif [ $GBD_ENABLED -eq 0 ]; then
"./$1" -c "$CONFIG"
fi
fi