Skip to content

Commit

Permalink
Merge pull request #34 from pspdev/appleSilliconSupport
Browse files Browse the repository at this point in the history
Add Apple Sillicon Support
  • Loading branch information
wally4000 authored May 2, 2024
2 parents eb5d645 + ad1e993 commit 029e008
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 11 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion config/psptoolchain-allegrex-config.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
7 changes: 4 additions & 3 deletions prepare-mac-os.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions scripts/001-binutils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
13 changes: 13 additions & 0 deletions scripts/002-gcc-stage1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down
13 changes: 13 additions & 0 deletions scripts/005-gcc-stage2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down

0 comments on commit 029e008

Please sign in to comment.