Skip to content

Commit

Permalink
Merge pull request #102 from uyjulian/buildsystem_improve
Browse files Browse the repository at this point in the history
Buildsystem improvements
  • Loading branch information
uyjulian authored Nov 25, 2023
2 parents 56d5b98 + 732769f commit 4459dab
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 33 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,51 @@ on:
pull_request:
repository_dispatch:
types: [run_build]
workflow_dispatch: {}

jobs:
build:
runs-on: ${{ matrix.os[0] }}
strategy:
matrix:
os: [[macos-latest, bash], [ubuntu-latest, bash], [windows-latest, msys2]]
fail-fast: false
defaults:
run:
shell: ${{ matrix.os[1] }} {0}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install Ubuntu texinfo bison flex
- name: Install Ubuntu packages
if: matrix.os[0] == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get -y install texinfo bison flex gettext libgmp3-dev libmpfr-dev libmpc-dev
echo "MSYSTEM=x64" >> $GITHUB_ENV
- name: Install Mac texinfo bison flex
if: matrix.os[0] == 'macOS-latest'
- name: Install macOS packages
if: matrix.os[0] == 'macos-latest'
run: |
brew update
brew install texinfo bison flex gnu-sed gsl gmp mpfr libmpc
echo "MSYSTEM=x64" >> $GITHUB_ENV
- name: Install MSYS2 texinfo bison flex
- name: Install MSYS2 packages
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 mpc-devel
install: |
base-devel git make texinfo flex bison patch binutils mingw-w64-i686-gcc mpc-devel tar
mingw-w64-i686-cmake mingw-w64-i686-extra-cmake-modules mingw-w64-i686-make mingw-w64-i686-libogg
update: true
shell: msys2 {0}

- name: Runs all the stages in the shell
continue-on-error: false
run: |
export PS2DEV=$PWD/ps2dev
export PS2SDK=$PS2DEV/ps2sdk
Expand Down
12 changes: 12 additions & 0 deletions config/ps2toolchain-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

PS2TOOLCHAIN_DVP_REPO_URL="https://github.com/ps2dev/ps2toolchain-dvp.git"
PS2TOOLCHAIN_DVP_DEFAULT_REPO_REF="main"
PS2TOOLCHAIN_IOP_REPO_URL="https://github.com/ps2dev/ps2toolchain-iop.git"
PS2TOOLCHAIN_IOP_DEFAULT_REPO_REF="main"
PS2TOOLCHAIN_EE_REPO_URL="https://github.com/ps2dev/ps2toolchain-ee.git"
PS2TOOLCHAIN_EE_DEFAULT_REPO_REF="main"

if test -f "$PS2DEV_CONFIG_OVERRIDE"; then
source "$PS2DEV_CONFIG_OVERRIDE"
fi
36 changes: 27 additions & 9 deletions scripts/001-dvp.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,36 @@
#!/bin/bash
# 001-dvp.sh by Francisco Javier Trujillo Mata ([email protected])
# 001-dvp.sh by ps2dev developers

## Exit with code 1 when any command executed returns a non-zero exit code.
onerr()
{
exit 1;
}
trap onerr ERR

## Read information from the configuration file.
source "$(dirname "$0")/../config/ps2toolchain-config.sh"

## Download the source code.
REPO_URL="https://github.com/ps2dev/ps2toolchain-dvp"
REPO_FOLDER="ps2toolchain-dvp"
REPO_URL="$PS2TOOLCHAIN_DVP_REPO_URL"
REPO_REF="$PS2TOOLCHAIN_DVP_DEFAULT_REPO_REF"
REPO_FOLDER="$(s="$REPO_URL"; s=${s##*/}; printf "%s" "${s%.*}")"

# Checking if a specific TAG has been selected, it is passed using parameter $1
[ -z "$1" ] && REPO_REFERENCE="main" || REPO_REFERENCE=$1
echo "Using repo reference $REPO_REFERENCE"
# Checking if a specific Git reference has been passed in parameter $1
if test -n "$1"; then
REPO_REF="$1"
printf 'Using specified repo reference %s\n' "$REPO_REF"
fi

if test ! -d "$REPO_FOLDER"; then
git clone $REPO_URL -b "${REPO_REFERENCE}" || exit 1
git clone --depth 1 -b "$REPO_REF" "$REPO_URL" "$REPO_FOLDER"
else
git -C "$REPO_FOLDER" fetch origin
git -C "$REPO_FOLDER" reset --hard "origin/$REPO_REF"
git -C "$REPO_FOLDER" checkout "$REPO_REF"
fi
cd "$REPO_FOLDER" && git fetch origin && git reset --hard "origin/${REPO_REFERENCE}" && git checkout "${REPO_REFERENCE}" || exit 1

cd "$REPO_FOLDER"

## Build and install.
./toolchain.sh || { exit 1; }
./toolchain.sh
36 changes: 27 additions & 9 deletions scripts/002-iop.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,36 @@
#!/bin/bash
# 002-iop.sh by Francisco Javier Trujillo Mata ([email protected])
# 002-iop.sh by ps2dev developers

## Exit with code 1 when any command executed returns a non-zero exit code.
onerr()
{
exit 1;
}
trap onerr ERR

## Read information from the configuration file.
source "$(dirname "$0")/../config/ps2toolchain-config.sh"

## Download the source code.
REPO_URL="https://github.com/ps2dev/ps2toolchain-iop"
REPO_FOLDER="ps2toolchain-iop"
REPO_URL="$PS2TOOLCHAIN_IOP_REPO_URL"
REPO_REF="$PS2TOOLCHAIN_IOP_DEFAULT_REPO_REF"
REPO_FOLDER="$(s="$REPO_URL"; s=${s##*/}; printf "%s" "${s%.*}")"

# Checking if a specific TAG has been selected, it is passed using parameter $1
[ -z "$1" ] && REPO_REFERENCE="main" || REPO_REFERENCE=$1
echo "Using repo reference $REPO_REFERENCE"
# Checking if a specific Git reference has been passed in parameter $1
if test -n "$1"; then
REPO_REF="$1"
printf 'Using specified repo reference %s\n' "$REPO_REF"
fi

if test ! -d "$REPO_FOLDER"; then
git clone $REPO_URL -b "${REPO_REFERENCE}" || exit 1
git clone --depth 1 -b "$REPO_REF" "$REPO_URL" "$REPO_FOLDER"
else
git -C "$REPO_FOLDER" fetch origin
git -C "$REPO_FOLDER" reset --hard "origin/$REPO_REF"
git -C "$REPO_FOLDER" checkout "$REPO_REF"
fi
cd "$REPO_FOLDER" && git fetch origin && git reset --hard "origin/${REPO_REFERENCE}" && git checkout "${REPO_REFERENCE}" || exit 1

cd "$REPO_FOLDER"

## Build and install.
./toolchain.sh || { exit 1; }
./toolchain.sh
36 changes: 27 additions & 9 deletions scripts/003-ee.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,36 @@
#!/bin/bash
# 003-ee.sh by Francisco Javier Trujillo Mata ([email protected])
# 003-ee.sh by ps2dev developers

## Exit with code 1 when any command executed returns a non-zero exit code.
onerr()
{
exit 1;
}
trap onerr ERR

## Read information from the configuration file.
source "$(dirname "$0")/../config/ps2toolchain-config.sh"

## Download the source code.
REPO_URL="https://github.com/ps2dev/ps2toolchain-ee"
REPO_FOLDER="ps2toolchain-ee"
REPO_URL="$PS2TOOLCHAIN_EE_REPO_URL"
REPO_REF="$PS2TOOLCHAIN_EE_DEFAULT_REPO_REF"
REPO_FOLDER="$(s="$REPO_URL"; s=${s##*/}; printf "%s" "${s%.*}")"

# Checking if a specific TAG has been selected, it is passed using parameter $1
[ -z "$1" ] && REPO_REFERENCE="main" || REPO_REFERENCE=$1
echo "Using repo reference $REPO_REFERENCE"
# Checking if a specific Git reference has been passed in parameter $1
if test -n "$1"; then
REPO_REF="$1"
printf 'Using specified repo reference %s\n' "$REPO_REF"
fi

if test ! -d "$REPO_FOLDER"; then
git clone $REPO_URL -b "${REPO_REFERENCE}" || exit 1
git clone --depth 1 -b "$REPO_REF" "$REPO_URL" "$REPO_FOLDER"
else
git -C "$REPO_FOLDER" fetch origin
git -C "$REPO_FOLDER" reset --hard "origin/$REPO_REF"
git -C "$REPO_FOLDER" checkout "$REPO_REF"
fi
cd "$REPO_FOLDER" && git fetch origin && git reset --hard "origin/${REPO_REFERENCE}" && git checkout "${REPO_REFERENCE}" || exit 1

cd "$REPO_FOLDER"

## Build and install.
./toolchain.sh || { exit 1; }
./toolchain.sh

0 comments on commit 4459dab

Please sign in to comment.