Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buildsystem improvements #19

Merged
merged 3 commits into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions .github/workflows/compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,59 @@ on:
pull_request:
repository_dispatch:
types: [run_build, run_release]
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 libgmp3-dev libmpfr-dev libmpc-dev
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
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 PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
export PATH="/usr/local/opt/bison/bin:$PATH"
export PATH=$PATH:$PS2DEV/iop/bin
./toolchain.sh

- name: Print bins version
- name: Print version of executables
run: |
export PS2DEV=$PWD/ps2dev
export PATH=$PATH:$PS2DEV/iop/bin
Expand Down
10 changes: 10 additions & 0 deletions config/ps2toolchain-iop-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

PS2TOOLCHAIN_IOP_BINUTILS_REPO_URL="https://github.com/ps2dev/binutils-gdb.git"
PS2TOOLCHAIN_IOP_BINUTILS_DEFAULT_REPO_REF="iop-v2.35.2"
PS2TOOLCHAIN_IOP_GCC_REPO_URL="https://github.com/ps2dev/gcc.git"
PS2TOOLCHAIN_IOP_GCC_DEFAULT_REPO_REF="iop-v11.3.0"

if test -f "$PS2DEV_CONFIG_OVERRIDE"; then
source "$PS2DEV_CONFIG_OVERRIDE"
fi
25 changes: 18 additions & 7 deletions scripts/001-binutils.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# 001-binutils.sh by Francisco Javier Trujillo Mata (fjtrujy@gmail.com)
# 001-binutils.sh by ps2dev developers

## Exit with code 1 when any command executed returns a non-zero exit code.
onerr()
Expand All @@ -8,17 +8,28 @@ onerr()
}
trap onerr ERR

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

## Download the source code.
REPO_URL="https://github.com/ps2dev/binutils-gdb.git"
REPO_FOLDER="binutils-gdb"
BRANCH_NAME="iop-v2.35.2"
REPO_URL="$PS2TOOLCHAIN_IOP_BINUTILS_REPO_URL"
REPO_REF="$PS2TOOLCHAIN_IOP_BINUTILS_DEFAULT_REPO_REF"
REPO_FOLDER="$(s="$REPO_URL"; s=${s##*/}; printf "%s" "${s%.*}")"

# 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 --depth 1 -b "$BRANCH_NAME" "$REPO_URL"
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/${BRANCH_NAME}"
git -C "$REPO_FOLDER" checkout "$BRANCH_NAME"
git -C "$REPO_FOLDER" reset --hard "origin/$REPO_REF"
git -C "$REPO_FOLDER" checkout "$REPO_REF"
fi

cd "$REPO_FOLDER"

TARGET_ALIAS="iop"
Expand Down
32 changes: 22 additions & 10 deletions scripts/002-gcc-stage1.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# 002-gcc-stage1.sh by Francisco Javier Trujillo Mata (fjtrujy@gmail.com)
# 002-gcc-stage1.sh by ps2dev developers

## Exit with code 1 when any command executed returns a non-zero exit code.
onerr()
Expand All @@ -8,17 +8,28 @@ onerr()
}
trap onerr ERR

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

## Download the source code.
REPO_URL="https://github.com/ps2dev/gcc.git"
REPO_FOLDER="gcc"
BRANCH_NAME="iop-v11.3.0"
REPO_URL="$PS2TOOLCHAIN_IOP_GCC_REPO_URL"
REPO_REF="$PS2TOOLCHAIN_IOP_GCC_DEFAULT_REPO_REF"
REPO_FOLDER="$(s="$REPO_URL"; s=${s##*/}; printf "%s" "${s%.*}")"

# 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 --depth 1 -b "$BRANCH_NAME" "$REPO_URL"
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/${BRANCH_NAME}"
git -C "$REPO_FOLDER" checkout "$BRANCH_NAME"
git -C "$REPO_FOLDER" reset --hard "origin/$REPO_REF"
git -C "$REPO_FOLDER" checkout "$REPO_REF"
fi

cd "$REPO_FOLDER"

TARGET_ALIAS="iop"
Expand Down Expand Up @@ -75,12 +86,13 @@ for TARGET in "mipsel-ps2-irx" "mipsel-ps2-elf"; do
--disable-target-zlib \
--disable-nls \
--disable-tls \
MAKEINFO=missing \
$TARG_XTRA_OPTS

## Compile and install.
make --quiet -j "$PROC_NR" all
make --quiet -j "$PROC_NR" install-strip
make --quiet -j "$PROC_NR" clean
make --quiet -j "$PROC_NR" MAKEINFO=missing all
make --quiet -j "$PROC_NR" MAKEINFO=missing install-strip
make --quiet -j "$PROC_NR" MAKEINFO=missing clean

## Exit the build directory.
cd ..
Expand Down
Loading