diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 4ccc291..1b63660 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -15,12 +15,12 @@ jobs: - name: Checkout RetroDebugger uses: actions/checkout@v6 - # SDL2 is the only external (Homebrew) dependency of the macOS build; it - # provides libSDL2.a, which the MTEngineSDL static lib merges in (libtool). - # llama.cpp / ftxui / mbedtls are built by MTEngineSDL's Xcode script phases, - # and uSockets is built by build-macos.sh — neither needs Homebrew here. - - name: Install macOS dependencies - run: brew install sdl2 + # No Homebrew dependencies anymore. `brew install sdl2` used to provide + # libSDL2.a, but the formula is nowadays an alias for sdl2-compat (a dynamic + # shim over SDL3) which ships no static archive — the libtool step of + # MTEngineSDL then failed with "could not find 'libSDL2.a'". Static SDL2 is + # now built from source and staged by build-macos.sh, next to uSockets.a. + # llama.cpp / ftxui / mbedtls are built by MTEngineSDL's Xcode script phases. - name: Build and package release id: release diff --git a/build-macos.sh b/build-macos.sh index b31ca1a..573a1ac 100755 --- a/build-macos.sh +++ b/build-macos.sh @@ -30,6 +30,24 @@ echo "Building uSockets and staging uSockets.a for MTEngineSDL (macOS)" mkdir -p "$CURRENT_DIR/../MTEngineSDL/platform/MacOS/libs/" cp -f "$CURRENT_DIR/../uSockets/uSockets.a" "$CURRENT_DIR/../MTEngineSDL/platform/MacOS/libs/" +# SDL2: Homebrew's "sdl2" formula is nowadays an alias for sdl2-compat (a dynamic +# shim over SDL3) and no longer ships a static libSDL2.a, so `brew install sdl2` +# stopped providing the archive MTEngineSDL's libtool step merges in. Build static +# SDL2 from source and stage it next to uSockets.a — with the file present, Xcode +# hands libtool a full path (same as uSockets.a) instead of relying on -L/-lSDL2. +SDL2_VER=2.32.10 +SDL2_A="$CURRENT_DIR/../MTEngineSDL/platform/MacOS/libs/libSDL2.a" +if [ ! -f "$SDL2_A" ]; then + echo "Building static SDL2 $SDL2_VER and staging libSDL2.a for MTEngineSDL (macOS)" + curl -fL -o "$CURRENT_DIR/../SDL2-src.tar.gz" "https://github.com/libsdl-org/SDL/releases/download/release-$SDL2_VER/SDL2-$SDL2_VER.tar.gz" + tar xzf "$CURRENT_DIR/../SDL2-src.tar.gz" -C "$CURRENT_DIR/.." + cmake -S "$CURRENT_DIR/../SDL2-$SDL2_VER" -B "$CURRENT_DIR/../sdl2-build" \ + -DSDL_STATIC=ON -DSDL_SHARED=OFF -DSDL_TEST=OFF \ + -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 + cmake --build "$CURRENT_DIR/../sdl2-build" -j"$(sysctl -n hw.ncpu)" + cp -f "$CURRENT_DIR/../sdl2-build/libSDL2.a" "$SDL2_A" +fi + # --- build RetroDebugger via Xcode --- cd "$CURRENT_DIR" DERIVED="$CURRENT_DIR/build-macos"