Skip to content

Commit 16d7b3e

Browse files
committed
Build system refactoring.
- Download all files build so we fail early. - Don't depend on savannah for builds. - Split up CI tasks for visibility (helper in utils folder for generating these)
1 parent bb1dc67 commit 16d7b3e

18 files changed

Lines changed: 383 additions & 131 deletions

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.sh text eol=lf linguist-language=Shell
2+
*.txt eol=lf

.github/workflows/build.yml

Lines changed: 133 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -8,92 +8,141 @@ on:
88

99
jobs:
1010
build:
11-
runs-on: ${{ matrix.os }}
11+
runs-on: ${{ matrix.runner }}
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
os: [macos-15-intel, ubuntu-latest, macos-26]
15+
include:
16+
- runner: ubuntu-latest
17+
os: linux
1618

19+
- runner: macos-15-intel
20+
os: macos
21+
22+
- runner: macos-26
23+
os: macos
24+
25+
steps:
26+
- uses: actions/checkout@v6
27+
28+
- name: Install Linux requirements
29+
if: matrix.os == 'linux'
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get -y install \
33+
autoconf automake bison flex gcc libelf-dev make texinfo \
34+
libncurses5-dev patch python3 python-is-python3 subversion \
35+
wget zlib1g-dev libtool-bin python3-dev bzip2 libgmp3-dev \
36+
pkg-config pv libssl-dev
37+
38+
# ------------------------
39+
# macOS dependencies
40+
# ------------------------
41+
- name: Install macOS requirements
42+
if: matrix.os == 'macos'
43+
shell: bash
44+
env:
45+
HOMEBREW_NO_AUTO_UPDATE: 1
46+
HOMEBREW_NO_INSTALL_CLEANUP: 1
47+
HOMEBREW_NO_ENV_HINTS: 1
48+
run: |
49+
if ! command -v brew >/dev/null 2>&1; then
50+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
51+
fi
52+
53+
if [[ -d /opt/homebrew ]]; then
54+
eval "$(/opt/homebrew/bin/brew shellenv)"
55+
else
56+
eval "$(/usr/local/bin/brew shellenv)"
57+
fi
58+
59+
brew install \
60+
autoconf automake openssl libelf ncurses zlib gmp wget \
61+
pkg-config texinfo pv
62+
63+
# ------------------------
64+
# GLOBAL ENV SETUP
65+
# ------------------------
66+
- name: Setup environment (PS3DEV + base PATH)
67+
shell: bash
68+
run: |
69+
mkdir -p "$PWD/ps3dev"
70+
mkdir -p "$PWD/build"
71+
72+
echo "BUILD_PS3TOOLCHAIN_ONLY=1" >> $GITHUB_ENV
73+
echo "NO_SAVANNAH=1" >> $GITHUB_ENV
74+
echo "PS3DEV=$PWD/ps3dev" >> $GITHUB_ENV
75+
echo "PSL1GHT=$PWD/ps3dev" >> $GITHUB_ENV
76+
echo "PATH=$PATH:$PWD/ps3dev/bin:$PWD/ps3dev/ppu/bin:$PWD/ps3dev/spu/bin" >> $GITHUB_ENV
77+
78+
# ------------------------
79+
# Build steps
80+
# ------------------------
81+
- name: Download files
82+
working-directory: ./build
83+
run: ../download.sh
84+
85+
- name: Build Binutils (PPU)
86+
working-directory: ./build
87+
run: ../scripts/001-binutils-PPU.sh
88+
89+
- name: Build Gcc + Newlib (PPU)
90+
working-directory: ./build
91+
run: ../scripts/002-gcc-newlib-PPU.sh
92+
93+
- name: Symlinks (PPU)
94+
working-directory: ./build
95+
run: ../scripts/004-symlinks-PPU.sh
96+
97+
- name: Build Binutils (SPU)
98+
working-directory: ./build
99+
run: ../scripts/005-binutils-SPU.sh
100+
101+
- name: Build Gcc + Newlib (SPU)
102+
working-directory: ./build
103+
run: ../scripts/006-gcc-newlib-SPU.sh
104+
105+
- name: Build PSL1GHT
106+
if: env.BUILD_PS3TOOLCHAIN_ONLY != '1'
107+
working-directory: ./build
108+
run: ../scripts/007-psl1ght.sh
109+
110+
- name: Build PSL1GHT Libraries
111+
if: env.BUILD_PS3TOOLCHAIN_ONLY != '1'
112+
working-directory: ./build
113+
run: ../scripts/008-libraries.sh
114+
115+
- name: Get short SHA
116+
id: slug
117+
run: echo "sha8=${GITHUB_SHA::8}" >> "$GITHUB_OUTPUT"
118+
119+
- name: Compress ps3dev folder
120+
run: tar -zcvf ps3dev-${{ matrix.os }}-${{ runner.arch }}.tar.gz ps3dev
121+
122+
- uses: actions/upload-artifact@v7
123+
with:
124+
name: ps3dev-${{ steps.slug.outputs.sha8 }}-${{ matrix.os }}-${{ runner.arch }}
125+
path: ps3dev-${{ matrix.os }}-${{ runner.arch }}.tar.gz
126+
127+
push_release:
128+
if: |
129+
github.event_name == 'push' &&
130+
github.repository == 'ps3dev/ps3toolchain'
131+
needs: build
132+
runs-on: ubuntu-latest
133+
permissions:
134+
contents: write
17135
steps:
18-
- uses: actions/checkout@v6
19-
20-
- name: Install Ubuntu requirements
21-
if: matrix.os == 'ubuntu-latest'
22-
run: |
23-
sudo apt-get update
24-
sudo apt-get -y install autoconf automake bison flex gcc libelf-dev make texinfo libncurses5-dev patch python3 python-is-python3 subversion wget zlib1g-dev libtool-bin python3-dev bzip2 libgmp3-dev pkg-config
25-
26-
- name: Install macOS intel requirements
27-
if: matrix.os == 'macos-15-intel'
28-
shell: arch -x86_64 bash -e {0}
29-
env:
30-
HOMEBREW_NO_AUTO_UPDATE: 1
31-
HOMEBREW_NO_INSTALL_CLEANUP: 1
32-
HOMEBREW_NO_ENV_HINTS: 1
33-
run: |
34-
brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config texinfo
35-
36-
- name: Install macOS arm64 requirements
37-
if: matrix.os == 'macos-26'
38-
shell: bash -e {0}
39-
env:
40-
HOMEBREW_NO_AUTO_UPDATE: 1
41-
HOMEBREW_NO_INSTALL_CLEANUP: 1
42-
HOMEBREW_NO_ENV_HINTS: 1
43-
run: |
44-
brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config texinfo
45-
46-
- name: Runs all the stages in the shell
47-
if: matrix.os == 'ubuntu-latest'
48-
shell: bash -e {0}
49-
env:
50-
BUILD_PS3TOOLCHAIN_ONLY: 1
51-
run: |
52-
mkdir $PWD/ps3dev
53-
export PS3DEV=$PWD/ps3dev
54-
export PSL1GHT=$PS3DEV
55-
export PATH=$PATH:$PS3DEV/bin
56-
export PATH=$PATH:$PS3DEV/ppu/bin
57-
export PATH=$PATH:$PS3DEV/spu/bin
58-
./toolchain.sh
59-
60-
- name: Runs all the stages in the shell
61-
if: matrix.os == 'macos-15-intel'
62-
shell: arch -x86_64 bash -e {0}
63-
env:
64-
BUILD_PS3TOOLCHAIN_ONLY: 1
65-
run: |
66-
mkdir $PWD/ps3dev
67-
export PS3DEV=$PWD/ps3dev
68-
export PSL1GHT=$PS3DEV
69-
export PATH=$PATH:$PS3DEV/bin
70-
export PATH=$PATH:$PS3DEV/ppu/bin
71-
export PATH=$PATH:$PS3DEV/spu/bin
72-
./toolchain.sh
73-
74-
- name: Runs all the stages in the shell
75-
if: matrix.os == 'macos-26'
76-
shell: bash -e {0}
77-
env:
78-
BUILD_PS3TOOLCHAIN_ONLY: 1
79-
run: |
80-
mkdir $PWD/ps3dev
81-
export PS3DEV=$PWD/ps3dev
82-
export PSL1GHT=$PS3DEV
83-
export PATH=$PATH:$PS3DEV/bin
84-
export PATH=$PATH:$PS3DEV/ppu/bin
85-
export PATH=$PATH:$PS3DEV/spu/bin
86-
./toolchain.sh
87-
88-
- name: Get short SHA
89-
id: slug
90-
run: echo "sha8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> "$GITHUB_OUTPUT"
91-
92-
- name: Compress ps3dev folder
93-
run: |
94-
tar -zcvf ps3dev.tar.gz ps3dev
95-
96-
- uses: actions/upload-artifact@v6
97-
with:
98-
name: ps3dev-${{ steps.slug.outputs.sha8 }}-${{matrix.os}}
99-
path: ps3dev.tar.gz
136+
- name: Checkout
137+
uses: actions/checkout@v6
138+
139+
- name: Download artifacts
140+
uses: actions/download-artifact@v8
141+
with:
142+
path: artifacts
143+
merge-multiple: true
144+
145+
- name: Create Release
146+
env:
147+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
148+
run: gh release create 1.0${{ GITHUB.RUN_NUMBER }} artifacts/*.tar.gz --target ${{ GITHUB.SHA }} -t 1.0${{ GITHUB.RUN_NUMBER }}

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
build/
2-
.idea/**
1+
/build
2+
/archives/*
3+
!/archives/archives.txt
4+
/ps3dev

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ RUN \
1212
apt-get -y update && \
1313
apt-get -y install \
1414
autoconf bison build-essential ca-certificates flex git libelf-dev\
15-
libgmp-dev libncurses5-dev libssl-dev libtool-bin pkg-config python-dev-is-python3 \
16-
texinfo wget zlib1g-dev && \
15+
libgmp-dev libncurses5-dev libssl-dev libtool-bin pkg-config \
16+
texinfo wget zlib1g-dev pv && \
1717
apt-get -y clean autoclean autoremove && \
1818
rm -rf /var/lib/{apt,dpkg,cache,log}/
1919

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
## Set up your environment by installing the following software:
1515

1616
autoconf, automake, bison, flex, gcc, libelf, make, makeinfo,
17-
ncurses, patch, python, subversion, wget, zlib, libtool, python,
18-
bzip2, gmp, pkg-config, g++, libssl-dev, clang
17+
ncurses, patch, python, subversion, wget, zlib, libtool,
18+
bzip2, gmp, pkg-config, g++, libssl-dev, clang, pv
1919

2020
### Linux
2121

archives/archives.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
6c7af8ed1c8cf9b4b9d6e6fe09a3e1d3d479fe63984ba8b9b26bf356b6313ca9 19973532 https://sourceware.org/pub/binutils/releases/binutils-2.22.tar.bz2 -> binutils-2.22.tar.bz2
2+
1cf7adf8ff4b5aa49041c8734bbcf1ad18cc4c94d0029aae0f4e48841088479a 62312628 https://sourceware.org/pub/gcc/releases/gcc-7.2.0/gcc-7.2.0.tar.xz -> gcc-7.2.0.tar.xz
3+
c644b2847244278c57bec2ddda69d8fab5a7c767f3b9af69aa7aa3da823ff692 14571004 https://sourceware.org/pub/newlib/newlib-1.20.0.tar.gz -> newlib-1.20.0.tar.gz
4+
- - https://github.com/ps3dev/psl1ght/tarball/master -> psl1ght.tar.gz
5+
- - https://github.com/ps3dev/ps3libraries/tarball/master -> ps3libraries.tar.gz

config/get-config-scripts.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,11 @@ fetch_config_file() {
3333
chmod +x "${file}"
3434
}
3535

36-
fetch_config_file config.guess
37-
fetch_config_file config.sub
36+
if [ -z "${NO_SAVANNAH}" ]; then
37+
fetch_config_file config.guess
38+
fetch_config_file config.sub
39+
else
40+
echo "NO_SAVANNAH is set, skipping Savannah downloads."
41+
cp "${CONFIG_DIR}/config.guess" "config.guess"
42+
cp "${CONFIG_DIR}/config.sub" "config.sub"
43+
fi

depends/check-pv.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
( pv -V ) 1>/dev/null 2>&1 || { echo "ERROR: Install pv before continuing."; exit 1; }

depends/check-python.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)