Skip to content

Commit

Permalink
Merge pull request #7 from fjtrujy/master
Browse files Browse the repository at this point in the history
Upgrading script for new toolchain
  • Loading branch information
wally4000 committed Nov 17, 2021
2 parents d3d4a13 + 0f792fe commit e099ee7
Show file tree
Hide file tree
Showing 31 changed files with 529 additions and 476 deletions.
129 changes: 85 additions & 44 deletions .github/workflows/compilation.yml
Expand Up @@ -8,77 +8,118 @@ on:

jobs:
build:
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} (${{ matrix.arch }})
runs-on: ${{ matrix.os[0] }}
strategy:
matrix:
include:
- { os: ubuntu-latest, arch: x64 }
- { os: ubuntu-latest, arch: x86 }
- { os: macos-latest, arch: x64 }
os: [[macos-latest, bash], [macos-11, bash], [ubuntu-latest, bash], [windows-latest, msys2]]
fail-fast: false
defaults:
run:
shell: ${{ matrix.os[1] }} {0}

steps:
- uses: actions/checkout@v2

- name: Install on Ubuntu and Configure
if: matrix.os == 'ubuntu-latest'
- name: Install Ubuntu texinfo bison flex libucl-dev
if: matrix.os[0] == 'ubuntu-latest'
run: |
pkg="autoconf automake bison bzip2 cmake doxygen flex gettext \
git gzip libtool-bin m4 make patch pkg-config python3 python3-venv \
subversion tar tcl texinfo unzip wget xz-utils"
if [ "${{matrix.arch}}" == "x86" ]; then
pkg="$pkg g++-multilib gcc-multilib libarchive-dev:i386 \
libcurl4-openssl-dev:i386 libelf-dev:i386 libgpgme-dev:i386 \
libncurses5-dev:i386 libreadline-dev:i386 libsdl1.2-dev:i386 \
libssl-dev:i386 libusb-dev:i386"
sudo dpkg --add-architecture i386
echo "CC=gcc -m32" >> $GITHUB_ENV
echo "CXX=g++ -m32" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig" >> $GITHUB_ENV
else
pkg="$pkg g++ gcc libarchive-dev libcurl4-openssl-dev libelf-dev \
libgpgme-dev libncurses5-dev libreadline-dev libsdl1.2-dev \
libssl-dev libusb-dev"
fi
sudo apt-get update
sudo apt-get -y install $pkg
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
echo "MSYSTEM=x64" >> $GITHUB_ENV
- name: Install on Mac
if: matrix.os == 'macos-latest'
run: brew bundle
- name: Install Mac texinfo bison flex ucl
if: startsWith( matrix.os[0], 'macos' )
run: |
brew update
brew install gettext texinfo bison flex gnu-sed ncurses gsl gmp mpfr autoconf automake cmake libusb-compat libarchive gpgme bash openssl libtool
echo "MSYSTEM=x64" >> $GITHUB_ENV
- 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
mingw-w64-i686-cmake
update: true
shell: msys2 {0}

- name: Runs all stages
- name: Runs all the stages in the shell
run: |
export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
export PATH="/usr/local/opt/libtool/libexec/gnubin:$PATH"
export PKG_CONFIG_PATH="/usr/local/opt/libarchive/lib/pkgconfig:/usr/local/opt/openssl@3/lib/pkgconfig"
export PSPDEV=$PWD/pspdev
export PATH=$PATH:$PSPDEV/bin
./pspdev.sh
./build-all.sh
- name: Get short SHA
id: slug
run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"
run: echo "::set-output name=sha8::${MSYSTEM}-sha[$(echo ${GITHUB_SHA} | cut -c1-8)]"

- name: Compress pspdev folder
- name: Prepare pspdev folder
run: |
tar -zcvf pspdev.tar.gz pspdev
tar -zcvf pspdev-${{matrix.os[0]}}.tar.gz pspdev
- uses: actions/upload-artifact@v2
with:
name: pspdev-${{ steps.slug.outputs.sha8 }}-${{ matrix.os }}-${{ matrix.arch }}
path: pspdev.tar.gz
name: pspdev-${{matrix.os[0]}}-${{ steps.slug.outputs.sha8 }}
path: pspdev-${{matrix.os[0]}}.tar.gz

- name: Rename pspdev.tar.gz file
run: |
if [ "${{matrix.os}}" == "macos-latest" ]; then
mv pspdev.tar.gz pspdev-macOS.tar.gz
elif [ "${{matrix.os}}" == "ubuntu-latest" ]; then
mv pspdev.tar.gz pspdev-linux-${{ matrix.arch }}.tar.gz
fi
- name: Extract tag name
if: startsWith(github.ref, 'refs/tags/')
id: tag
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}

- name: Create pre-release
if: github.ref == 'refs/heads/master'
uses: softprops/action-gh-release@v1
with:
files: pspdev-${{matrix.os[0]}}.tar.gz
prerelease: true
name: "Development build"
tag_name: "latest"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: pspdev-*.tar.gz
files: pspdev-${{matrix.os[0]}}.tar.gz
tag_name: ${{ steps.tag.outputs.VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-Dockers:
runs-on: ubuntu-latest
container: ${{ matrix.os }}:latest
strategy:
matrix:
os: [ubuntu, fedora]

steps:
- uses: actions/checkout@v2

- name: Install Ubuntu texinfo bison flex libucl-dev
if: matrix.os == 'ubuntu'
run: |
apt-get -y update
DEBIAN_FRONTEND="noninteractive" TZ="Europe/London" apt-get -y install autoconf automake bison bzip2 cmake doxygen flex g++ gcc \
git gzip libarchive-dev libcurl4 libcurl4-openssl-dev libelf-dev libgpgme-dev libncurses5-dev libreadline-dev libssl-dev \
libtool-bin libusb-dev m4 make patch pkg-config python3 python3-venv subversion tar tcl texinfo unzip wget xz-utils \
sudo fakeroot libarchive-tools curl libgmp3-dev libmpfr-dev libmpc-dev python3-pip
- name: Install dependencies Fedora
if: matrix.os == '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 \
libusb-devel readline-devel
- name: Runs all the stages in the shell
run: |
export PSPDEV=$PWD/pspdev
export PATH=$PATH:$PSPDEV/bin
./build-all.sh
49 changes: 21 additions & 28 deletions .github/workflows/docker.yml
Expand Up @@ -16,38 +16,31 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Prepare
id: prep
- name: Extract DOCKER_TAG using tag name
if: startsWith(github.ref, 'refs/tags/')
run: |
DOCKER_IMAGE=pspdev/pspdev
VERSION=latest
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/pull/* ]]; then
VERSION=pr-${{ github.event.number }}
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
if [ "${{ github.event_name }}" = "push" ]; then
TAGS="$TAGS,${DOCKER_IMAGE}:sha-${GITHUB_SHA::8}"
fi
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- uses: docker/setup-buildx-action@v1

- uses: docker/login-action@v1
if: github.event_name != 'pull_request'
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@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- uses: docker/build-push-action@v2
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prep.outputs.tags }}
labels: |
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
push: true
tags: ${{ github.repository }}:${{ env.DOCKER_TAG }}
build-args: |
BASE_DOCKER_IMAGE=ghcr.io/${{ github.repository_owner }}/psp-packages:${{ env.DOCKER_TAG }}
24 changes: 0 additions & 24 deletions Brewfile

This file was deleted.

14 changes: 7 additions & 7 deletions Dockerfile
@@ -1,13 +1,13 @@
# First stage
FROM pspdev/pspsdk
ARG BASE_DOCKER_IMAGE

FROM $BASE_DOCKER_IMAGE

COPY . /src

RUN apk add build-base autoconf automake bash bison cmake curl-dev doxygen \
flex git gpgme-dev libarchive-dev libtool libusb-compat-dev \
openssl-dev patch python3 readline-dev sdl-dev subversion tcl \
texinfo wget zlib-dev xz
RUN cd /src && ./pspdev.sh 3 4 5 6 7
# There are some dependencies needed because it is checked by "depends" scripts
RUN apk add build-base git bash patch wget zlib-dev ucl-dev readline-dev libusb-compat-dev \
autoconf automake bison flex python3 py3-pip cmake pkgconfig libarchive-dev openssl-dev gpgme-dev libtool
RUN cd /src && ./build-extra.sh

# Second stage of Dockerfile
FROM alpine:latest
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 PSP Homebrew Development

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
83 changes: 65 additions & 18 deletions README.md
@@ -1,34 +1,81 @@
# pspdev
pspdev master repository

This is a repository for auto-builds of the whole psp toolchain using
GitHub actions.
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/pspdev/pspdev/CI?label=CI&logo=github&style=for-the-badge)](https://github.com/pspdev/pspdev/actions?query=workflow%3ACI)[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/pspdev/pspdev/CI-Docker?label=CI-Docker&logo=github&style=for-the-badge)](https://github.com/pspdev/pspdev/actions?query=workflow%3ACI-Docker)[![Docker Pulls](https://img.shields.io/docker/pulls/pspdev/pspdev?style=for-the-badge)](https://hub.docker.com/r/pspdev/pspdev/tags)

## Building
Main PSP Repo for building the whole `PSP Development` environment in your local machine.

### Prequisites:
This program will automatically build and install the whole compiler and other tools used in the creation of homebrew software for the Sony PlayStation Portable® videogame system.

#### Linux distributions
## What these scripts do

```console
$ ./depends/check-dependencies.sh
These scripts download (`git clone`) and install:

- [psptoolchain](https://github.com/pspdev/psptoolchain "psptoolchain")
- [pspsdk](https://github.com/pspdev/pspsdk "pspsdk")
- [psp-packages](https://github.com/pspdev/psp-packages "psp-packages")
- [psplinkusb](https://github.com/pspdev/psplinkusb "psplinkusb")
- [ebootsigner](https://github.com/pspdev/ebootsigner "ebootsigner")

## Requirements

1. Install gcc/clang, make, cmake, patch, git, texinfo, flex, bison, gettext, wget, gsl, gmp, mpfr, mpc, libusb, readline, libarchive, gpgme, bash, openssl and libtool if you don't have those.
We offer a script to help you for installing dependencies:

### Ubuntu/Debian
```bash
sudo ./prepare-debian-ubuntu.sh
```

#### macOS:
### Fedora
```bash
sudo ./prepare-fedora.sh
```

```console
$ brew bundle
### OSX
```bash
sudo ./prepare-mac-os.sh
```

### Building the Toolchain
2. _Optional._ If you are upgrading from the previous version of the PSPDEV environment, it is highly recommended to remove the content of the PSPDEV folder before upgrade. This is a necessary step after the major toolchain upgrade.
```bash
sudo rm -rf $PSPDEV
```

```console
export PSPDEV=/path/to/pspdev
3. Ensure that you have enough permissions for managing PSPDEV location (default to `/usr/local/pspdev`, but you can use a different path). PSPDEV location MUST NOT have spaces or special characters in its path! PSPDEV should be an absolute path. On Unix systems, if the command `mkdir -p $PSPDEV` fails for you, you can set access for the current user by running commands:
```bash
export PSPDEV=/usr/local/pspdev
sudo mkdir -p $PSPDEV
sudo chown -R $USER: $PSPDEV
```

4. Add this to your login script (example: `~/.bash_profile`)
**Note:** Ensure that you have full access to the PSPDEV path. You can change the PSPDEV path with the following requirements: only use absolute paths, don't use spaces, only use Latin characters.
```bash
export PSPDEV=/usr/local/pspdev
export PATH=$PATH:$PSPDEV/bin
./pspdev.sh
```

There are specific scripts to aid building in some circumstances:
- `pspdev-local.sh`
- `pspdev-sudo.sh`
5. Run build-all.sh
```bash
./build-all.sh
```

## Docker generation

This repo also uses CI/CD to create a docker image called `pspdev/pspdev:latest` per change. This is useful if you're a developer that wants to create/port an application to the PSP. You can compile your project using this docker image.

## Extra steps

If you want, you can _JUST_ install the extra dependencies as `psplinkusb and ebootsigner`. To achieve this execute
```bash
./build-extra.sh
```

### macOS

If you download the pre-built macOS binaries and get a security error such as _`"pspsh" cannot be opened because the developer cannot be verified.`_, you can remove the quarantine attribute by running:
```bash
xattr -dr com.apple.quarantine path/to/prebuilt/pspdev
```

## Thanks

0 comments on commit e099ee7

Please sign in to comment.