diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 30dc55f3..61d7041c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-15-intel, ubuntu-latest] + os: [macos-15-intel, ubuntu-latest, macos-26] steps: - uses: actions/checkout@v6 @@ -23,7 +23,7 @@ jobs: sudo apt-get update sudo apt-get -y install autoconf automake bison flex gcc libelf-dev make texinfo libncurses5-dev patch python3 python-is-python3 subversion wget zlib1g-dev libtool-bin python3-dev bzip2 libgmp3-dev pkg-config - - name: Install macOS requirements + - name: Install macOS intel requirements if: matrix.os == 'macos-15-intel' shell: arch -x86_64 bash -e {0} env: @@ -33,6 +33,16 @@ jobs: run: | brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config texinfo + - name: Install macOS arm64 requirements + if: matrix.os == 'macos-26' + shell: bash -e {0} + env: + HOMEBREW_NO_AUTO_UPDATE: 1 + HOMEBREW_NO_INSTALL_CLEANUP: 1 + HOMEBREW_NO_ENV_HINTS: 1 + run: | + brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config texinfo + - name: Runs all the stages in the shell if: matrix.os == 'ubuntu-latest' shell: bash -e {0} @@ -61,6 +71,20 @@ jobs: export PATH=$PATH:$PS3DEV/spu/bin ./toolchain.sh + - name: Runs all the stages in the shell + if: matrix.os == 'macos-26' + shell: bash -e {0} + env: + BUILD_PS3TOOLCHAIN_ONLY: 1 + run: | + mkdir $PWD/ps3dev + export PS3DEV=$PWD/ps3dev + export PSL1GHT=$PS3DEV + export PATH=$PATH:$PS3DEV/bin + export PATH=$PATH:$PS3DEV/ppu/bin + export PATH=$PATH:$PS3DEV/spu/bin + ./toolchain.sh + - name: Get short SHA id: slug run: echo "sha8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> "$GITHUB_OUTPUT" diff --git a/patches/gcc-7.2.0-PS3-macos-arm64.patch b/patches/gcc-7.2.0-PS3-macos-arm64.patch new file mode 100644 index 00000000..05a297f0 --- /dev/null +++ b/patches/gcc-7.2.0-PS3-macos-arm64.patch @@ -0,0 +1,30 @@ +diff -Nru gcc-7.2.0/gcc/config/aarch64/aarch64.h gcc-7.2.0-mac/gcc/config/aarch64/aarch64.h +--- gcc-7.2.0/gcc/config/aarch64/aarch64.h 2017-01-19 20:51:49 ++++ gcc-7.2.0-mac/gcc/config/aarch64/aarch64.h 2026-06-09 16:10:14 +@@ -930,7 +930,7 @@ + #define MCPU_TO_MARCH_SPEC_FUNCTIONS \ + { "rewrite_mcpu", aarch64_rewrite_mcpu }, + +-#if defined(__aarch64__) ++#if defined(__aarch64__) && ! defined(__APPLE__) + extern const char *host_detect_local_cpu (int argc, const char **argv); + # define EXTRA_SPEC_FUNCTIONS \ + { "local_cpu_detect", host_detect_local_cpu }, \ +diff -Nru gcc-7.2.0/gcc/config/host-darwin.c gcc-7.2.0-mac/gcc/config/host-darwin.c +--- gcc-7.2.0/gcc/config/host-darwin.c 2017-01-01 09:07:43 ++++ gcc-7.2.0-mac/gcc/config/host-darwin.c 2026-06-09 16:09:16 +@@ -22,6 +22,8 @@ + #include "coretypes.h" + #include "diagnostic-core.h" + #include "config/host-darwin.h" ++#include "hosthooks.h" ++#include "hosthooks-def.h" + + /* Yes, this is really supposed to work. */ + static char pch_address_space[1024*1024*1024] __attribute__((aligned (4096))); +@@ -75,3 +77,5 @@ + + return ret; + } ++ ++const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER; diff --git a/scripts/002-gcc-newlib-PPU.sh b/scripts/002-gcc-newlib-PPU.sh index 705e0731..4d173ba4 100755 --- a/scripts/002-gcc-newlib-PPU.sh +++ b/scripts/002-gcc-newlib-PPU.sh @@ -18,6 +18,11 @@ if [ ! -d ${GCC} ]; then cat ../patches/${GCC}-PS3.patch | patch -p1 -d ${GCC} cat ../patches/${NEWLIB}-PS3.patch | patch -p1 -d ${NEWLIB} + ## Patch for macOS arm64 + if [[ $(uname -s) == 'Darwin' && $(uname -m) == 'arm64' ]]; then + cat ../patches/${GCC}-PS3-macos-arm64.patch | patch -p1 -d ${GCC} + fi + ## Enter the source code directory. cd ${GCC} diff --git a/scripts/008-psl1ght.sh b/scripts/008-psl1ght.sh index 56cb1167..feea6760 100755 --- a/scripts/008-psl1ght.sh +++ b/scripts/008-psl1ght.sh @@ -1,15 +1,15 @@ #!/bin/sh -e # psl1ght.sh by Naomi Peori (naomi@peori.ca) -## Download the source code. -wget --no-check-certificate https://github.com/ps3dev/PSL1GHT/tarball/master -O psl1ght.tar.gz - ## Check if we want to skip this step -if [[ -n "$BUILD_PS3TOOLCHAIN_ONLY" ]]; then +if [ -n "$BUILD_PS3TOOLCHAIN_ONLY" ]; then echo "PS3 Toolchain only set. Skipping..." exit 0 fi +## Download the source code. +wget --no-check-certificate https://github.com/ps3dev/PSL1GHT/tarball/master -O psl1ght.tar.gz + ## Unpack the source code. rm -Rf psl1ght && mkdir psl1ght && tar --strip-components=1 --directory=psl1ght -xvzf psl1ght.tar.gz diff --git a/scripts/009-ps3libraries.sh b/scripts/009-ps3libraries.sh index c0f713a6..4ccd9bcb 100755 --- a/scripts/009-ps3libraries.sh +++ b/scripts/009-ps3libraries.sh @@ -1,15 +1,15 @@ #!/bin/sh -e # ps3libraries.sh by Naomi Peori (naomi@peori.ca) -## Download the source code. -wget --no-check-certificate https://github.com/ps3dev/ps3libraries/tarball/master -O ps3libraries.tar.gz - ## Check if we want to skip this step -if [[ -n "$BUILD_PS3TOOLCHAIN_ONLY" ]]; then +if [ -n "$BUILD_PS3TOOLCHAIN_ONLY" ]; then echo "PS3 Toolchain only set. Skipping..." exit 0 fi +## Download the source code. +wget --no-check-certificate https://github.com/ps3dev/ps3libraries/tarball/master -O ps3libraries.tar.gz + ## Unpack the source code. rm -Rf ps3libraries && mkdir ps3libraries && tar --strip-components=1 --directory=ps3libraries -xvzf ps3libraries.tar.gz && cd ps3libraries