From f410a5cf551c5676345b10efd9bc408563dd1269 Mon Sep 17 00:00:00 2001 From: Francisco Javier Trujillo Mata Date: Fri, 19 Sep 2025 23:52:49 +0200 Subject: [PATCH 1/2] Fixing MacPort support --- scripts/001-binutils.sh | 2 +- scripts/002-gcc-stage1.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/001-binutils.sh b/scripts/001-binutils.sh index d0d0003..b5343ef 100755 --- a/scripts/001-binutils.sh +++ b/scripts/001-binutils.sh @@ -47,7 +47,7 @@ if [ "$(uname -s)" = "Darwin" ]; then ## Check if using MacPorts MACPORT_BASE=$(dirname `port -q contents gmp|grep gmp.h`|sed s#/include##g) echo Macport base is $MACPORT_BASE - TARG_XTRA_OPTS="--with-system-zlib --with-gmp=$MACPORT_BASE --with-mpfr=$MACPORT_BASE" + TARG_XTRA_OPTS="--with-system-zlib --with-libiconv_prefix=$MACPORT_BASE --with-gmp=$MACPORT_BASE --with-mpfr=$MACPORT_BASE --with-mpc=$MACPORT_BASE" fi fi diff --git a/scripts/002-gcc-stage1.sh b/scripts/002-gcc-stage1.sh index 03cd006..5761c34 100755 --- a/scripts/002-gcc-stage1.sh +++ b/scripts/002-gcc-stage1.sh @@ -48,7 +48,7 @@ if [ "$(uname -s)" = "Darwin" ]; then ## Check if using MacPorts MACPORT_BASE=$(dirname `port -q contents gmp|grep gmp.h`|sed s#/include##g) echo Macport base is $MACPORT_BASE - TARG_XTRA_OPTS="--with-system-zlib --with-gmp=$MACPORT_BASE --with-mpfr=$MACPORT_BASE --with-mpc=$MACPORT_BASE" + TARG_XTRA_OPTS="--with-system-zlib --with-libiconv_prefix=$MACPORT_BASE --with-gmp=$MACPORT_BASE --with-mpfr=$MACPORT_BASE --with-mpc=$MACPORT_BASE" fi fi From d1810703c05b479affe09613e56aac3effcd6443 Mon Sep 17 00:00:00 2001 From: Francisco Javier Trujillo Mata Date: Fri, 19 Sep 2025 23:33:39 +0200 Subject: [PATCH 2/2] Updating CI/CD - Improving matrix workflow - Adding MacOS with MacPorts - Adding Ubuntu ARM - Uploading to artifacts --- .github/workflows/compilation.yml | 75 ++++++++++++++++++++++--------- README.md | 40 +++++++++++++++-- 2 files changed, 89 insertions(+), 26 deletions(-) diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml index c3457fd..9631f5a 100644 --- a/.github/workflows/compilation.yml +++ b/.github/workflows/compilation.yml @@ -9,44 +9,74 @@ on: jobs: build: - runs-on: ${{ matrix.os[0] }} + runs-on: ${{ matrix.target.machine }} strategy: matrix: - os: [ - [macos-latest, arm64, bash], - [macos-13, x86_64, bash], - [ubuntu-latest, x86_64, bash], - [windows-latest, x86_64, msys2] - ] + target: + - machine: macos-latest + architecture: arm64 + shell: bash + packageManager: brew + - machine: macos-13 + architecture: x86_64 + shell: bash + packageManager: brew + - machine: macos-latest + architecture: arm64 + shell: bash + packageManager: macport + - machine: ubuntu-latest + architecture: x86_64 + shell: bash + packageManager: default + - machine: ubuntu-22.04-arm + architecture: arm64 + shell: bash + packageManager: default + - machine: ubuntu-24.04-arm + architecture: arm64 + shell: bash + packageManager: default + - machine: windows-latest + architecture: x86_64 + shell: msys2 + packageManager: default fail-fast: false defaults: run: - shell: ${{ matrix.os[2] }} {0} + shell: ${{ matrix.target.shell }} {0} steps: - uses: actions/checkout@v4 - name: Install Ubuntu packages - if: matrix.os[0] == 'ubuntu-latest' + if: startsWith(matrix.target.machine, 'ubuntu') run: | sudo apt-get update sudo apt-get -y install texinfo bison flex gettext libgmp3-dev libmpfr-dev libmpc-dev - - name: Install macOS packages - if: startsWith(matrix.os[0], 'macos') + - name: Install macOS packages with brew + if: startsWith(matrix.target.machine, 'macos') && matrix.target.packageManager == 'brew' run: | brew update brew install texinfo bison flex gnu-sed gsl gmp mpfr libmpc + - name: Install macOS packages with macport + if: startsWith(matrix.target.machine, 'macos') && matrix.target.packageManager == 'macport' + run: | + curl -LO https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci + source ./macports-ci install --remove-brew --version=2.11.5 --sync=rsync + sudo port install gmp mpfr libmpc libiconv bison flex texinfo + - name: Install MSYS2 packages - if: matrix.os[0] == 'windows-latest' + if: startsWith(matrix.target.machine, 'windows') uses: msys2/setup-msys2@v2 with: msystem: MINGW32 install: | base-devel git make texinfo flex bison patch binutils mpc-devel tar - mingw-w64-i686-readline mingw-w64-i686-gcc mingw-w64-i686-cmake - mingw-w64-i686-make mingw-w64-i686-libogg + mingw-w64-i686-readline mingw-w64-i686-gcc + mingw-w64-i686-cmake mingw-w64-i686-make mingw-w64-i686-libogg update: true - name: Runs all the stages in the shell @@ -63,16 +93,17 @@ jobs: mipsel-none-elf-as --version mipsel-none-elf-ld --version mipsel-none-elf-gcc --version - + - name: Get short SHA id: slug - run: printf '%s\n' "sha8=$(printf '%s\n' ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT - - - name: Compress ps2dev folder run: | - tar -zcvf ps2dev.tar.gz ps2dev - + echo "sha8=${MSYSTEM}-sha[$(echo ${GITHUB_SHA} | cut -c1-8)]" >> $GITHUB_OUTPUT + + - name: Prepare ps2dev folder + run: | + tar -zcvf ps2dev-${{matrix.target.machine}}.tar.gz ps2dev + - uses: actions/upload-artifact@v4 with: - name: ps2dev-${{ steps.slug.outputs.sha8 }}-${{ matrix.os[0] }} - path: ps2dev.tar.gz \ No newline at end of file + name: ps2dev-${{matrix.target.machine}}-ps2dev-${{matrix.target.architecture}}-${{matrix.target.packageManager}}-${{ steps.slug.outputs.sha8 }} + path: ps2dev-${{matrix.target.machine}}.tar.gz \ No newline at end of file diff --git a/README.md b/README.md index 688bbe3..a83375c 100644 --- a/README.md +++ b/README.md @@ -11,15 +11,48 @@ the ps2dev main page. ## Introduction -This program will automatically build and install a IOP compiler, which is used in the creation of homebrew software for the Sony PlayStation® 2 videogame system. +This program will automatically build and install an IOP compiler, which is used in the creation of homebrew software for the Sony PlayStation® 2 videogame system. + +### Supported platforms + +- macOS (Intel and Apple Silicon) with Homebrew or MacPorts +- Ubuntu (x86_64 and arm64) +- Windows (MSYS2, MinGW32 environment) ## What these scripts do -These scripts download (with `git clone`) and install [binutils 2.35.2](http://www.gnu.org/software/binutils/ "binutils") (iop), [gcc 11.1.0](https://gcc.gnu.org/ "gcc") (iop). +These scripts download (with `git clone`) and install [binutils 2.45](http://www.gnu.org/software/binutils/ "binutils") (iop), [gcc 15.2.0](https://gcc.gnu.org/ "gcc") (iop). ## Requirements -1. Install gcc/clang, make, patch, git, texinfo, bison, flex, libgmp3, libmpfr, and libmpc if you don't have those packages. +1. Install gcc/clang, make, patch, git, and texinfo if you don't have those packages. Below are example commands per platform: + + ### macOS (Homebrew) + ```bash + brew update + brew install texinfo bison flex gnu-sed gsl gmp mpfr libmpc + ``` + + ### macOS (MacPorts) + Make sure MacPorts is installed first. Then: + ```bash + sudo port selfupdate + sudo port install gmp mpfr libmpc libiconv bison flex texinfo + ``` + + ### Ubuntu + ```bash + sudo apt-get update + sudo apt-get -y install texinfo bison flex gettext libgmp3-dev libmpfr-dev libmpc-dev + ``` + + ### Windows (MSYS2 MinGW32) + Use the MSYS2 MinGW32 shell and run: + ```bash + pacman -S --noconfirm base-devel git make texinfo flex bison patch binutils mpc-devel tar \ + mingw-w64-i686-readline mingw-w64-i686-gcc mingw-w64-i686-cmake mingw-w64-i686-make mingw-w64-i686-libogg + ``` + 2. Ensure that you have enough permissions for managing PS2DEV location (which defaults to `/usr/local/ps2dev`). PS2DEV location MUST NOT have spaces or special characters in its path! For example, on Linux systems, you can set access for the current user by running commands: ```bash export PS2DEV=/usr/local/ps2dev @@ -29,7 +62,6 @@ sudo chown -R $USER: $PS2DEV 3. Add this to your login script (example: `~/.bash_profile`) ```bash export PS2DEV=/usr/local/ps2dev -export PS2SDK=$PS2DEV/ps2sdk export PATH=$PATH:$PS2DEV/iop/bin ``` 4. Run toolchain.sh