From 8a147d17849be996f3e1b81b88d32720ddcd6572 Mon Sep 17 00:00:00 2001 From: Circa Date: Sun, 12 Jul 2026 13:27:26 -0400 Subject: [PATCH 1/4] Bundle SDL3 in macOS app bundles Bundle libSDL3.dylib into each generated macOS application bundle to support Homebrew's sdl2-compat packaging. - Install sdl2-compat and SDL3 - Bundle libSDL3.dylib into each .app - Re-sign modified app bundles - Verify bundled SDL runtime during CI --- .github/workflows/build.yml | 54 ++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d527195f83..c8987589a1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -216,7 +216,7 @@ jobs: - name: Create Build Environment run: | - brew install zlib libjpeg libpng sdl2 + brew install zlib libjpeg libpng sdl2-compat sdl3 cmake -E make_directory ${{ github.workspace }}/build - name: Configure CMake @@ -243,6 +243,58 @@ jobs: shell: bash run: cmake --install . + - name: Bundle SDL runtime + if: ${{ matrix.build_type == 'Release' }} + shell: bash + run: | + set -euo pipefail + + SDL3_DYLIB="$(brew --prefix sdl3)/lib/libSDL3.dylib" + + if [ ! -f "$SDL3_DYLIB" ]; then + echo "SDL3 library not found: $SDL3_DYLIB" + exit 1 + fi + + find "${{ github.workspace }}/install" -type d -name "*.app" -print0 | + while IFS= read -r -d '' APP; do + FRAMEWORKS="$APP/Contents/Frameworks" + + echo "Bundling SDL3 into: $APP" + + mkdir -p "$FRAMEWORKS" + cp -L "$SDL3_DYLIB" "$FRAMEWORKS/libSDL3.dylib" + + codesign --force --deep --sign - "$APP" + done + + - name: Verify SDL runtime + if: ${{ matrix.build_type == 'Release' }} + shell: bash + run: | + set -euo pipefail + + find "${{ github.workspace }}/install" -type d -name "*.app" -print0 | + while IFS= read -r -d '' APP; do + FRAMEWORKS="$APP/Contents/Frameworks" + + echo "Checking: $APP" + + test -f "$FRAMEWORKS/libSDL2-2.0.0.dylib" + test -f "$FRAMEWORKS/libSDL3.dylib" + + file "$FRAMEWORKS/libSDL2-2.0.0.dylib" + file "$FRAMEWORKS/libSDL3.dylib" + + echo "SDL2:" + otool -L "$FRAMEWORKS/libSDL2-2.0.0.dylib" + + echo "SDL3:" + otool -L "$FRAMEWORKS/libSDL3.dylib" + + codesign --verify --deep --strict "$APP" + done + - name: Create OpenJK binary archive if: ${{ matrix.build_type == 'Release' }} working-directory: ${{ github.workspace }}/install/JediAcademy From c932832464ad09b81187beed4d653f853d91738c Mon Sep 17 00:00:00 2001 From: Circa Date: Wed, 29 Jul 2026 12:58:58 -0400 Subject: [PATCH 2/4] Testing macos builds with sdl2 internal --- .github/workflows/build.yml | 58 ++----------------------------------- 1 file changed, 3 insertions(+), 55 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c8987589a1..07eb118a04 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -216,8 +216,8 @@ jobs: - name: Create Build Environment run: | - brew install zlib libjpeg libpng sdl2-compat sdl3 - cmake -E make_directory ${{ github.workspace }}/build + brew install zlib libjpeg libpng + cmake -E make_directory "${{ github.workspace }}/build" - name: Configure CMake shell: bash @@ -227,7 +227,7 @@ jobs: if [ "${{ matrix.portable }}" == "Portable" ]; then OPTIONS+=" -DUseInternalLibs=ON -DBuildPortableVersion=ON" else - OPTIONS+=" -DUseInternalLibs=OFF -DBuildPortableVersion=OFF" + OPTIONS+=" -DUseInternalLibs=ON -DBuildPortableVersion=OFF" fi OPTIONS+=" -DBuildJK2SPEngine=ON -DBuildJK2SPGame=ON -DBuildJK2SPRdVanilla=ON" cmake $GITHUB_WORKSPACE $OPTIONS @@ -243,58 +243,6 @@ jobs: shell: bash run: cmake --install . - - name: Bundle SDL runtime - if: ${{ matrix.build_type == 'Release' }} - shell: bash - run: | - set -euo pipefail - - SDL3_DYLIB="$(brew --prefix sdl3)/lib/libSDL3.dylib" - - if [ ! -f "$SDL3_DYLIB" ]; then - echo "SDL3 library not found: $SDL3_DYLIB" - exit 1 - fi - - find "${{ github.workspace }}/install" -type d -name "*.app" -print0 | - while IFS= read -r -d '' APP; do - FRAMEWORKS="$APP/Contents/Frameworks" - - echo "Bundling SDL3 into: $APP" - - mkdir -p "$FRAMEWORKS" - cp -L "$SDL3_DYLIB" "$FRAMEWORKS/libSDL3.dylib" - - codesign --force --deep --sign - "$APP" - done - - - name: Verify SDL runtime - if: ${{ matrix.build_type == 'Release' }} - shell: bash - run: | - set -euo pipefail - - find "${{ github.workspace }}/install" -type d -name "*.app" -print0 | - while IFS= read -r -d '' APP; do - FRAMEWORKS="$APP/Contents/Frameworks" - - echo "Checking: $APP" - - test -f "$FRAMEWORKS/libSDL2-2.0.0.dylib" - test -f "$FRAMEWORKS/libSDL3.dylib" - - file "$FRAMEWORKS/libSDL2-2.0.0.dylib" - file "$FRAMEWORKS/libSDL3.dylib" - - echo "SDL2:" - otool -L "$FRAMEWORKS/libSDL2-2.0.0.dylib" - - echo "SDL3:" - otool -L "$FRAMEWORKS/libSDL3.dylib" - - codesign --verify --deep --strict "$APP" - done - - name: Create OpenJK binary archive if: ${{ matrix.build_type == 'Release' }} working-directory: ${{ github.workspace }}/install/JediAcademy From 6d4889d8644054a15240782efb882fdaf947f3e3 Mon Sep 17 00:00:00 2001 From: Circa Date: Wed, 29 Jul 2026 13:12:36 -0400 Subject: [PATCH 3/4] Use bundled SDL2 for macOS builds --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 07eb118a04..64f691d7ce 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -227,7 +227,7 @@ jobs: if [ "${{ matrix.portable }}" == "Portable" ]; then OPTIONS+=" -DUseInternalLibs=ON -DBuildPortableVersion=ON" else - OPTIONS+=" -DUseInternalLibs=ON -DBuildPortableVersion=OFF" + OPTIONS+=" -DUseInternalLibs=OFF -DUseInternalSDL2=ON -DBuildPortableVersion=OFF" fi OPTIONS+=" -DBuildJK2SPEngine=ON -DBuildJK2SPGame=ON -DBuildJK2SPRdVanilla=ON" cmake $GITHUB_WORKSPACE $OPTIONS From 58bcddfcd71ed0f1fbbb8a2a9e55d5495a30fa25 Mon Sep 17 00:00:00 2001 From: Circa Date: Wed, 29 Jul 2026 13:51:44 -0400 Subject: [PATCH 4/4] Use bundled SDL2 for macOS builds --- .github/workflows/build.yml | 56 +++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 64f691d7ce..061c2f15f5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -215,19 +215,53 @@ jobs: fetch-tags: true - name: Create Build Environment + shell: bash run: | - brew install zlib libjpeg libpng + set -euo pipefail + + brew install libjpeg libpng + cmake -E make_directory "${{ github.workspace }}/build" + cmake -E make_directory "${{ github.workspace }}/sdl-build" + cmake -E make_directory "${{ github.workspace }}/sdl-prefix" + + if [ "${{ matrix.arch }}" = "arm64" ]; then + SDL_DEPLOYMENT_TARGET="11.0" + else + SDL_DEPLOYMENT_TARGET="10.9" + fi + + git clone \ + --branch release-2.32.10 \ + --depth 1 \ + https://github.com/libsdl-org/SDL.git \ + "${{ github.workspace }}/SDL2-source" + + cmake \ + -S "${{ github.workspace }}/SDL2-source" \ + -B "${{ github.workspace }}/sdl-build" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/sdl-prefix" \ + -DCMAKE_OSX_DEPLOYMENT_TARGET="$SDL_DEPLOYMENT_TARGET" \ + -DSDL_SHARED=ON \ + -DSDL_STATIC=OFF \ + -DSDL_TEST=OFF + + cmake --build "${{ github.workspace }}/sdl-build" \ + --parallel "$(sysctl -n hw.logicalcpu)" + + cmake --install "${{ github.workspace }}/sdl-build" - name: Configure CMake shell: bash working-directory: ${{ github.workspace }}/build run: | OPTIONS="-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install" + OPTIONS+=" -DCMAKE_PREFIX_PATH=${{ github.workspace }}/sdl-prefix" if [ "${{ matrix.portable }}" == "Portable" ]; then - OPTIONS+=" -DUseInternalLibs=ON -DBuildPortableVersion=ON" + OPTIONS+=" -DUseInternalLibs=ON -DUseInternalSDL2=OFF -DBuildPortableVersion=ON" else - OPTIONS+=" -DUseInternalLibs=OFF -DUseInternalSDL2=ON -DBuildPortableVersion=OFF" + OPTIONS+=" -DUseInternalLibs=OFF -DUseInternalSDL2=OFF -DBuildPortableVersion=OFF" fi OPTIONS+=" -DBuildJK2SPEngine=ON -DBuildJK2SPGame=ON -DBuildJK2SPRdVanilla=ON" cmake $GITHUB_WORKSPACE $OPTIONS @@ -243,6 +277,22 @@ jobs: shell: bash run: cmake --install . + - name: Verify macOS dependencies + if: ${{ matrix.build_type == 'Release' }} + shell: bash + run: | + set -euo pipefail + + find "${{ github.workspace }}/install" -name '*.app' -type d -print + + find "${{ github.workspace }}/install" -type f -perm +111 -print0 | + while IFS= read -r -d '' binary; do + if file "$binary" | grep -q 'Mach-O'; then + echo "Dependencies for $binary:" + otool -L "$binary" + fi + done + - name: Create OpenJK binary archive if: ${{ matrix.build_type == 'Release' }} working-directory: ${{ github.workspace }}/install/JediAcademy