Skip to content

Commit bb80cae

Browse files
authored
Merge pull request #27 from ps2dev/appleSilliconSupport
Updating scripts for Adding Apple Sillicon Support
2 parents 0bd7b2c + c997e1c commit bb80cae

3 files changed

Lines changed: 34 additions & 28 deletions

File tree

.github/workflows/compilation.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,16 @@ jobs:
1212
runs-on: ${{ matrix.os[0] }}
1313
strategy:
1414
matrix:
15-
os: [[macos-latest, bash], [ubuntu-latest, bash], [windows-latest, msys2]]
15+
os: [
16+
[macos-latest, arm64, bash],
17+
[macos-13, x86_64, bash],
18+
[ubuntu-latest, x86_64, bash],
19+
[windows-latest, x86_64, msys2]
20+
]
1621
fail-fast: false
1722
defaults:
1823
run:
19-
shell: ${{ matrix.os[1] }} {0}
24+
shell: ${{ matrix.os[2] }} {0}
2025

2126
steps:
2227
- uses: actions/checkout@v4
@@ -28,7 +33,7 @@ jobs:
2833
sudo apt-get -y install texinfo bison flex gettext libgmp3-dev libmpfr-dev libmpc-dev
2934
3035
- name: Install macOS packages
31-
if: matrix.os[0] == 'macos-latest'
36+
if: startsWith(matrix.os[0], 'macos')
3237
run: |
3338
brew update
3439
brew install texinfo bison flex gnu-sed gsl gmp mpfr libmpc
@@ -46,8 +51,7 @@ jobs:
4651
- name: Runs all the stages in the shell
4752
run: |
4853
export PS2DEV=$PWD/ps2dev
49-
export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
50-
export PATH="/usr/local/opt/bison/bin:$PATH"
54+
export PATH="$(brew --prefix gnu-sed)/libexec/gnubin:$PATH" # This is just needed for MacOS
5155
export PATH=$PATH:$PS2DEV/iop/bin
5256
./toolchain.sh
5357

scripts/001-binutils.sh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,17 @@ TARGET_ALIAS="iop"
3636
TARG_XTRA_OPTS=""
3737
OSVER=$(uname)
3838

39-
if [ "${OSVER:0:10}" == MINGW64_NT ]; then
40-
export lt_cv_sys_max_cmd_len=8000
41-
export CC=x86_64-w64-mingw32-gcc
42-
TARG_XTRA_OPTS="--host=x86_64-w64-mingw32"
43-
elif [ "${OSVER:0:10}" == MINGW32_NT ]; then
44-
export lt_cv_sys_max_cmd_len=8000
45-
export CC=i686-w64-mingw32-gcc
46-
TARG_XTRA_OPTS="--host=i686-w64-mingw32"
39+
## If using MacOS Apple, set gmp and mpfr paths using TARG_XTRA_OPTS
40+
## (this is needed for Apple Silicon but we will do it for all MacOS systems)
41+
if [ "$(uname -s)" = "Darwin" ]; then
42+
## Check if using brew
43+
if command -v brew &> /dev/null; then
44+
TARG_XTRA_OPTS="--with-gmp=$(brew --prefix gmp) --with-mpfr=$(brew --prefix mpfr)"
45+
fi
46+
## Check if using MacPorts
47+
if command -v port &> /dev/null; then
48+
TARG_XTRA_OPTS="--with-gmp=$(port -q prefix gmp) --with-mpfr=$(port -q prefix mpfr)"
49+
fi
4750
fi
4851

4952
## Determine the maximum number of processes that Make can work with.

scripts/002-gcc-stage1.sh

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ TARG_XTRA_OPTS=""
3737
TARGET_CFLAGS="-O2 -gdwarf-2 -gz"
3838
OSVER=$(uname)
3939

40-
# Workaround to build with newer mingw-w64 https://github.com/msys2/MINGW-packages/commit/4360ed1a7470728be1dba0687df764604f1992d9
41-
if [ "${OSVER:0:10}" == MINGW64_NT ]; then
42-
export lt_cv_sys_max_cmd_len=8000
43-
export CC=x86_64-w64-mingw32-gcc
44-
TARG_XTRA_OPTS="--host=x86_64-w64-mingw32"
45-
export CPPFLAGS="-DWIN32_LEAN_AND_MEAN -DCOM_NO_WINDOWS_H"
46-
elif [ "${OSVER:0:10}" == MINGW32_NT ]; then
47-
export lt_cv_sys_max_cmd_len=8000
48-
export CC=i686-w64-mingw32-gcc
49-
TARG_XTRA_OPTS="--host=i686-w64-mingw32"
50-
export CPPFLAGS="-DWIN32_LEAN_AND_MEAN -DCOM_NO_WINDOWS_H"
40+
## If using MacOS Apple, set gmp, mpfr and mpc paths using TARG_XTRA_OPTS
41+
## (this is needed for Apple Silicon but we will do it for all MacOS systems)
42+
if [ "$(uname -s)" = "Darwin" ]; then
43+
## Check if using brew
44+
if command -v brew &> /dev/null; then
45+
TARG_XTRA_OPTS="--with-gmp=$(brew --prefix gmp) --with-mpfr=$(brew --prefix mpfr) --with-mpc=$(brew --prefix libmpc)"
46+
fi
47+
## Check if using MacPorts
48+
if command -v port &> /dev/null; then
49+
TARG_XTRA_OPTS="--with-gmp=$(port -q prefix gmp) --with-mpfr=$(port -q prefix mpfr) --with-mpc=$(port -q prefix libmpc)"
50+
fi
5151
fi
5252

5353
## Determine the maximum number of processes that Make can work with.
@@ -90,13 +90,12 @@ for TARGET in "mipsel-ps2-irx" "mipsel-none-elf"; do
9090
--disable-nls \
9191
--disable-tls \
9292
--disable-libstdcxx \
93-
MAKEINFO=missing \
9493
$TARG_XTRA_OPTS
9594

9695
## Compile and install.
97-
make --quiet -j "$PROC_NR" MAKEINFO=missing all
98-
make --quiet -j "$PROC_NR" MAKEINFO=missing install-strip
99-
make --quiet -j "$PROC_NR" MAKEINFO=missing clean
96+
make --quiet -j "$PROC_NR" all
97+
make --quiet -j "$PROC_NR" install-strip
98+
make --quiet -j "$PROC_NR" clean
10099

101100
## Exit the build directory.
102101
cd ..

0 commit comments

Comments
 (0)