diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml index 0d96225..39e14af 100644 --- a/.github/workflows/compilation.yml +++ b/.github/workflows/compilation.yml @@ -12,13 +12,13 @@ jobs: runs-on: ${{ matrix.os[0] }} strategy: matrix: - os: [[macos-latest, bash], [macOS-11, bash], [ubuntu-latest, bash], [windows-latest, msys2]] + os: [[macos-latest, bash], [macOS-11, bash], [ubuntu-latest, bash]] defaults: run: shell: ${{ matrix.os[1] }} {0} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install on Ubuntu if: matrix.os[0] == 'ubuntu-latest' @@ -32,15 +32,6 @@ jobs: brew update brew install gettext texinfo bison flex gnu-sed gsl gmp mpfr - - name: Install in MSYS2 - if: matrix.os[0] == 'windows-latest' - uses: msys2/setup-msys2@v2 - with: - msystem: MINGW32 - install: base-devel git make texinfo flex bison patch binutils mingw-w64-i686-gcc mingw-w64-i686-dlfcn mingw-w64-i686-mpc - update: true - shell: msys2 {0} - - name: Runs all stages run: | export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH" @@ -50,13 +41,13 @@ jobs: - name: Get short SHA id: slug - run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)" + run: echo "sha8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT - name: Compress pspdev folder run: | tar -zcvf pspdev.tar.gz pspdev - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: pspdev-${{ steps.slug.outputs.sha8 }}-${{ matrix.os[0] }} path: pspdev.tar.gz @@ -68,7 +59,7 @@ jobs: matrix: os: [[ubuntu, bash], [fedora, bash]] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install dependencies Ubuntu if: matrix.os[0] == 'ubuntu' @@ -91,13 +82,13 @@ jobs: - name: Get short SHA id: slug - run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)" + run: echo "sha8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT - name: Compress pspdev folder run: | tar -zcvf pspdev.tar.gz pspdev - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: pspdev-${{ steps.slug.outputs.sha8 }}-${{ matrix.os[0] }} - path: pspdev.tar.gz \ No newline at end of file + path: pspdev.tar.gz diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 3408af0..9bb337a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -7,13 +7,15 @@ on: tags: - v* workflow_dispatch: {} + schedule: + - cron: 0 17 * * 5 jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Extract DOCKER_TAG using tag name if: startsWith(github.ref, 'refs/tags/') @@ -26,19 +28,19 @@ jobs: echo "DOCKER_TAG=latest" >> $GITHUB_ENV - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v2 - name: Login to Github registry - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} registry: ghcr.io - - uses: docker/build-push-action@v2 + - uses: docker/build-push-action@v4 with: push: true tags: ghcr.io/${{ github.repository }}:${{ env.DOCKER_TAG }} @@ -49,8 +51,8 @@ jobs: echo "NEW_DISPATCH_ACTION=$DISPATCH_ACTION" >> $GITHUB_ENV - name: Repository Dispatch - uses: peter-evans/repository-dispatch@v1 + uses: peter-evans/repository-dispatch@v2 with: - repository: ${{ github.repository_owner }}/psptoolchain + repository: ${{ github.repository_owner }}/psptoolchain-extra token: ${{ secrets.DISPATCH_TOKEN }} event-type: ${{ env.NEW_DISPATCH_ACTION }} diff --git a/Dockerfile b/Dockerfile index 6864135..3c4ce82 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ # First stage -FROM alpine:latest +# Please change the alpine version back to latest after 3.19 releases +FROM alpine:3.16 ENV PSPDEV /usr/local/pspdev ENV PATH $PATH:${PSPDEV}/bin diff --git a/README.md b/README.md index 9e1c6b2..1c806cb 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ # psptoolchain-allegrex -[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/pspdev/psptoolchain-allegrex/CI?label=CI&logo=github&style=for-the-badge)](https://github.com/pspdev/psptoolchain-allegrex/actions?query=workflow%3ACI) -[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/pspdev/psptoolchain-allegrex/CI-Docker?label=CI-Docker&logo=github&style=for-the-badge)](https://github.com/pspdev/psptoolchain-allegrex/actions?query=workflow%3ACI-Docker) +[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/pspdev/psptoolchain-allegrex/compilation.yml?branch=main&label=CI&logo=github&style=for-the-badge)](https://github.com/pspdev/psptoolchain-allegrex/actions?query=workflow%3ACI) +[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/pspdev/psptoolchain-allegrex/docker.yml?branch=main&label=CI-Docker&logo=github&style=for-the-badge)](https://github.com/pspdev/psptoolchain-allegrex/actions?query=workflow%3ACI-Docker) This program will automatically build and install a compiler and other tools used in the creation of homebrew software for the Sony Playstation Portable handheld videogame system (PSP). + ## **ATENTION!** If you're trying to install in your machine the **WHOLE PSP Development Environment** this is **NOT** the repo to use, you should use instead the [pspdev](https://github.com/pspdev/pspdev "pspdev") repo. @@ -17,6 +18,7 @@ These scripts download (`git clone`) and install: - [gdb](https://github.com/pspdev/binutils-gdb "gdb") - [gcc](https://github.com/pspdev/gcc "gcc") - [newlib](https://github.com/pspdev/newlib "newlib") +- [pthread-embedded](https://github.com/pspdev/pthread-embedded "pthread-embedded") ## Requirements diff --git a/scripts/001-binutils.sh b/scripts/001-binutils.sh index f9a21a0..52222fb 100755 --- a/scripts/001-binutils.sh +++ b/scripts/001-binutils.sh @@ -20,12 +20,22 @@ PROC_NR=$(getconf _NPROCESSORS_ONLN) ## Create and enter the toolchain/build directory rm -rf build-$TARGET && mkdir build-$TARGET && cd build-$TARGET || { exit 1; } +## Build GDB without python support when built with a GitHub Action +## This makes the pre-build executable work on more systems +if [ -n "$CI" ]; then + WITH_PYTHON="no" +else + WITH_PYTHON="auto" +fi + ## Configure the build. ../configure \ --quiet \ --prefix="$PSPDEV" \ --target="$TARGET" \ --enable-plugins \ + --disable-initfini-array \ + --with-python="$WITH_PYTHON" \ --disable-werror \ $TARG_XTRA_OPTS || { exit 1; } diff --git a/scripts/002-gcc-stage1.sh b/scripts/002-gcc-stage1.sh index a05500f..457512b 100755 --- a/scripts/002-gcc-stage1.sh +++ b/scripts/002-gcc-stage1.sh @@ -36,6 +36,7 @@ rm -rf mkdir build-$TARGET-stage1 && mkdir build-$TARGET-stage1 && cd build-$TAR --with-float=hard \ --with-headers=no \ --without-newlib \ + --disable-libatomic \ --disable-libssp \ --disable-multilib \ $TARG_XTRA_OPTS || { exit 1; } diff --git a/scripts/003-newlib.sh b/scripts/003-newlib.sh index e30a362..229979a 100755 --- a/scripts/003-newlib.sh +++ b/scripts/003-newlib.sh @@ -4,7 +4,7 @@ ## Download the source code. REPO_URL="https://github.com/pspdev/newlib.git" REPO_FOLDER="newlib" -BRANCH_NAME="allegrex-v4.1.0" +BRANCH_NAME="allegrex-v4.3.0" if test ! -d "$REPO_FOLDER"; then git clone --depth 1 -b $BRANCH_NAME $REPO_URL && cd $REPO_FOLDER || { exit 1; } else @@ -23,6 +23,8 @@ rm -rf build-$TARGET && mkdir build-$TARGET && cd build-$TARGET || { exit 1; } ../configure \ --prefix="$PSPDEV" \ --target="$TARGET" \ + --enable-newlib-retargetable-locking \ + --enable-newlib-io-c99-formats \ $TARG_XTRA_OPTS || { exit 1; } ## Compile and install. diff --git a/scripts/004-pthread-embedded.sh b/scripts/004-pthread-embedded.sh new file mode 100755 index 0000000..adb8efe --- /dev/null +++ b/scripts/004-pthread-embedded.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# pthread-embedded.sh by Francisco Javier Trujillo Mata (fjtrujy@gmail.com) + +## Download the source code. +REPO_URL="https://github.com/pspdev/pthread-embedded.git" +REPO_FOLDER="pthread-embedded" +BRANCH_NAME="psp" +if test ! -d "$REPO_FOLDER"; then + git clone --depth 1 -b $BRANCH_NAME $REPO_URL && cd $REPO_FOLDER || { exit 1; } +else + cd $REPO_FOLDER && git fetch origin && git reset --hard origin/${BRANCH_NAME} && git checkout ${BRANCH_NAME} || { exit 1; } +fi + +TARGET="psp" + +## Determine the maximum number of processes that Make can work with. +PROC_NR=$(getconf _NPROCESSORS_ONLN) + +cd platform/psp || { exit 1; } + +## Compile and install. +make --quiet -j $PROC_NR clean || { exit 1; } +make --quiet -j $PROC_NR all || { exit 1; } +make --quiet -j $PROC_NR install || { exit 1; } +make --quiet -j $PROC_NR clean || { exit 1; } diff --git a/scripts/004-gcc-stage2.sh b/scripts/005-gcc-stage2.sh similarity index 98% rename from scripts/004-gcc-stage2.sh rename to scripts/005-gcc-stage2.sh index 1e3b808..8c1fc82 100755 --- a/scripts/004-gcc-stage2.sh +++ b/scripts/005-gcc-stage2.sh @@ -38,6 +38,7 @@ rm -rf build-$TARGET-stage2 && mkdir build-$TARGET-stage2 && cd build-$TARGET-st --disable-libssp \ --disable-multilib \ --enable-cxx-flags=-G0 \ + --enable-threads=posix \ $TARG_XTRA_OPTS || { exit 1; } ## Compile and install.