Skip to content

Commit a406d0d

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) - Remove Python. - Add download caching.
1 parent bb1dc67 commit a406d0d

18 files changed

Lines changed: 406 additions & 130 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: 131 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -8,92 +8,139 @@ 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
18+
19+
- runner: macos-15-intel
20+
os: macos
21+
22+
- runner: macos-26
23+
os: macos
1624

1725
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
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+
eval "$(brew shellenv)"
50+
brew install \
51+
autoconf automake openssl libelf ncurses zlib gmp wget \
52+
pkg-config texinfo pv
53+
54+
# ------------------------
55+
# GLOBAL ENV SETUP
56+
# ------------------------
57+
- name: Setup environment (PS3DEV + base PATH)
58+
shell: bash
59+
run: |
60+
mkdir -p "$PWD/ps3dev"
61+
mkdir -p "$PWD/build"
62+
63+
echo "BUILD_PS3TOOLCHAIN_ONLY=1" >> $GITHUB_ENV
64+
echo "NO_SAVANNAH=1" >> $GITHUB_ENV
65+
echo "PS3DEV=$PWD/ps3dev" >> $GITHUB_ENV
66+
echo "PSL1GHT=$PWD/ps3dev" >> $GITHUB_ENV
67+
echo "PATH=$PATH:$PWD/ps3dev/bin:$PWD/ps3dev/ppu/bin:$PWD/ps3dev/spu/bin" >> $GITHUB_ENV
68+
69+
- name: Cache downloaded archives
70+
uses: actions/cache@v5
71+
with:
72+
path: archives
73+
key: archives-${{ hashFiles('archives/archives.txt') }}
74+
75+
- name: Purge unverifiable archives
76+
run: |
77+
while IFS= read -r line; do
78+
set -- $line
79+
[ "${1:-}" = "-" ] || continue
80+
# 3rd field is URL, 5th field (if "->") is rename
81+
url="$3"
82+
rename=""
83+
[ "${4:-}" = "->" ] && rename="${5:-}"
84+
file="${rename:-$(basename "$url")}"
85+
rm -f "archives/$file"
86+
done < archives/archives.txt
87+
88+
# ------------------------
89+
# Build steps
90+
# ------------------------
91+
- name: Download files
92+
working-directory: ./build
93+
run: ../download.sh
94+
95+
- name: Build Binutils (PPU)
96+
run: ./toolchain.sh 001
97+
98+
- name: Build GCC + Newlib (PPU)
99+
run: ./toolchain.sh 002
100+
101+
- name: Symlinks (PPU)
102+
run: ./toolchain.sh 004
103+
104+
- name: Build Binutils (SPU)
105+
run: ./toolchain.sh 005
106+
107+
- name: Build GCC + Newlib (SPU)
108+
run: ./toolchain.sh 006
109+
110+
- name: Get short SHA
111+
id: slug
112+
run: echo "sha8=${GITHUB_SHA::8}" >> "$GITHUB_OUTPUT"
113+
114+
- name: Compress ps3dev folder
115+
run: tar -zcvf ps3dev-${{ matrix.os }}-${{ runner.arch }}.tar.gz ps3dev
116+
117+
- uses: actions/upload-artifact@v7
118+
with:
119+
name: ps3dev-${{ steps.slug.outputs.sha8 }}-${{ matrix.os }}-${{ runner.arch }}
120+
path: ps3dev-${{ matrix.os }}-${{ runner.arch }}.tar.gz
121+
122+
push_release:
123+
if: |
124+
github.event_name == 'push' &&
125+
github.repository == 'ps3dev/ps3toolchain'
126+
needs: build
127+
runs-on: ubuntu-latest
128+
permissions:
129+
contents: write
130+
steps:
131+
- name: Checkout
132+
uses: actions/checkout@v6
133+
134+
- name: Download artifacts
135+
uses: actions/download-artifact@v8
136+
with:
137+
path: artifacts
138+
merge-multiple: true
139+
140+
- name: Create Pre-Release
141+
env:
142+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
143+
run: |
144+
TAG="nightly-$(date -u +%Y-%m-%d)"
145+
gh release delete "$TAG" --yes --cleanup-tag || true
146+
gh release create "$TAG" artifacts/*.tar.gz --target ${{ GITHUB.SHA }} -t "$TAG" --prerelease

.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-python.sh

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

0 commit comments

Comments
 (0)