Fix macOS build process and make shell scripts cross-platform

- Add vulkan-loader, vulkan-headers, shaderc to macOS CI brew install
- Add vulkan-loader and shaderc to macOS PKG_CONFIG_PATH
- Replace Linux-only `nproc` with portable fallback in build.sh,
  rebuild.sh, extract_assets.sh, and tools/backup_assets.sh
- Replace `ldconfig` StormLib check with portable detection
  (ldconfig, pkg-config, brew lib) in extract_assets.sh
- Update BUILD_INSTRUCTIONS.md macOS section with vulkan/shaderc
  packages and MoltenVK explanation
- Add macOS prerequisites to README.md
This commit is contained in:
Kelsi 2026-02-23 18:35:53 -08:00
parent eb549a9b7a
commit f66b9eb154
7 changed files with 42 additions and 13 deletions

View file

@ -89,14 +89,14 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
brew install cmake pkg-config sdl2 glew glm openssl@3 zlib ffmpeg unicorn \ brew install cmake pkg-config sdl2 glew glm openssl@3 zlib ffmpeg unicorn \
stormlib dylibbundler || true stormlib vulkan-loader vulkan-headers shaderc dylibbundler || true
# dylibbundler may not be in all brew mirrors; install separately to not block others # dylibbundler may not be in all brew mirrors; install separately to not block others
brew install dylibbundler 2>/dev/null || true brew install dylibbundler 2>/dev/null || true
- name: Configure - name: Configure
run: | run: |
BREW=$(brew --prefix) BREW=$(brew --prefix)
export PKG_CONFIG_PATH="$BREW/lib/pkgconfig:$(brew --prefix ffmpeg)/lib/pkgconfig:$(brew --prefix openssl@3)/lib/pkgconfig" export PKG_CONFIG_PATH="$BREW/lib/pkgconfig:$(brew --prefix ffmpeg)/lib/pkgconfig:$(brew --prefix openssl@3)/lib/pkgconfig:$(brew --prefix vulkan-loader)/lib/pkgconfig:$(brew --prefix shaderc)/lib/pkgconfig"
cmake -S . -B build \ cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="$BREW" \ -DCMAKE_PREFIX_PATH="$BREW" \

View file

@ -65,8 +65,18 @@ Supports `classic`, `tbc`, `wotlk` targets (auto-detected if omitted).
### Install Dependencies ### Install Dependencies
Vulkan on macOS is provided via MoltenVK (a Vulkan-to-Metal translation layer),
which is included in the `vulkan-loader` Homebrew package.
```bash ```bash
brew install cmake pkg-config sdl2 glew glm openssl@3 zlib ffmpeg unicorn stormlib brew install cmake pkg-config sdl2 glew glm openssl@3 zlib ffmpeg unicorn \
stormlib vulkan-loader vulkan-headers shaderc
```
Optional (for creating redistributable `.app` bundles):
```bash
brew install dylibbundler
``` ```
### Clone & Build ### Clone & Build
@ -76,7 +86,7 @@ git clone --recurse-submodules https://github.com/Kelsidavis/WoWee.git
cd WoWee cd WoWee
BREW=$(brew --prefix) BREW=$(brew --prefix)
export PKG_CONFIG_PATH="$BREW/lib/pkgconfig:$(brew --prefix ffmpeg)/lib/pkgconfig:$(brew --prefix openssl@3)/lib/pkgconfig" export PKG_CONFIG_PATH="$BREW/lib/pkgconfig:$(brew --prefix ffmpeg)/lib/pkgconfig:$(brew --prefix openssl@3)/lib/pkgconfig:$(brew --prefix vulkan-loader)/lib/pkgconfig:$(brew --prefix shaderc)/lib/pkgconfig"
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="$BREW" \ -DCMAKE_PREFIX_PATH="$BREW" \
-DOPENSSL_ROOT_DIR="$(brew --prefix openssl@3)" -DOPENSSL_ROOT_DIR="$(brew --prefix openssl@3)"

View file

@ -84,6 +84,12 @@ sudo pacman -S sdl2 glm openssl \
ffmpeg zlib cmake base-devel libx11 \ ffmpeg zlib cmake base-devel libx11 \
unicorn # optional: Warden module execution unicorn # optional: Warden module execution
# StormLib: install from AUR for asset_extract tool # StormLib: install from AUR for asset_extract tool
# macOS (Homebrew)
brew install cmake pkg-config sdl2 glew glm openssl@3 zlib ffmpeg \
vulkan-loader vulkan-headers shaderc \
unicorn \ # optional: Warden module execution
stormlib # optional: asset_extract tool
``` ```
### Container build ### Container build

View file

@ -16,8 +16,9 @@ echo "Configuring with CMake..."
cmake .. -DCMAKE_BUILD_TYPE=Release cmake .. -DCMAKE_BUILD_TYPE=Release
# Build with all cores # Build with all cores
echo "Building with $(nproc) cores..." NPROC=$(nproc 2>/dev/null || sysctl -n hw.logicalcpu 2>/dev/null || echo 4)
cmake --build . --parallel $(nproc) echo "Building with $NPROC cores..."
cmake --build . --parallel "$NPROC"
# Ensure Data symlink exists in bin directory # Ensure Data symlink exists in bin directory
cd bin cd bin

View file

@ -63,10 +63,19 @@ fi
# --- Build asset_extract if needed --- # --- Build asset_extract if needed ---
if [ ! -f "$BINARY" ]; then if [ ! -f "$BINARY" ]; then
# --- Check for StormLib (only required to build) --- # --- Check for StormLib (only required to build) ---
if ! ldconfig -p 2>/dev/null | grep -qi stormlib; then STORMLIB_FOUND=false
if ldconfig -p 2>/dev/null | grep -qi stormlib; then
STORMLIB_FOUND=true
elif pkg-config --exists stormlib 2>/dev/null; then
STORMLIB_FOUND=true
elif [ -f "$(brew --prefix 2>/dev/null)/lib/libstorm.dylib" ] 2>/dev/null; then
STORMLIB_FOUND=true
fi
if [ "$STORMLIB_FOUND" = false ]; then
echo "Error: StormLib not found." echo "Error: StormLib not found."
echo "Install it with: sudo apt install libstormlib-dev" echo " Ubuntu/Debian: sudo apt install libstormlib-dev"
echo " or build from source: https://github.com/ladislav-zezula/StormLib" echo " macOS: brew install stormlib"
echo " From source: https://github.com/ladislav-zezula/StormLib"
exit 1 exit 1
fi fi
@ -74,7 +83,8 @@ if [ ! -f "$BINARY" ]; then
if [ ! -d "$BUILD_DIR" ]; then if [ ! -d "$BUILD_DIR" ]; then
cmake -S "$SCRIPT_DIR" -B "$BUILD_DIR" -DCMAKE_BUILD_TYPE=Release cmake -S "$SCRIPT_DIR" -B "$BUILD_DIR" -DCMAKE_BUILD_TYPE=Release
fi fi
cmake --build "$BUILD_DIR" --target asset_extract -- -j"$(nproc)" NPROC=$(nproc 2>/dev/null || sysctl -n hw.logicalcpu 2>/dev/null || echo 4)
cmake --build "$BUILD_DIR" --target asset_extract -- -j"$NPROC"
echo "" echo ""
fi fi

View file

@ -22,8 +22,9 @@ echo "Configuring with CMake..."
cmake .. -DCMAKE_BUILD_TYPE=Release cmake .. -DCMAKE_BUILD_TYPE=Release
# Build with all cores # Build with all cores
echo "Building with $(nproc) cores..." NPROC=$(nproc 2>/dev/null || sysctl -n hw.logicalcpu 2>/dev/null || echo 4)
cmake --build . --parallel $(nproc) echo "Building with $NPROC cores..."
cmake --build . --parallel "$NPROC"
# Create Data symlink in bin directory # Create Data symlink in bin directory
echo "Creating Data symlink..." echo "Creating Data symlink..."

View file

@ -50,7 +50,8 @@ if command -v zstd &>/dev/null; then
tar cf - -C "$(dirname "$DATA_DIR")" "$(basename "$DATA_DIR")" | zstd -T0 -3 -o "$ARCHIVE" tar cf - -C "$(dirname "$DATA_DIR")" "$(basename "$DATA_DIR")" | zstd -T0 -3 -o "$ARCHIVE"
elif command -v pigz &>/dev/null; then elif command -v pigz &>/dev/null; then
ARCHIVE="$BACKUP_DIR/wowee_assets_$TIMESTAMP.tar.gz" ARCHIVE="$BACKUP_DIR/wowee_assets_$TIMESTAMP.tar.gz"
tar cf - -C "$(dirname "$DATA_DIR")" "$(basename "$DATA_DIR")" | pigz -p "$(nproc)" > "$ARCHIVE" NPROC=$(nproc 2>/dev/null || sysctl -n hw.logicalcpu 2>/dev/null || echo 4)
tar cf - -C "$(dirname "$DATA_DIR")" "$(basename "$DATA_DIR")" | pigz -p "$NPROC" > "$ARCHIVE"
else else
ARCHIVE="$BACKUP_DIR/wowee_assets_$TIMESTAMP.tar.gz" ARCHIVE="$BACKUP_DIR/wowee_assets_$TIMESTAMP.tar.gz"
tar czf "$ARCHIVE" -C "$(dirname "$DATA_DIR")" "$(basename "$DATA_DIR")" tar czf "$ARCHIVE" -C "$(dirname "$DATA_DIR")" "$(basename "$DATA_DIR")"