ARM64, LLVM and Matrices #3151
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| build-glfw-linux: | |
| name: Build (GLFW/Linux ${{ matrix.arch }}) | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: x86_64 | |
| runner: ubuntu-24.04 | |
| cc: gcc | |
| cxx: g++ | |
| cflags: "" | |
| cxxflags: "" | |
| ldflags: "" | |
| - arch: i686 | |
| runner: ubuntu-24.04 | |
| cc: gcc | |
| cxx: g++ | |
| cflags: "-m32" | |
| cxxflags: "-m32" | |
| ldflags: "-m32" | |
| - arch: arm64 | |
| runner: ubuntu-24.04-arm64 | |
| cc: gcc | |
| cxx: g++ | |
| cflags: "" | |
| cxxflags: "" | |
| ldflags: "" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get commit info | |
| id: commit-info | |
| run: | | |
| echo "hash=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" | |
| echo "date=$(git log -1 --format=%cd --date=short)" >> "$GITHUB_OUTPUT" | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| cmake \ | |
| ninja-build \ | |
| ccache \ | |
| libglfw3-dev \ | |
| libbz2-dev \ | |
| gcc-multilib \ | |
| g++-multilib | |
| - name: Build 32-bit Wayland/xkbcommon/GLFW for i686 | |
| if: ${{ matrix.arch == 'i686' }} | |
| run: | | |
| sudo dpkg --add-architecture i386 | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| pkg-config python3-pip meson ninja-build cmake \ | |
| libx11-dev:i386 \ | |
| libx11-xcb-dev:i386 \ | |
| libxrandr-dev:i386 \ | |
| libxcursor-dev:i386 \ | |
| libxinerama-dev:i386 \ | |
| libxss-dev:i386 \ | |
| libxi-dev:i386 \ | |
| libxau-dev:i386 \ | |
| libxdmcp-dev:i386 \ | |
| libgl1-mesa-dev:i386 \ | |
| libglu1-mesa-dev:i386 \ | |
| libxkbcommon-dev:i386 \ | |
| libxcb1-dev:i386 \ | |
| libxcb-xkb-dev:i386 \ | |
| libxkbcommon-x11-dev:i386 \ | |
| libffi-dev:i386 \ | |
| libexpat1-dev:i386 \ | |
| libxml2-dev:i386 | |
| python3 -m pip install --user --upgrade "meson>=1.4.0" | |
| export PATH="$HOME/.local/bin:/tmp/wayland32/bin:$PATH" | |
| hash -r | |
| meson --version | |
| which wayland-scanner || true | |
| wayland-scanner --version || true | |
| mkdir -p /tmp/native-pkgconfig | |
| NATIVE_PC=$(pkg-config --variable pcfiledir wayland-scanner)/wayland-scanner.pc | |
| cp "$NATIVE_PC" /tmp/native-pkgconfig/ | |
| git clone --depth 1 https://gitlab.freedesktop.org/wayland/wayland /tmp/wayland | |
| export PKG_CONFIG_LIBDIR="/usr/lib/i386-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig:/tmp/wayland32/lib/pkgconfig:/tmp/wayland32/lib/x86_64-linux-gnu/pkgconfig:/tmp/wayland32/share/pkgconfig" | |
| export PKG_CONFIG_PATH="/tmp/native-pkgconfig:/tmp/wayland32/lib/pkgconfig:/tmp/wayland32/lib/x86_64-linux-gnu/pkgconfig:/tmp/wayland32/share/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" | |
| export PATH="/tmp/wayland32/bin:$HOME/.local/bin:$PATH" | |
| meson setup /tmp/wayland32-build /tmp/wayland \ | |
| --prefix=/tmp/wayland32 \ | |
| -Dc_args=-m32 \ | |
| -Dcpp_args=-m32 \ | |
| -Dc_link_args=-m32 \ | |
| -Dcpp_link_args=-m32 \ | |
| -Ddocumentation=false | |
| ninja -C /tmp/wayland32-build | |
| ninja -C /tmp/wayland32-build install | |
| git clone --depth 1 \ | |
| https://gitlab.freedesktop.org/wayland/wayland-protocols \ | |
| /tmp/wayland-protocols | |
| export PKG_CONFIG_LIBDIR="/usr/lib/i386-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig:/tmp/wayland32/lib/pkgconfig:/tmp/wayland32/lib/x86_64-linux-gnu/pkgconfig:/tmp/wayland32/share/pkgconfig" | |
| export PKG_CONFIG_PATH="/tmp/native-pkgconfig:/tmp/wayland32/lib/pkgconfig:/tmp/wayland32/lib/x86_64-linux-gnu/pkgconfig:/tmp/wayland32/share/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" | |
| export PATH="/tmp/wayland32/bin:$HOME/.local/bin:$PATH" | |
| wayland-scanner --version | |
| which wayland-scanner | |
| meson setup /tmp/wayland-protocols/build \ | |
| /tmp/wayland-protocols \ | |
| --prefix=/tmp/wayland32 \ | |
| -Dtests=false | |
| ninja -C /tmp/wayland-protocols/build install | |
| git clone --depth 1 \ | |
| https://github.com/xkbcommon/libxkbcommon \ | |
| /tmp/xkbcommon | |
| export PKG_CONFIG_LIBDIR="/usr/lib/i386-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig:/tmp/wayland32/lib/pkgconfig:/tmp/wayland32/lib/x86_64-linux-gnu/pkgconfig:/tmp/wayland32/share/pkgconfig" | |
| export PKG_CONFIG_PATH="/tmp/native-pkgconfig:/tmp/wayland32/lib/pkgconfig:/tmp/wayland32/lib/x86_64-linux-gnu/pkgconfig:/tmp/wayland32/share/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" | |
| export PATH="/tmp/wayland32/bin:$HOME/.local/bin:$PATH" | |
| meson setup /tmp/xkbcommon/build \ | |
| /tmp/xkbcommon \ | |
| --prefix=/tmp/wayland32 \ | |
| -Dc_args=-m32 \ | |
| -Dcpp_args=-m32 \ | |
| -Dc_link_args=-m32 \ | |
| -Dcpp_link_args=-m32 | |
| ninja -C /tmp/xkbcommon/build | |
| ninja -C /tmp/xkbcommon/build install | |
| git clone https://github.com/glfw/glfw.git /tmp/glfw | |
| git -C /tmp/glfw fetch --depth=1 origin \ | |
| fdd14e65b1c29e4e6df875fb5669ec00d6793531 | |
| git -C /tmp/glfw checkout FETCH_HEAD | |
| export PKG_CONFIG_LIBDIR="/usr/lib/i386-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig:/tmp/wayland32/lib/pkgconfig:/tmp/wayland32/lib/x86_64-linux-gnu/pkgconfig:/tmp/wayland32/share/pkgconfig" | |
| export PKG_CONFIG_PATH="/tmp/native-pkgconfig:/tmp/wayland32/lib/pkgconfig:/tmp/wayland32/lib/x86_64-linux-gnu/pkgconfig:/tmp/wayland32/share/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" | |
| export PATH="/tmp/wayland32/bin:$HOME/.local/bin:$PATH" | |
| cmake -S /tmp/glfw -B /tmp/glfw/build -G Ninja \ | |
| -DCMAKE_INSTALL_PREFIX=/tmp/glfw32 \ | |
| -DGLFW_BUILD_SHARED_LIBS=OFF \ | |
| -DGLFW_BUILD_EXAMPLES=OFF \ | |
| -DGLFW_BUILD_TESTS=OFF \ | |
| -DGLFW_BUILD_DOCS=OFF \ | |
| -DGLFW_BUILD_WAYLAND=ON \ | |
| -DGLFW_BUILD_X11=ON \ | |
| -DCMAKE_C_FLAGS=-m32 \ | |
| -DCMAKE_CXX_FLAGS=-m32 \ | |
| -DCMAKE_EXE_LINKER_FLAGS=-m32 | |
| ninja -C /tmp/glfw/build | |
| ninja -C /tmp/glfw/build install | |
| - uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/ccache | |
| key: ccache-glfw-linux-${{ matrix.arch }}-${{ github.sha }} | |
| restore-keys: | | |
| ccache-glfw-linux-${{ matrix.arch }}- | |
| - name: Configure | |
| env: | |
| CFLAGS: ${{ matrix.cflags }} | |
| CXXFLAGS: ${{ matrix.cxxflags }} | |
| LDFLAGS: ${{ matrix.ldflags }} | |
| PKG_CONFIG_PATH: ${{ matrix.arch == 'i686' && '/tmp/glfw32/lib/pkgconfig' || '' }} | |
| run: | | |
| cmake -B build -G Ninja \ | |
| -DWERROR=ON \ | |
| -DDESKTOP_BACKEND=glfw3 \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_C_COMPILER="${{ matrix.cc }}" \ | |
| -DCMAKE_CXX_COMPILER="${{ matrix.cxx }}" \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache | |
| - name: Build | |
| run: cmake --build build --parallel | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: butterscotch-glfw-linux-${{ matrix.arch }} | |
| path: build/butterscotch | |
| build-glfw-windows: | |
| name: Build (GLFW/Windows ${{ matrix.arch }}) | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: x86_64 | |
| target: x86_64-w64-windows-gnu | |
| triplet: x86_64-w64-mingw32 | |
| - arch: i686 | |
| target: i686-w64-windows-gnu | |
| triplet: i686-w64-mingw32 | |
| - arch: arm64 | |
| target: aarch64-w64-windows-gnu | |
| triplet: aarch64-w64-mingw32 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get commit info | |
| id: commit-info | |
| run: | | |
| echo "hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| echo "date=$(git log -1 --format=%cd --date=short)" >> $GITHUB_OUTPUT | |
| - name: Install ccache | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ccache | |
| - uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/ccache | |
| key: ccache-glfw-windows-${{ matrix.arch }}-${{ github.sha }} | |
| restore-keys: | | |
| ccache-glfw-windows-${{ matrix.arch }}- | |
| - name: Install LLVM-MinGW | |
| run: | | |
| curl -L \ | |
| https://github.com/mstorsjo/llvm-mingw/releases/download/20260728/llvm-mingw-20260728-ucrt-ubuntu-22.04-x86_64.tar.xz \ | |
| -o /tmp/llvm-mingw.tar.xz | |
| sudo mkdir -p /opt/llvm-mingw | |
| sudo tar -xf /tmp/llvm-mingw.tar.xz \ | |
| --strip-components=1 \ | |
| -C /opt/llvm-mingw | |
| echo "/opt/llvm-mingw/bin" >> "$GITHUB_PATH" | |
| - name: Build GLFW for MinGW | |
| run: | | |
| git clone https://github.com/glfw/glfw.git /tmp/glfw | |
| git -C /tmp/glfw checkout fdd14e65b1c29e4e6df875fb5669ec00d6793531 | |
| cmake -B /tmp/glfw/build -S /tmp/glfw -G Ninja \ | |
| -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/cmake/llvm-mingw.cmake \ | |
| -DTARGET_TRIPLE=${{ matrix.target }} \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
| -DCMAKE_INSTALL_PREFIX=/usr/${{ matrix.triplet }} \ | |
| -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_DOCS=OFF | |
| cmake --build /tmp/glfw/build | |
| sudo cmake --install /tmp/glfw/build | |
| - name: Configure | |
| run: | | |
| cmake -B build -G Ninja \ | |
| -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/cmake/llvm-mingw.cmake \ | |
| -DCMAKE_FIND_ROOT_PATH=/usr/${{ matrix.triplet }} \ | |
| -DTARGET_TRIPLE=${{ matrix.target }} \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
| -DWERROR=ON \ | |
| -DDESKTOP_BACKEND=glfw3 \ | |
| -DCMAKE_BUILD_TYPE=Release | |
| - name: Build | |
| run: cmake --build build | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: butterscotch-glfw-windows-${{ matrix.arch }} | |
| path: build/butterscotch.exe | |
| build-glfw-windows-x86: | |
| name: Build (GLFW/Windows i486) | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.cache/ccache | |
| ~/toolchain-i486.tar | |
| key: win32-artifact-${{ github.sha }} | |
| restore-keys: win32-artifact- | |
| - name: Get commit info | |
| id: commit-info | |
| run: | | |
| echo "hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| echo "date=$(git log -1 --format=%cd --date=short)" >> $GITHUB_OUTPUT | |
| - name: Unpack toolchain cache | |
| run: | | |
| if [ -f ~/toolchain-i486.tar ]; then | |
| tar xf ~/toolchain-i486.tar -C ${{ github.workspace }} | |
| fi | |
| - name: Install MinGW and dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ccache libgmp-dev libmpfr-dev libmpc-dev | |
| if [ ! -d "artifacts/windows/build/toolchain-i486" ]; then | |
| ARCH=i486 ./artifacts/windows/build-toolchain.sh | |
| fi | |
| - name: Build | |
| run: | | |
| PATH="$PWD/artifacts/windows/build/toolchain-i486/bin:$PATH" make \ | |
| NO_COLOR=1 \ | |
| VERBOSE=1 \ | |
| CC='ccache i486-w64-mingw32-gcc' \ | |
| DESKTOP_BACKEND=glfw2 \ | |
| GLFW2_LIBS='-lglfw -lopengl32' \ | |
| EXTRALIBS='-latomic' | |
| - name: Pack toolchain cache | |
| run: | | |
| if [ -d "artifacts/windows/build/toolchain-i486" ]; then | |
| tar cf ~/toolchain-i486.tar artifacts/windows/build/toolchain-i486 | |
| fi | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: butterscotch-glfw-windows-x86 | |
| path: build/butterscotch.exe | |
| build-glfw-macos: | |
| name: Build (AppKit/macOS ${{ matrix.label }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - label: x86_64 | |
| runner: macos-26-intel | |
| - label: arm64 | |
| runner: macos-26 | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get commit info | |
| id: commit-info | |
| run: | | |
| echo "hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| echo "date=$(git log -1 --format=%cd --date=short)" >> $GITHUB_OUTPUT | |
| - name: Install dependencies | |
| run: brew install glfw ccache | |
| env: | |
| HOMEBREW_NO_AUTO_UPDATE: 1 | |
| HOMEBREW_NO_INSTALL_CLEANUP: 1 | |
| - uses: actions/cache@v5 | |
| with: | |
| path: ~/Library/Caches/ccache | |
| key: ccache-macos-${{ matrix.label }}-${{ github.sha }} | |
| restore-keys: | | |
| ccache-macos-${{ matrix.label }}- | |
| - name: Configure | |
| run: | | |
| cmake -B build -G Ninja \ | |
| -DWERROR=ON \ | |
| -DCMAKE_C_FLAGS="-Wno-deprecated-declarations" \ | |
| -DDESKTOP_BACKEND=appkit \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
| -DCMAKE_BUILD_TYPE=Release | |
| - name: Build | |
| run: cmake --build build | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: butterscotch-appkit-macos-${{ matrix.label }} | |
| path: build/butterscotch | |
| build-sdl2-freebsd: | |
| name: Build (SDL2/FreeBSD ${{ matrix.arch }}) | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: [amd64, i386] | |
| env: | |
| FREEBSD_SYSROOT: /opt/freebsd-sysroot | |
| FREEBSD_MAJOR: 14 | |
| FREEBSD_MINOR: 3 | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Install ccache | |
| run: sudo apt-get update && sudo apt-get install -y ccache | |
| - uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/ccache | |
| key: ccache-freebsd-${{ matrix.arch }}-${{ github.sha }} | |
| restore-keys: | | |
| ccache-freebsd-${{ matrix.arch }}- | |
| - name: Download FreeBSD sysroot | |
| run: | | |
| curl -L -o sysroot.tar.xz https://download.freebsd.org/releases/${{ matrix.arch }}/${{ env.FREEBSD_MAJOR }}.${{ env.FREEBSD_MINOR }}-RELEASE/base.txz | |
| sudo mkdir -p ${{ env.FREEBSD_SYSROOT }} | |
| sudo tar -xJf sysroot.tar.xz -C ${{ env.FREEBSD_SYSROOT }} | |
| rm sysroot.tar.xz | |
| - name: Download SDL2 for FreeBSD | |
| run: | | |
| # first we get the packagesite | |
| curl -L -o packagesite.pkg "https://pkg.freebsd.org/FreeBSD:${{ env.FREEBSD_MAJOR }}:${{ matrix.arch }}/latest/packagesite.pkg" | |
| mkdir -p /tmp/packagesite | |
| tar -xf packagesite.pkg -C /tmp/packagesite | |
| rm packagesite.pkg | |
| SDL2_REPOPATH="$(grep -m 1 '"name":"sdl2"' /tmp/packagesite/packagesite.yaml | sed -n 's/.*"path":"\([^"]*\)".*/\1/p')" | |
| # then we get SDL2 | |
| curl -L -o sdl2.pkg "https://pkg.freebsd.org/FreeBSD:${{ env.FREEBSD_MAJOR }}:${{ matrix.arch }}/latest/${SDL2_REPOPATH}" | |
| sudo tar -xf sdl2.pkg -C ${{ env.FREEBSD_SYSROOT }} | |
| rm sdl2.pkg | |
| - name: Configure and build Butterscotch | |
| env: | |
| PKG_CONFIG_DIR: "" | |
| PKG_CONFIG_LIBDIR: ${{ env.FREEBSD_SYSROOT }}/usr/local/libdata/pkgconfig:${{ env.FREEBSD_SYSROOT }}/usr/libdata/pkgconfig | |
| PKG_CONFIG_SYSROOT_DIR: ${{ env.FREEBSD_SYSROOT }} | |
| run: | | |
| cmake -S . -B build -G Ninja \ | |
| -DDESKTOP_BACKEND=sdl2 \ | |
| -DAUDIO_BACKEND=miniaudio \ | |
| -DWERROR=ON \ | |
| -DCMAKE_SYSROOT=${{ env.FREEBSD_SYSROOT }} \ | |
| -DCMAKE_TOOLCHAIN_FILE=cmake/freebsd-${{ matrix.arch }}.cmake \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
| -DCMAKE_BUILD_TYPE=Release | |
| cmake --build build | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: butterscotch-sdl2-freebsd-${{ matrix.arch }} | |
| path: build/butterscotch | |
| build-ps2: | |
| name: Build (PS2)${{ matrix.label }} | |
| runs-on: ubuntu-24.04 | |
| container: | |
| image: ps2dev/ps2dev:latest | |
| env: | |
| CCACHE_IGNOREOPTIONS: "-DBUTTERSCOTCH_COMMIT_HASH=* -DBUTTERSCOTCH_COMMIT_DATE=*" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - label: "" | |
| artifact: butterscotch-ps2 | |
| extra_flags: "" | |
| - label: " [WAD Version 14]" | |
| artifact: butterscotch-ps2-wad14 | |
| extra_flags: "-DENABLE_WAD14=ON -DENABLE_WAD16=OFF -DENABLE_WAD17=OFF" | |
| - label: " [WAD Version 16]" | |
| artifact: butterscotch-ps2-wad16 | |
| extra_flags: "-DENABLE_WAD14=OFF -DENABLE_WAD16=ON -DENABLE_WAD17=OFF" | |
| - label: " [WAD Version 17]" | |
| artifact: butterscotch-ps2-wad17 | |
| extra_flags: "-DENABLE_WAD14=OFF -DENABLE_WAD16=OFF -DENABLE_WAD17=ON" | |
| steps: | |
| - name: Install build tools | |
| run: apk add --no-cache cmake ninja ccache gmp-dev mpfr-dev mpc1-dev git tar | |
| - uses: actions/checkout@v4 | |
| - uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/ccache | |
| key: ccache-ps2-${{ matrix.artifact }}-${{ github.sha }} | |
| restore-keys: | | |
| ccache-ps2-${{ matrix.artifact }}- | |
| # Yeah, the safe.directory is needed because "fatal: detected dubious ownership in repository at '/__w/Butterscotch/Butterscotch'" | |
| - name: Get commit info | |
| id: commit-info | |
| run: | | |
| git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
| echo "hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| echo "date=$(git log -1 --format=%cd --date=format:'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT | |
| - name: Configure | |
| run: | | |
| mkdir -p build | |
| export CFLAGS="-fopt-info-inline-optimized=$PWD/build/inline_report.txt" | |
| cmake -B build -G Ninja -DCMAKE_TOOLCHAIN_FILE=$PS2SDK/ps2dev.cmake -DWERROR=ON -DPLATFORM=ps2 -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ${{ matrix.extra_flags }} -DCMAKE_BUILD_TYPE=Release "-DBUTTERSCOTCH_COMMIT_HASH=${{ steps.commit-info.outputs.hash }}" "-DBUTTERSCOTCH_COMMIT_DATE=${{ steps.commit-info.outputs.date }}" | |
| - name: Build | |
| run: | | |
| cmake --build build | |
| cp build/butterscotch build/butterscotch.elf | |
| - name: Check executeLoop I-Cache fit | |
| run: | | |
| # Extract executeLoop function size(s) from the ELF symbol table. | |
| # GCC IPA passes (constprop/isra/part) may clone a static function and | |
| # suffix the clones (e.g. "executeLoop.constprop.0"). Sum all variants | |
| # since they all share the 16 KB I-Cache budget. | |
| # nm -S prints: address size type name | |
| echo "Getting executeLoop size from ELF symbol table..." | |
| SYMBOL_LINES=$(mips64r5900el-ps2-elf-nm -S build/butterscotch.elf | grep -E ' executeLoop(\..*)?$' || true) | |
| if [ -z "$SYMBOL_LINES" ]; then | |
| echo "::error::Could not find executeLoop symbol in ELF (is it stripped?)" | |
| exit 1 | |
| fi | |
| echo "$SYMBOL_LINES" | |
| SIZE_DEC=0 | |
| VARIANT_COUNT=0 | |
| for SIZE_HEX in $(echo "$SYMBOL_LINES" | awk '{print $2}'); do | |
| SIZE_DEC=$((SIZE_DEC + 0x$SIZE_HEX)) | |
| VARIANT_COUNT=$((VARIANT_COUNT + 1)) | |
| done | |
| LIMIT=16384 | |
| if [ "$SIZE_DEC" -gt "$LIMIT" ]; then | |
| echo "::error::executeLoop is $SIZE_DEC bytes across $VARIANT_COUNT variant(s), exceeding the PS2 16 KB I-Cache ($LIMIT bytes) by $((SIZE_DEC - LIMIT)) bytes" | |
| echo "| Function | Size | Limit | Status |" >> $GITHUB_STEP_SUMMARY | |
| echo "|----------|------|-------|--------|" >> $GITHUB_STEP_SUMMARY | |
| echo "| \`executeLoop\` ($VARIANT_COUNT variant(s)) | $SIZE_DEC bytes | $LIMIT bytes (16 KB) | **EXCEEDED** by $((SIZE_DEC - LIMIT)) bytes |" >> $GITHUB_STEP_SUMMARY | |
| exit 1 | |
| fi | |
| echo "| Function | Size | Limit | Status |" >> $GITHUB_STEP_SUMMARY | |
| echo "|----------|------|-------|--------|" >> $GITHUB_STEP_SUMMARY | |
| echo "| \`executeLoop\` ($VARIANT_COUNT variant(s)) | $SIZE_DEC bytes | $LIMIT bytes (16 KB) | $((LIMIT - SIZE_DEC)) bytes remaining |" >> $GITHUB_STEP_SUMMARY | |
| - name: Report executeLoop inlining | |
| run: | | |
| REPORT=build/inline_report.txt | |
| if [ ! -s "$REPORT" ]; then | |
| echo "::warning::No inline report produced at $REPORT" | |
| exit 0 | |
| fi | |
| # Extract callees that GCC reported as inlined into executeLoop | |
| INLINED=$(grep -E "Inlin(ed|ing) .* into executeLoop" "$REPORT" \ | |
| | awk '{for(i=1;i<=NF;i++) if($i=="into" && $(i+1) ~ /^executeLoop/) {name=$(i-1); sub(/\/[0-9]+$/,"",name); print name}}' \ | |
| | sort -u) | |
| # Cross-check: jal targets still present in the compiled executeLoop | |
| # (including GCC-cloned variants like executeLoop.constprop.0). | |
| VARIANT_NAMES=$(mips64r5900el-ps2-elf-nm build/butterscotch.elf | awk '/ executeLoop(\..*)?$/ {print $3}') | |
| DISASM_ARGS="" | |
| for NAME in $VARIANT_NAMES; do | |
| DISASM_ARGS="$DISASM_ARGS --disassemble=$NAME" | |
| done | |
| NOT_INLINED=$(mips64r5900el-ps2-elf-objdump -d $DISASM_ARGS build/butterscotch.elf 2>/dev/null \ | |
| | grep -oE "jal[[:space:]]+[0-9a-f]+ <[^>]+>" \ | |
| | sed -E 's/.*<([^>]+)>/\1/' \ | |
| | sort -u) | |
| INLINED_COUNT=$(printf "%s\n" "$INLINED" | grep -c . || true) | |
| NOT_INLINED_COUNT=$(printf "%s\n" "$NOT_INLINED" | grep -c . || true) | |
| { | |
| echo "" | |
| echo "### \`executeLoop\` inlining report" | |
| echo "" | |
| echo "<details><summary>Inlined into <code>executeLoop</code> ($INLINED_COUNT callees, per GCC <code>-fopt-info-inline-optimized</code>)</summary>" | |
| echo "" | |
| echo '```' | |
| printf "%s\n" "$INLINED" | |
| echo '```' | |
| echo "" | |
| echo "</details>" | |
| echo "" | |
| echo "<details><summary>Still called via <code>jal</code> from <code>executeLoop</code> ($NOT_INLINED_COUNT symbols, per <code>objdump</code>)</summary>" | |
| echo "" | |
| echo '```' | |
| printf "%s\n" "$NOT_INLINED" | |
| echo '```' | |
| echo "" | |
| echo "</details>" | |
| } >> $GITHUB_STEP_SUMMARY | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: build/butterscotch.elf | |
| build-web: | |
| name: Build (Web)${{ matrix.label }} | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - label: "" | |
| platform: web | |
| artifact: butterscotch-web | |
| output_glob: build/butterscotch.* | |
| - label: " [Meta]" | |
| platform: web-meta | |
| artifact: butterscotch-web-meta | |
| output_glob: build/butterscotch-meta.* | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get commit info | |
| id: commit-info | |
| run: | | |
| echo "hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| echo "date=$(git log -1 --format=%cd --date=short)" >> $GITHUB_OUTPUT | |
| - name: Setup Emscripten SDK | |
| uses: mymindstorm/setup-emsdk@v14 | |
| with: | |
| version: latest | |
| - name: Install ccache | |
| run: sudo apt-get update && sudo apt-get install -y ccache | |
| - uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/ccache | |
| key: ccache-web-${{ matrix.platform }}-${{ github.sha }} | |
| restore-keys: | | |
| ccache-web-${{ matrix.platform }}- | |
| - name: Configure | |
| run: emcmake cmake -B build -G Ninja -DWERROR=ON -DPLATFORM=${{ matrix.platform }} -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache | |
| - name: Build | |
| run: cmake --build build | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: ${{ matrix.output_glob }} | |
| build-ps3: | |
| name: Build (PS3) | |
| runs-on: ubuntu-24.04 | |
| container: scummvm/dockerized-toolchains:ps3 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install ccache | |
| run: apt-get update && apt-get install -y ccache | |
| - uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/ccache | |
| key: ccache-ps3-${{ github.sha }} | |
| restore-keys: | | |
| ccache-ps3- | |
| - name: Configure | |
| run: cmake -B build -G Ninja -DWERROR=ON -DPLATFORM=ps3 -DCMAKE_TOOLCHAIN_FILE=cmake/ppu.cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Release | |
| - name: Build | |
| run: | | |
| cmake --build build | |
| sprxlinker build/butterscotch.elf | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: butterscotch-ps3 | |
| path: build/butterscotch.elf | |
| build-vita: | |
| name: Build (PS Vita) | |
| runs-on: ubuntu-24.04 | |
| container: vitasdk/vitasdk:latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Ninja | |
| run: | | |
| apk add --no-cache ninja ccache tar | |
| - uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/ccache | |
| key: ccache-vita-${{ github.sha }} | |
| restore-keys: | | |
| ccache-vita- | |
| - name: Checkout vitaGL | |
| run: | | |
| git clone --depth 1 https://github.com/Rinnegatamante/vitaGL.git vendor/vitaGL | |
| - name: Build vitaGL with speedhacks | |
| run: | | |
| CC="ccache arm-vita-eabi-gcc" CXX="ccache arm-vita-eabi-g++" make -C vendor/vitaGL \ | |
| install \ | |
| NO_DEBUG=1 \ | |
| NO_SPLASHSCREEN=1 \ | |
| LOG_ERRORS=1 \ | |
| HAVE_SHADER_CACHE=1 \ | |
| USE_SCRATCH_MEMORY=1 \ | |
| DEPTH_STENCIL_HACK=1 \ | |
| READBACKS_SPEEDHACK=1 \ | |
| -j$(nproc) | |
| - name: Configure | |
| run: | | |
| cmake -B build -G Ninja -DWERROR=ON -DPLATFORM=vita -DAUDIO_BACKEND=openal -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache | |
| - name: Build | |
| run: | | |
| cmake --build build | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: butterscotch-vita | |
| path: build/Butterscotch.vpk | |
| build-android: | |
| name: Build (Android) | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 25 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '25' | |
| distribution: 'temurin' | |
| cache: 'gradle' | |
| cache-dependency-path: src/android/frontend/gradle/wrapper/gradle-wrapper.properties | |
| - name: Install ccache | |
| run: sudo apt-get update && sudo apt-get install -y ccache | |
| - uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/ccache | |
| key: ccache-android-${{ github.sha }} | |
| restore-keys: | | |
| ccache-android- | |
| - name: Build APK | |
| run: | | |
| cd src/android/frontend | |
| ./gradlew assembleDebug \ | |
| -Pandroid.cxx.ndk.ccache=true \ | |
| -Porg.gradle.caching=true | |
| - name: Upload APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: butterscotch-android | |
| path: src/android/frontend/app/build/outputs/apk/debug/app-debug.apk | |
| build-old-gcc: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: GCC 3.0 | |
| compiler: gcc-3.0 | |
| flags: '-std=gnu99 -w' | |
| - name: GCC 2.95 | |
| compiler: g++-2.95 | |
| flags: '-w' | |
| name: Build (${{ matrix.name }}) | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Create Debian Woody chroot | |
| run: | | |
| sudo apt-get install --no-install-recommends -y debootstrap | |
| sudo debootstrap --arch=i386 --include='${{ matrix.compiler }},make,libsdl1.2-dev' woody ~/woody http://archive.debian.org/debian | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| path: butterscotch | |
| - name: Build | |
| run: | | |
| sudo mv butterscotch ~/woody | |
| sudo chroot ~/woody /bin/sh --login -c 'make -C /butterscotch NO_COLOR=1 VERBOSE=1 CC="${{ matrix.compiler }} ${{ matrix.flags }}" DESKTOP_BACKEND=sdl1 AUDIO_BACKEND=none SDL1_LIBS='-lSDL' DISABLE_MMD=1' | |
| build-cxx: | |
| name: Build as C++ | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: sudo apt-get update && sudo apt-get install -y ccache libglfw3-dev | |
| - uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/ccache | |
| key: ccache-cxx-${{ github.sha }} | |
| restore-keys: | | |
| ccache-cxx- | |
| - name: Build | |
| run: make CC='ccache g++ -std=gnu++98 -Wall -Wvla -Werror' NO_COLOR=1 VERBOSE=1 |