mirror of
https://github.com/uprightbass360/AzerothCore-RealmMaster.git
synced 2026-01-13 00:58:34 +00:00
Compare commits
3 Commits
feat/varia
...
179c486f73
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
179c486f73 | ||
|
|
a497f2844c | ||
|
|
b046f7f8ba |
14
build.sh
14
build.sh
@@ -38,6 +38,7 @@ Build AzerothCore with custom modules and create deployment-ready images.
|
||||
Options:
|
||||
--yes, -y Auto-confirm all prompts
|
||||
--force Force rebuild even if no changes detected
|
||||
--force-update Force update source repository to latest commits
|
||||
--source-path PATH Custom source repository path
|
||||
--skip-source-setup Skip automatic source repository setup
|
||||
-h, --help Show this help
|
||||
@@ -53,6 +54,7 @@ Examples:
|
||||
./build.sh Interactive build
|
||||
./build.sh --yes Auto-confirm build
|
||||
./build.sh --force Force rebuild regardless of state
|
||||
./build.sh --force-update Update source to latest and build
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -60,6 +62,7 @@ while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--yes|-y) ASSUME_YES=1; shift;;
|
||||
--force) FORCE_REBUILD=1; shift;;
|
||||
--force-update) FORCE_UPDATE=1; shift;;
|
||||
--source-path) CUSTOM_SOURCE_PATH="$2"; shift 2;;
|
||||
--skip-source-setup) SKIP_SOURCE_SETUP=1; shift;;
|
||||
-h|--help) usage; exit 0;;
|
||||
@@ -240,6 +243,13 @@ ensure_source_repo(){
|
||||
src_path="${src_path//\/.\//\/}"
|
||||
|
||||
if [ -d "$src_path/.git" ]; then
|
||||
if [ "${FORCE_UPDATE:-0}" = "1" ]; then
|
||||
info "Force update requested - updating source repository to latest" >&2
|
||||
if ! (cd "$ROOT_DIR" && ./scripts/bash/setup-source.sh) >&2; then
|
||||
err "Failed to update source repository" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
echo "$src_path"
|
||||
return
|
||||
fi
|
||||
@@ -540,6 +550,10 @@ stage_modules(){
|
||||
rm -f "$staging_modules_dir/.modules_state" "$staging_modules_dir/.requires_rebuild" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Export environment variables needed by module hooks
|
||||
export STACK_SOURCE_VARIANT="$(read_env STACK_SOURCE_VARIANT "core")"
|
||||
export MODULES_REBUILD_SOURCE_PATH="$(read_env MODULES_REBUILD_SOURCE_PATH "")"
|
||||
|
||||
if ! (cd "$local_modules_dir" && bash "$ROOT_DIR/scripts/bash/manage-modules.sh"); then
|
||||
err "Module staging failed; aborting build"
|
||||
return 1
|
||||
|
||||
@@ -141,6 +141,10 @@ run_post_install_hooks(){
|
||||
export MODULES_ROOT="${MODULES_ROOT:-/modules}"
|
||||
export LUA_SCRIPTS_TARGET="/azerothcore/lua_scripts"
|
||||
|
||||
# Pass build environment variables to hooks
|
||||
export STACK_SOURCE_VARIANT="${STACK_SOURCE_VARIANT:-}"
|
||||
export MODULES_REBUILD_SOURCE_PATH="${MODULES_REBUILD_SOURCE_PATH:-}"
|
||||
|
||||
# Execute the hook script
|
||||
if "$hook_script"; then
|
||||
ok "Hook '$hook' completed successfully"
|
||||
@@ -174,7 +178,18 @@ install_enabled_modules(){
|
||||
continue
|
||||
fi
|
||||
if [ -d "$dir/.git" ]; then
|
||||
info "$dir already present; skipping clone"
|
||||
info "$dir already present; checking for updates"
|
||||
(cd "$dir" && git fetch origin >/dev/null 2>&1 || warn "Failed to fetch updates for $dir")
|
||||
local current_branch
|
||||
current_branch=$(cd "$dir" && git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "master")
|
||||
if (cd "$dir" && git pull origin "$current_branch" 2>&1 | grep -q "Already up to date"); then
|
||||
info "$dir is already up to date"
|
||||
else
|
||||
ok "$dir updated from remote"
|
||||
fi
|
||||
if [ -n "$ref" ]; then
|
||||
(cd "$dir" && git checkout "$ref") || warn "Unable to checkout ref $ref for $dir"
|
||||
fi
|
||||
elif [ -d "$dir" ]; then
|
||||
warn "$dir exists but is not a git repository; leaving in place"
|
||||
else
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
# Module-specific hook for mod-ale compatibility patches
|
||||
# NOTE: These patches are primarily needed for the AzerothCore playerbots fork
|
||||
set -e
|
||||
|
||||
# Hook environment
|
||||
@@ -7,12 +8,42 @@ MODULE_KEY="${MODULE_KEY:-}"
|
||||
MODULE_DIR="${MODULE_DIR:-}"
|
||||
MODULE_NAME="${MODULE_NAME:-}"
|
||||
|
||||
# Detect if we're building with playerbots fork
|
||||
IS_PLAYERBOTS_FORK=0
|
||||
|
||||
# Method 1: Check STACK_SOURCE_VARIANT environment variable
|
||||
if [ "${STACK_SOURCE_VARIANT:-}" = "playerbots" ]; then
|
||||
IS_PLAYERBOTS_FORK=1
|
||||
echo " ✅ Playerbots detected via STACK_SOURCE_VARIANT"
|
||||
# Method 2: Check MODULES_REBUILD_SOURCE_PATH
|
||||
elif [ -n "${MODULES_REBUILD_SOURCE_PATH:-}" ] && echo "${MODULES_REBUILD_SOURCE_PATH}" | grep -q "azerothcore-playerbots"; then
|
||||
IS_PLAYERBOTS_FORK=1
|
||||
echo " ✅ Playerbots detected via MODULES_REBUILD_SOURCE_PATH"
|
||||
else
|
||||
echo " ❌ Playerbots fork not detected"
|
||||
echo " 🔍 Debug: STACK_SOURCE_VARIANT='${STACK_SOURCE_VARIANT:-}'"
|
||||
echo " 🔍 Debug: MODULES_REBUILD_SOURCE_PATH='${MODULES_REBUILD_SOURCE_PATH:-}'"
|
||||
fi
|
||||
|
||||
# Feature flags (set to 0 to disable specific patches)
|
||||
APPLY_MOVEPATH_PATCH="${APPLY_MOVEPATH_PATCH:-0}" # Disabled by default - appears unnecessary
|
||||
# SendTrainerList patch: auto-detect based on fork, but can be overridden
|
||||
if [ -z "${APPLY_SENDTRAINERLIST_PATCH:-}" ]; then
|
||||
APPLY_SENDTRAINERLIST_PATCH="$IS_PLAYERBOTS_FORK" # Only needed for playerbots fork
|
||||
else
|
||||
APPLY_SENDTRAINERLIST_PATCH="${APPLY_SENDTRAINERLIST_PATCH}"
|
||||
fi
|
||||
|
||||
if [ -z "$MODULE_DIR" ] || [ ! -d "$MODULE_DIR" ]; then
|
||||
echo "❌ mod-ale-patches: Invalid module directory: $MODULE_DIR"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo "🔧 mod-ale-patches: Applying compatibility fixes to $MODULE_NAME"
|
||||
if [ "$IS_PLAYERBOTS_FORK" = "1" ]; then
|
||||
echo "🔧 mod-ale-patches: Applying playerbots fork compatibility fixes to $MODULE_NAME"
|
||||
else
|
||||
echo "🔧 mod-ale-patches: Checking compatibility fixes for $MODULE_NAME"
|
||||
fi
|
||||
|
||||
# Apply MovePath compatibility patch
|
||||
apply_movepath_patch() {
|
||||
@@ -37,10 +68,42 @@ apply_movepath_patch() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Apply SendTrainerList compatibility patch
|
||||
apply_sendtrainerlist_patch() {
|
||||
local target_file="$MODULE_DIR/src/LuaEngine/methods/PlayerMethods.h"
|
||||
|
||||
if [ ! -f "$target_file" ]; then
|
||||
echo " ⚠️ SendTrainerList patch target file missing: $target_file"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Check if the buggy code exists (without GetGUID())
|
||||
if grep -q 'player->GetSession()->SendTrainerList(obj);' "$target_file"; then
|
||||
# Apply the fix by adding ->GetGUID()
|
||||
if sed -i 's/player->GetSession()->SendTrainerList(obj);/player->GetSession()->SendTrainerList(obj->GetGUID());/' "$target_file"; then
|
||||
echo " ✅ Applied SendTrainerList compatibility fix"
|
||||
return 0
|
||||
else
|
||||
echo " ❌ Failed to apply SendTrainerList compatibility fix"
|
||||
return 2
|
||||
fi
|
||||
else
|
||||
echo " ✅ SendTrainerList compatibility fix already present"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
# Apply all patches
|
||||
patch_count=0
|
||||
if apply_movepath_patch; then
|
||||
patch_count=$((patch_count + 1))
|
||||
if [ "$APPLY_MOVEPATH_PATCH" = "1" ]; then
|
||||
if apply_movepath_patch; then
|
||||
patch_count=$((patch_count + 1))
|
||||
fi
|
||||
fi
|
||||
if [ "$APPLY_SENDTRAINERLIST_PATCH" = "1" ]; then
|
||||
if apply_sendtrainerlist_patch; then
|
||||
patch_count=$((patch_count + 1))
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $patch_count -eq 0 ]; then
|
||||
|
||||
11
setup.sh
11
setup.sh
@@ -1487,11 +1487,16 @@ fi
|
||||
MODULES_CPP_LIST="$(IFS=','; printf '%s' "${enabled_cpp_module_keys[*]}")"
|
||||
fi
|
||||
|
||||
local STACK_IMAGE_MODE="standard"
|
||||
# Determine source variant based ONLY on playerbots module
|
||||
local STACK_SOURCE_VARIANT="core"
|
||||
if [ "$MODULE_PLAYERBOTS" = "1" ] || [ "$PLAYERBOT_ENABLED" = "1" ]; then
|
||||
STACK_IMAGE_MODE="playerbots"
|
||||
STACK_SOURCE_VARIANT="playerbots"
|
||||
fi
|
||||
|
||||
# Determine image mode based on source variant and build requirements
|
||||
local STACK_IMAGE_MODE="standard"
|
||||
if [ "$STACK_SOURCE_VARIANT" = "playerbots" ]; then
|
||||
STACK_IMAGE_MODE="playerbots"
|
||||
elif [ "$NEEDS_CXX_REBUILD" = "1" ]; then
|
||||
STACK_IMAGE_MODE="modules"
|
||||
fi
|
||||
@@ -1587,7 +1592,7 @@ fi
|
||||
fi
|
||||
|
||||
local default_source_rel="${LOCAL_STORAGE_ROOT}/source/azerothcore"
|
||||
if [ "$MODULE_PLAYERBOTS" = "1" ]; then
|
||||
if [ "$STACK_SOURCE_VARIANT" = "playerbots" ]; then
|
||||
default_source_rel="${LOCAL_STORAGE_ROOT}/source/azerothcore-playerbots"
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user