mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
Directory Structure [step 1]: moving files
working on #672 NOTE: This commit can't be compiled!!
This commit is contained in:
2
apps/compiler/.gitignore
vendored
Normal file
2
apps/compiler/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
config.sh
|
||||
|
||||
5
apps/compiler/1-clean.sh
Normal file
5
apps/compiler/1-clean.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
bash "$CURRENT_PATH/compiler.sh" 1
|
||||
5
apps/compiler/2-configure.sh
Normal file
5
apps/compiler/2-configure.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
bash "$CURRENT_PATH/compiler.sh" 2
|
||||
5
apps/compiler/3-build.sh
Normal file
5
apps/compiler/3-build.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
bash "$CURRENT_PATH/compiler.sh" 3
|
||||
32
apps/compiler/README.md
Normal file
32
apps/compiler/README.md
Normal file
@@ -0,0 +1,32 @@
|
||||
## How to compile:
|
||||
|
||||
first of all, if you need some custom configuration you have to copy and rename
|
||||
/conf/config.sh.dist in /conf/config.sh and configure it
|
||||
|
||||
* for a "clean" compilation you must run all scripts in their order:
|
||||
|
||||
./1-clean.sh
|
||||
./2-configure.sh
|
||||
./3-build.sh
|
||||
|
||||
* if you add/rename/delete some sources and you need to compile it you have to run:
|
||||
|
||||
./2-configure.sh
|
||||
./3-build.sh
|
||||
|
||||
* if you have modified code only, you just need to run
|
||||
|
||||
./3-build.sh
|
||||
|
||||
|
||||
## compiler.sh
|
||||
|
||||
compiler.sh script contains an interactive menu to clean/compile/build. You can also run actions directly by command lines specifying the option.
|
||||
Ex:
|
||||
./compiler.sh 3
|
||||
|
||||
It will start the build process (it's equivalent to ./3-build.sh)
|
||||
|
||||
## Note:
|
||||
|
||||
For an optimal development process and **really faster** compilation time, is suggested to use clang instead of gcc
|
||||
44
apps/compiler/compiler.sh
Normal file
44
apps/compiler/compiler.sh
Normal file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source "$CURRENT_PATH/includes/includes.sh"
|
||||
|
||||
function all() {
|
||||
comp_clean
|
||||
comp_configure
|
||||
comp_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=("comp_clean" "comp_configure" "comp_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
|
||||
7
apps/compiler/includes/defines.sh
Normal file
7
apps/compiler/includes/defines.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
# 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
|
||||
|
||||
57
apps/compiler/includes/functions.sh
Normal file
57
apps/compiler/includes/functions.sh
Normal file
@@ -0,0 +1,57 @@
|
||||
|
||||
function comp_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 comp_configure() {
|
||||
CWD=$(pwd)
|
||||
|
||||
cd $BUILDPATH
|
||||
|
||||
echo "Build path: $BUILDPATH"
|
||||
echo "DEBUG info: $CDEBUG"
|
||||
echo "Compilation type: $CTYPE"
|
||||
# -DCMAKE_BUILD_TYPE=$CCTYPE disable optimization "slow and huge amount of ram"
|
||||
# -DWITH_COREDEBUG=$CDEBUG compiled with debug information
|
||||
|
||||
#-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 \
|
||||
#-DAC_WITH_UNIT_TEST=$CAC_UNIT_TEST -DAC_WITH_PLUGINS=$CAC_PLG \
|
||||
|
||||
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=$CTYPE -DWITH_WARNINGS=$CWARNINGS \
|
||||
-DCMAKE_C_COMPILER=$CCOMPILERC -DCMAKE_CXX_COMPILER=$CCOMPILERCXX "-DDISABLED_AC_MODULES=$CDISABLED_AC_MODULES" $CCUSTOMOPTIONS
|
||||
|
||||
cd $CWD
|
||||
|
||||
runHooks "ON_AFTER_CONFIG"
|
||||
}
|
||||
|
||||
|
||||
function comp_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"
|
||||
}
|
||||
23
apps/compiler/includes/includes.sh
Normal file
23
apps/compiler/includes/includes.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source "$CURRENT_PATH/../../bash_shared/includes.sh"
|
||||
|
||||
AC_PATH_COMPILER="$AC_PATH_BIN/compiler"
|
||||
|
||||
if [ -f "$AC_PATH_COMPILER/config.sh" ]; then
|
||||
source "$AC_PATH_COMPILER/config.sh" # should overwrite previous
|
||||
fi
|
||||
|
||||
function ac_on_after_build() {
|
||||
# move the run engine
|
||||
cp -rvf "$AC_PATH_MODULES/acore/startup-scripts/"* "$BINPATH"
|
||||
}
|
||||
|
||||
registerHooks "ON_AFTER_BUILD" ac_on_after_build
|
||||
|
||||
source "$AC_PATH_COMPILER/includes/defines.sh"
|
||||
|
||||
source "$AC_PATH_COMPILER/includes/functions.sh"
|
||||
|
||||
mkdir -p $BUILDPATH
|
||||
mkdir -p $BINPATH
|
||||
Reference in New Issue
Block a user