47 lines2.1 KBShell
1#!/bin/sh
2# The PS3 toolchain and PSL1GHT in WSL (Ubuntu 24.04), as the CI's "PS3 toolchain" job builds them,
3# for building on the PC: tools/wsl-build.sh then makes the PKG. Once only (1-3 hours); run as root:
4# wsl -d Ubuntu-24.04 -u root -- sh /mnt/g/ps3world-app/tools/wsl-toolchain.sh
5# Everything goes in /opt/ps3 (PS3DEV=/opt/ps3/ps3dev); a log of each step in /opt/ps3/logs.
6set -e
7PS3TOOLCHAIN_REF=de85d7d5d11dc0a99d823ece3d440eea46c34d0f # (as .github/workflows/ps3.yml)
8PSL1GHT_REF=f649a08fd536a9e27c08c7db2d93a2d7ee4c3bbe
9TOP=/opt/ps3
10export PS3DEV=$TOP/ps3dev PSL1GHT=$TOP/ps3dev BUILD_PS3TOOLCHAIN_ONLY=1 NO_SAVANNAH=1
11export PATH="$PS3DEV/bin:$PS3DEV/ppu/bin:$PS3DEV/spu/bin:$PATH"
12mkdir -p "$TOP/logs" "$PS3DEV"
13step() { echo "== $(date +%H:%M) $1"; }
14
15step "build requirements"
16apt-get update -qq
17DEBIAN_FRONTEND=noninteractive apt-get -y -qq install \
18 autoconf automake bison flex gcc g++ libelf-dev make texinfo \
19 libncurses-dev patch python3 python-is-python3 python3-dev python3-setuptools \
20 wget zlib1g-dev libtool-bin bzip2 libgmp-dev pkg-config libssl-dev git ca-certificates >/dev/null
21
22step "ps3toolchain and PSL1GHT sources"
23[ -d "$TOP/ps3toolchain" ] || git clone -q https://github.com/ps3dev/ps3toolchain "$TOP/ps3toolchain"
24git -C "$TOP/ps3toolchain" checkout -q "$PS3TOOLCHAIN_REF"
25[ -d "$TOP/psl1ght" ] || git clone -q https://github.com/ps3dev/PSL1GHT "$TOP/psl1ght"
26git -C "$TOP/psl1ght" checkout -q "$PSL1GHT_REF"
27
28cd "$TOP/ps3toolchain"
29if [ ! -e "$TOP/.downloaded" ]; then
30 step "toolchain downloads"
31 mkdir -p build && (cd build && ../download.sh) > "$TOP/logs/download.log" 2>&1
32 touch "$TOP/.downloaded"
33fi
34# binutils and GCC + newlib for the PPU, its symlinks, then the same for the SPU (a step done is skipped next time)
35for s in 001 002 004 005 006; do
36 [ -e "$TOP/.done-$s" ] && continue
37 step "toolchain step $s (log: $TOP/logs/$s.log)"
38 ./toolchain.sh $s > "$TOP/logs/$s.log" 2>&1
39 touch "$TOP/.done-$s"
40done
41
42if [ ! -e "$TOP/.done-psl1ght" ]; then
43 step "PSL1GHT"
44 (cd "$TOP/psl1ght" && make install-ctrl && make && make install) > "$TOP/logs/psl1ght.log" 2>&1
45 touch "$TOP/.done-psl1ght"
46fi
47step "done: $(ppu-gcc --version | head -1)"