diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml index 5a4c816..0a7f724 100644 --- a/.github/workflows/compilation.yml +++ b/.github/workflows/compilation.yml @@ -12,22 +12,26 @@ jobs: container: ${{ matrix.os[0] }}:${{ matrix.os[1] }} strategy: matrix: - os: [[alpine, latest], [fedora, latest]] + os: [ + [alpine, latest], + [fedora, latest], + ] + fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies Alpine if: matrix.os[0] == 'alpine' run: | - apk add build-base bash gcc git make autoconf automake python3 py3-pip cmake pkgconfig libarchive-dev openssl-dev gpgme-dev libtool \ - flex bison texinfo gmp-dev mpfr-dev mpc1-dev readline-dev ncurses-dev + apk add --no-cache build-base bash gcc git make autoconf automake python3 py3-pip cmake pkgconfig libarchive-dev openssl-dev gpgme-dev \ + libtool flex bison texinfo gmp-dev mpfr-dev mpc1-dev readline-dev ncurses-dev - name: Install dependencies Fedora if: matrix.os[0] == 'fedora' run: | dnf -y install @development-tools gcc gcc-c++ g++ wget git autoconf automake python3 python3-pip make cmake pkgconf \ libarchive-devel openssl-devel gpgme-devel libtool gettext texinfo bison flex gmp-devel mpfr-devel libmpc-devel ncurses-devel \ - diffutils glibc-gconv-extra + diffutils glibc-gconv-extra xz - name: Compile Tools run: | @@ -43,7 +47,7 @@ jobs: run: | tar -zcvf pspdev.tar.gz pspdev - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: pspdev-${{ steps.slug.outputs.sha8 }}-${{ matrix.os[0] }} path: pspdev.tar.gz @@ -53,32 +57,28 @@ jobs: runs-on: ${{ matrix.os[0] }} strategy: matrix: - os: [[macos-latest, bash], [ubuntu-latest, bash]] + os: [ + [macos-latest, arm64, bash], + [macos-13, x86_64, bash], + [ubuntu-latest, x86_64, bash], + ] + fail-fast: false defaults: run: - shell: ${{ matrix.os[1] }} {0} + shell: ${{ matrix.os[2] }} {0} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - name: Install Dependencies Ubuntu - if: matrix.os[0] == 'ubuntu-latest' - run: | - sudo apt-get -y install libarchive-dev libcurl4 libcurl4-openssl-dev libssl-dev libarchive-dev libgpgme-dev \ - gettext texinfo bison flex libncurses5-dev libgmp3-dev libmpfr-dev libmpc-dev - echo "MSYSTEM=x64" >> $GITHUB_ENV - - - name: Install Dependencies Mac - if: startsWith( matrix.os[0], 'macos' ) - run: | - brew install automake libarchive bash openssl gpgme libtool gettext texinfo bison flex gnu-sed gsl gmp mpfr - echo "MSYSTEM=x64" >> $GITHUB_ENV + - name : Install dependencies on required OS + run: | + ./prepare.sh - name: Compile Tools run: | - export PATH="/usr/local/opt/libtool/libexec/gnubin:$PATH" - export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH" - export PKG_CONFIG_PATH="/usr/local/opt/libarchive/lib/pkgconfig:/usr/local/opt/openssl@3/lib/pkgconfig" + export PATH="$(brew --prefix gnu-sed)/libexec/gnubin:$PATH" # This really is only needed for macOS + export PATH="$(brew --prefix libtool)/libexec/gnubin:$PATH" # This really is only needed for macOS + export PKG_CONFIG_PATH="$(brew --prefix libarchive)/lib/pkgconfig:$(brew --prefix openssl)/lib/pkgconfig" #This really is only needed for macOS export PSPDEV=$PWD/pspdev export PATH=$PATH:$PSPDEV/bin ./toolchain.sh @@ -93,5 +93,5 @@ jobs: - uses: actions/upload-artifact@v3 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/.github/workflows/docker.yml b/.github/workflows/docker.yml index d8f43ff..4f920f9 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -14,47 +14,30 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Extract DOCKER_TAG using tag name if: startsWith(github.ref, 'refs/tags/') run: | echo "DOCKER_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV + - name: Use default DOCKER_TAG if: startsWith(github.ref, 'refs/tags/') != true run: | echo "DOCKER_TAG=latest" >> $GITHUB_ENV - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Login to Github registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} registry: ghcr.io - - uses: docker/build-push-action@v4 + - uses: docker/build-push-action@v5 with: push: true tags: ghcr.io/${{ github.repository }}:${{ env.DOCKER_TAG }} build-args: | BASE_DOCKER_ALLEGREX_IMAGE=ghcr.io/${{ github.repository_owner }}/psptoolchain-allegrex:${{ env.DOCKER_TAG }} BASE_DOCKER_EXTRA_IMAGE=ghcr.io/${{ github.repository_owner }}/psptoolchain-extra:${{ env.DOCKER_TAG }} - - - name: Send Compile action - run: | - export DISPATCH_ACTION="$(echo run_build)" - echo "NEW_DISPATCH_ACTION=$DISPATCH_ACTION" >> $GITHUB_ENV - - - name: Repository Dispatch - uses: peter-evans/repository-dispatch@v2 - with: - repository: ${{ github.repository_owner }}/pspsdk - token: ${{ secrets.DISPATCH_TOKEN }} - event-type: ${{ env.NEW_DISPATCH_ACTION }} diff --git a/prepare.sh b/prepare.sh new file mode 100755 index 0000000..d670204 --- /dev/null +++ b/prepare.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +echo "Detecting OS and installing packages required for PSP Toolchain" + +#Handle macOS first +if [ "$(uname -s)" = "Darwin" ]; then + ## Check if using brew + if command -v brew &> /dev/null; then + brew update + brew install gettext texinfo bison flex gnu-sed ncurses gsl gmp mpfr autoconf automake cmake libusb-compat libarchive gpgme bash openssl libtool + brew reinstall openssl # https://github.com/Homebrew/homebrew-core/issues/169728#issuecomment-2074958306 + fi + ## Check if using MacPorts + if command -v port &> /dev/null; then + sudo port install autoconf automake cmake doxygen gsed libelf libtool pkgconfig + fi +else + + TESTOS=$(cat /etc/os-release | grep -w "ID" | cut -d '=' -f2) + + case $TESTOS in + + ubuntu | debian) + sudo apt-get update + sudo apt-get -y install texinfo bison flex gettext libgmp3-dev libmpfr-dev libmpc-dev libusb-dev libreadline-dev libcurl4 libcurl4-openssl-dev libssl-dev libarchive-dev libgpgme-dev + ;; + rhel | fedora) + dnf -y install @development-tools gcc gcc-c++ g++ wget git autoconf automake python3 python3-pip make cmake pkgconf \ + libarchive-devel openssl-devel gpgme-devel libtool gettext texinfo bison flex gmp-devel mpfr-devel libmpc-devel ncurses-devel diffutils \ + libusb-compat-0.1-devel readline-devel libcurl-devel which glibc-gconv-extra xz + ;; + gentoo) + sudo emerge --noreplace net-misc/wget dev-vcs/git dev-python/pip sys-apps/fakeroot \ + app-arch/libarchive app-crypt/gpgme sys-devel/bison sys-devel/flex\ + dev-libs/mpc dev-libs/libusb-compat + ;; + arch) + sudo pacman -Sy gcc clang make cmake patch git texinfo flex bison gettext wget gsl gmp mpfr libmpc libusb readline libarchive gpgme bash openssl libtool libusb-compat boost python-pip + ;; + *) + echo "$TESTOS not supported here" + ;; + esac + +fi \ No newline at end of file diff --git a/toolchain-local.sh b/toolchain-local.sh deleted file mode 100755 index 132413a..0000000 --- a/toolchain-local.sh +++ /dev/null @@ -1,11 +0,0 @@ -export PSPDEV=$(pwd)/pspdev -export PATH=$PATH:$PSPDEV/bin - -## If specific steps were requested... -if [ $1 ]; then - ## Run the requested build scripts. - ./toolchain.sh $@ -else - ## Run the all build scripts. - ./toolchain.sh -fi diff --git a/toolchain-sudo.sh b/toolchain-sudo.sh deleted file mode 100755 index 157556f..0000000 --- a/toolchain-sudo.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -# toolchain-sudo.sh by Naomi Peori (naomi@peori.ca) - - INSTALLDIR=/usr/local/pspdev - - ## Enter the psptoolchain directory. - cd "`dirname $0`" || { echo "ERROR: Could not enter the psptoolchain directory."; exit 1; } - - ## Set up the environment. - export PSPDEV=$INSTALLDIR - export PATH=$PATH:$PSPDEV/bin - - ## Run the toolchain script. - ./toolchain.sh $@ || { echo "ERROR: Could not run the toolchain script."; exit 1; }