Skip to content

Commit

Permalink
Updating scripts for Adding Apple Sillicon Support
Browse files Browse the repository at this point in the history
  • Loading branch information
fjtrujy committed May 3, 2024
1 parent 0bd7b2c commit c997e1c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 28 deletions.
14 changes: 9 additions & 5 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 @@ -28,7 +33,7 @@ jobs:
sudo apt-get -y install texinfo bison flex gettext libgmp3-dev libmpfr-dev libmpc-dev
- name: Install macOS packages
if: matrix.os[0] == 'macos-latest'
if: startsWith(matrix.os[0], 'macos')
run: |
brew update
brew install texinfo bison flex gnu-sed gsl gmp mpfr libmpc
Expand All @@ -46,8 +51,7 @@ jobs:
- name: Runs all the stages in the shell
run: |
export PS2DEV=$PWD/ps2dev
export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
export PATH="/usr/local/opt/bison/bin:$PATH"
export PATH="$(brew --prefix gnu-sed)/libexec/gnubin:$PATH" # This is just needed for MacOS
export PATH=$PATH:$PS2DEV/iop/bin
./toolchain.sh
Expand Down
19 changes: 11 additions & 8 deletions scripts/001-binutils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,17 @@ TARGET_ALIAS="iop"
TARG_XTRA_OPTS=""
OSVER=$(uname)

if [ "${OSVER:0:10}" == MINGW64_NT ]; then
export lt_cv_sys_max_cmd_len=8000
export CC=x86_64-w64-mingw32-gcc
TARG_XTRA_OPTS="--host=x86_64-w64-mingw32"
elif [ "${OSVER:0:10}" == MINGW32_NT ]; then
export lt_cv_sys_max_cmd_len=8000
export CC=i686-w64-mingw32-gcc
TARG_XTRA_OPTS="--host=i686-w64-mingw32"
## 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.
Expand Down
29 changes: 14 additions & 15 deletions scripts/002-gcc-stage1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ TARG_XTRA_OPTS=""
TARGET_CFLAGS="-O2 -gdwarf-2 -gz"
OSVER=$(uname)

# Workaround to build with newer mingw-w64 https://github.com/msys2/MINGW-packages/commit/4360ed1a7470728be1dba0687df764604f1992d9
if [ "${OSVER:0:10}" == MINGW64_NT ]; then
export lt_cv_sys_max_cmd_len=8000
export CC=x86_64-w64-mingw32-gcc
TARG_XTRA_OPTS="--host=x86_64-w64-mingw32"
export CPPFLAGS="-DWIN32_LEAN_AND_MEAN -DCOM_NO_WINDOWS_H"
elif [ "${OSVER:0:10}" == MINGW32_NT ]; then
export lt_cv_sys_max_cmd_len=8000
export CC=i686-w64-mingw32-gcc
TARG_XTRA_OPTS="--host=i686-w64-mingw32"
export CPPFLAGS="-DWIN32_LEAN_AND_MEAN -DCOM_NO_WINDOWS_H"
## 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

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

## Compile and install.
make --quiet -j "$PROC_NR" MAKEINFO=missing all
make --quiet -j "$PROC_NR" MAKEINFO=missing install-strip
make --quiet -j "$PROC_NR" MAKEINFO=missing clean
make --quiet -j "$PROC_NR" all
make --quiet -j "$PROC_NR" install-strip
make --quiet -j "$PROC_NR" clean

## Exit the build directory.
cd ..
Expand Down

0 comments on commit c997e1c

Please sign in to comment.