diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml index 63701df..26eac95 100644 --- a/.github/workflows/compilation.yml +++ b/.github/workflows/compilation.yml @@ -12,11 +12,16 @@ jobs: runs-on: ${{ matrix.os[0] }} strategy: matrix: - os: [[macos-latest, bash], [ubuntu-latest, bash], [windows-latest, msys2]] + os: [ + [macos-latest, arm64, bash], + [macos-13, x86_64, bash], + [ubuntu-latest, x86_64, bash], + [windows-latest, x86_64, msys2] + ] fail-fast: false defaults: run: - shell: ${{ matrix.os[1] }} {0} + shell: ${{ matrix.os[2] }} {0} steps: - uses: actions/checkout@v4 @@ -27,12 +32,12 @@ jobs: sudo apt-get update sudo apt-get -y install texinfo bison flex gettext libgmp3-dev libmpfr-dev libmpc-dev - - name: Install on Mac - if: matrix.os[0] == 'macos-latest' + - name: Install on Mac(s) + if: startsWith(matrix.os[0], 'macos') run: | brew update - brew install texinfo bison flex gnu-sed gsl gmp mpfr libmpc + - name: Install in MSYS2 if: matrix.os[0] == 'windows-latest' uses: msys2/setup-msys2@v2 @@ -45,7 +50,7 @@ jobs: - name: Runs all stages run: | - export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH" + export PATH="$(brew --prefix gnu-sed)/libexec/gnubin:$PATH" export PSPDEV=$PWD/pspdev export PATH=$PATH:$PSPDEV/bin ./toolchain.sh @@ -101,5 +106,5 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: pspdev-${{ steps.slug.outputs.sha8 }}-${{ matrix.os[0] }} + name: pspdev-${{ steps.slug.outputs.sha8 }}-${{ matrix.os[0] }}-${{ matrix.os[1] }} path: pspdev.tar.gz diff --git a/config/psptoolchain-allegrex-config.sh b/config/psptoolchain-allegrex-config.sh index e71842a..e37a059 100644 --- a/config/psptoolchain-allegrex-config.sh +++ b/config/psptoolchain-allegrex-config.sh @@ -1,7 +1,7 @@ #!/bin/bash PSPTOOLCHAIN_ALLEGREX_BINUTILS_REPO_URL="https://github.com/pspdev/binutils-gdb.git" -PSPTOOLCHAIN_ALLEGREX_BINUTILS_DEFAULT_REPO_REF="allegrex-v2.37.0" +PSPTOOLCHAIN_ALLEGREX_BINUTILS_DEFAULT_REPO_REF="allegrex-v2.40.0" PSPTOOLCHAIN_ALLEGREX_GCC_REPO_URL="https://github.com/pspdev/gcc.git" PSPTOOLCHAIN_ALLEGREX_GCC_DEFAULT_REPO_REF="allegrex-v13.2.0" PSPTOOLCHAIN_ALLEGREX_NEWLIB_REPO_URL="https://github.com/pspdev/newlib.git" diff --git a/prepare-mac-os.sh b/prepare-mac-os.sh index 5ff4ac6..866daa6 100755 --- a/prepare-mac-os.sh +++ b/prepare-mac-os.sh @@ -25,17 +25,18 @@ if [ $# -eq 1 ]; then esac fi -if ! [ -e "/usr/local/bin/brew" -o -e "/opt/local/bin/port" ]; then +# Check if either Homebrew (brew) or MacPorts (port) are installed +if ! command -v brew &> /dev/null && ! command -v port &> /dev/null; then echo "Go install Homebrew from http://brew.sh/ or MacPorts from http://www.macports.org/ first, then we can talk!" exit 1 fi # sanity checks -if [ $try_brew -eq 1 -a ! -e "/usr/local/bin/brew" ]; then +if [ $try_brew -eq 1 -a ! command -v brew &> /dev/null ]; then echo "Not trying Homebrew, because it is not installed." try_brew=0 fi -if [ $try_port -eq 1 -a ! -e "/opt/local/bin/port" ]; then +if [ $try_port -eq 1 -a ! -e command -v port &> /dev/null ]; then echo "Not trying MacPorts, because it is not installed." try_port=0 fi diff --git a/scripts/001-binutils.sh b/scripts/001-binutils.sh index af20a3d..ace1f73 100755 --- a/scripts/001-binutils.sh +++ b/scripts/001-binutils.sh @@ -35,6 +35,19 @@ cd "$REPO_FOLDER" TARGET="psp" TARG_XTRA_OPTS="" +## If using MacOS Apple, set gmp and mpfr paths using TARG_XTRA_OPTS +## (this is needed for Apple Silicon but we will do it for all MacOS systems) +if [ "$(uname -s)" = "Darwin" ]; then + ## Check if using brew + if command -v brew &> /dev/null; then + TARG_XTRA_OPTS="--with-gmp=$(brew --prefix gmp) --with-mpfr=$(brew --prefix mpfr)" + fi + ## Check if using MacPorts + if command -v port &> /dev/null; then + TARG_XTRA_OPTS="--with-gmp=$(port -q prefix gmp) --with-mpfr=$(port -q prefix mpfr)" + fi +fi + ## Determine the maximum number of processes that Make can work with. PROC_NR=$(getconf _NPROCESSORS_ONLN) diff --git a/scripts/002-gcc-stage1.sh b/scripts/002-gcc-stage1.sh index b856784..012c651 100755 --- a/scripts/002-gcc-stage1.sh +++ b/scripts/002-gcc-stage1.sh @@ -37,6 +37,19 @@ TARGET="psp" ## Determine the maximum number of processes that Make can work with. PROC_NR=$(getconf _NPROCESSORS_ONLN) +## If using MacOS Apple, set gmp, mpfr and mpc paths using TARG_XTRA_OPTS +## (this is needed for Apple Silicon but we will do it for all MacOS systems) +if [ "$(uname -s)" = "Darwin" ]; then + ## Check if using brew + if command -v brew &> /dev/null; then + TARG_XTRA_OPTS="--with-gmp=$(brew --prefix gmp) --with-mpfr=$(brew --prefix mpfr) --with-mpc=$(brew --prefix libmpc)" + fi + ## Check if using MacPorts + if command -v port &> /dev/null; then + TARG_XTRA_OPTS="--with-gmp=$(port -q prefix gmp) --with-mpfr=$(port -q prefix mpfr) --with-mpc=$(port -q prefix libmpc)" + fi +fi + ## Create and enter the toolchain/build directory rm -rf mkdir build-$TARGET-stage1 && mkdir build-$TARGET-stage1 && cd build-$TARGET-stage1 || { exit 1; } diff --git a/scripts/005-gcc-stage2.sh b/scripts/005-gcc-stage2.sh index ff19e59..b3ebd1b 100755 --- a/scripts/005-gcc-stage2.sh +++ b/scripts/005-gcc-stage2.sh @@ -37,6 +37,19 @@ TARGET="psp" ## Determine the maximum number of processes that Make can work with. PROC_NR=$(getconf _NPROCESSORS_ONLN) +## If using MacOS Apple, set gmp, mpfr and mpc paths using TARG_XTRA_OPTS +## (this is needed for Apple Silicon but we will do it for all MacOS systems) +if [ "$(uname -s)" = "Darwin" ]; then + ## Check if using brew + if command -v brew &> /dev/null; then + TARG_XTRA_OPTS="--with-gmp=$(brew --prefix gmp) --with-mpfr=$(brew --prefix mpfr) --with-mpc=$(brew --prefix libmpc)" + fi + ## Check if using MacPorts + if command -v port &> /dev/null; then + TARG_XTRA_OPTS="--with-gmp=$(port -q prefix gmp) --with-mpfr=$(port -q prefix mpfr) --with-mpc=$(port -q prefix libmpc)" + fi +fi + ## Create and enter the toolchain/build directory rm -rf build-$TARGET-stage2 && mkdir build-$TARGET-stage2 && cd build-$TARGET-stage2 || { exit 1; }