| 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. |
| 6 | set -e |
| 7 | PS3TOOLCHAIN_REF=de85d7d5d11dc0a99d823ece3d440eea46c34d0f # (as .github/workflows/ps3.yml) |
| 8 | PSL1GHT_REF=f649a08fd536a9e27c08c7db2d93a2d7ee4c3bbe |
| 9 | TOP=/opt/ps3 |
| 10 | export PS3DEV=$TOP/ps3dev PSL1GHT=$TOP/ps3dev BUILD_PS3TOOLCHAIN_ONLY=1 NO_SAVANNAH=1 |
| 11 | export PATH="$PS3DEV/bin:$PS3DEV/ppu/bin:$PS3DEV/spu/bin:$PATH" |
| 12 | mkdir -p "$TOP/logs" "$PS3DEV" |
| 13 | step() { echo "== $(date +%H:%M) $1"; } |
| 14 |
|
| 15 | step "build requirements" |
| 16 | apt-get update -qq |
| 17 | DEBIAN_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 |
|
| 22 | step "ps3toolchain and PSL1GHT sources" |
| 23 | [ -d "$TOP/ps3toolchain" ] || git clone -q https://github.com/ps3dev/ps3toolchain "$TOP/ps3toolchain" |
| 24 | git -C "$TOP/ps3toolchain" checkout -q "$PS3TOOLCHAIN_REF" |
| 25 | [ -d "$TOP/psl1ght" ] || git clone -q https://github.com/ps3dev/PSL1GHT "$TOP/psl1ght" |
| 26 | git -C "$TOP/psl1ght" checkout -q "$PSL1GHT_REF" |
| 27 |
|
| 28 | cd "$TOP/ps3toolchain" |
| 29 | if [ ! -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" |
| 33 | fi |
| 34 | # binutils and GCC + newlib for the PPU, its symlinks, then the same for the SPU (a step done is skipped next time) |
| 35 | for 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" |
| 40 | done |
| 41 |
|
| 42 | if [ ! -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" |
| 46 | fi |
| 47 | step "done: $(ppu-gcc --version | head -1)" |