55 lines2.9 KBShell
1#!/bin/sh
2# PS3 World's PKG in WSL, as the CI's "PS3 World EBOOT + PKG" job makes it (tools/wsl-toolchain.sh first):
3# wsl -d Ubuntu-24.04 -u root -- sh /mnt/g/ps3world-app/tools/wsl-build.sh
4# Built from a copy of the repo in /opt/ps3/app (the G: drive is slow from WSL); the PKG lands in
5# PS3World/PS3World.pkg, the same HEN-style (gnpdrm) package the CI publishes.
6set -e
7PSL1GHT_REF=f649a08fd536a9e27c08c7db2d93a2d7ee4c3bbe
8TOP=/opt/ps3
9REPO=$(cd "$(dirname "$0")/.." && pwd)
10export PS3DEV=$TOP/ps3dev PSL1GHT=$TOP/ps3dev
11export PATH="$PS3DEV/bin:$PS3DEV/ppu/bin:$PATH"
12[ -x "$PS3DEV/ppu/bin/ppu-gcc" ] || { echo "no toolchain: run tools/wsl-toolchain.sh first"; exit 1; }
13
14# PSL1GHT's pkg.py, and librsx rebuilt without IPA-RA (see the CI): once
15PY=$TOP/psl1ght-py
16if [ ! -e "$TOP/.done-ps3py" ]; then
17 [ -d "$PY" ] || git clone -q https://github.com/ps3dev/PSL1GHT "$PY"
18 git -C "$PY" checkout -q "$PSL1GHT_REF"
19 (cd "$PY/tools/ps3py" && python3 setup.py build -q && cp build/lib.*/pkgcrypt*.so .)
20 python3 -c "import sys; sys.path.insert(0, '$PY/tools/ps3py'); import pkgcrypt"
21 cd "$PY/ppu/librsx"
22 sed -i 's/-O2 -mregnames/-O2 -fno-ipa-ra -mregnames/' Makefile
23 grep -q fno-ipa-ra Makefile || { echo "librsx's Makefile changed: the -fno-ipa-ra patch didn't apply"; exit 1; }
24 make -s install
25 touch "$TOP/.done-ps3py"
26fi
27
28# the source, without the PC's line endings or its own build
29rm -rf "$TOP/app"
30mkdir -p "$TOP/app"
31(cd "$REPO" && tar cf - --exclude=./build --exclude=./PS3World --exclude=./.git --exclude=./generator --exclude='./*.zip' .) | (cd "$TOP/app" && tar xf -)
32find "$TOP/app" -type f \( -name '*.c' -o -name '*.h' -o -name '*.sh' -o -name '*.py' -o -name 'Makefile*' -o -name '*.txt' \) -exec sed -i 's/\r$//' {} +
33cd "$TOP/app"
34
35# Mbed TLS for the PPU (once) and the root certificates
36if [ ! -e "$TOP/mbedtls/library/libmbedtls.a" ]; then
37 sh tools/build-mbedtls.sh "$TOP/mbedtls" ppu-gcc ppu-ar \
38 "-O2 -mcpu=cell -mtune=cell -mno-altivec -mminimal-toc -fno-strict-aliasing -I$PSL1GHT/ppu/include -I$PS3DEV/ppu/include"
39fi
40python3 tools/make-ca-bundle.py src/ps3/ca_bundle.h
41
42ppu-gcc --version | head -1
43make -f Makefile.ps3 MBEDTLS_DIR="$TOP/mbedtls" -j"$(nproc)" self > build.log 2>&1 || {
44 grep -E 'error|undefined reference|multiple definition|No rule|Error [0-9]' build.log | awk '!seen[$0]++' | head -60
45 exit 1
46}
47grep -E 'warning' build.log | awk '!seen[$0]++' | head -20 || true
48echo "r2off stubs (must be 0): $(ppu-nm build/ps3/ps3world.elf | grep -c r2off || true)"
49make -f Makefile.ps3 MBEDTLS_DIR="$TOP/mbedtls" PS3PY_DIR="$PY/tools/ps3py" pkg > pkg.log 2>&1 || { tail -20 pkg.log; exit 1; }
50for f in USRDIR/EBOOT.BIN USRDIR/data/fonts/Poppins-Regular.ttf USRDIR/data/logo.png USRDIR/data/backdrop.png USRDIR/data/licenses/GPL-2.0.txt PIC1.PNG ICON0.PNG; do
51 [ -e "build/ps3/package/pkg/$f" ] || { echo "missing from the PKG: $f"; exit 1; }
52done
53mkdir -p "$REPO/PS3World"
54cp build/ps3/ps3world.gnpdrm.pkg "$REPO/PS3World/PS3World.pkg"
55ls -la "$REPO/PS3World/PS3World.pkg"