| 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. |
| 6 | set -e |
| 7 | PSL1GHT_REF=f649a08fd536a9e27c08c7db2d93a2d7ee4c3bbe |
| 8 | TOP=/opt/ps3 |
| 9 | REPO=$(cd "$(dirname "$0")/.." && pwd) |
| 10 | export PS3DEV=$TOP/ps3dev PSL1GHT=$TOP/ps3dev |
| 11 | export 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 |
| 15 | PY=$TOP/psl1ght-py |
| 16 | if [ ! -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" |
| 26 | fi |
| 27 |
|
| 28 | # the source, without the PC's line endings or its own build |
| 29 | rm -rf "$TOP/app" |
| 30 | mkdir -p "$TOP/app" |
| 31 | (cd "$REPO" && tar cf - --exclude=./build --exclude=./PS3World --exclude=./.git --exclude=./generator --exclude='./*.zip' .) | (cd "$TOP/app" && tar xf -) |
| 32 | find "$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$//' {} + |
| 33 | cd "$TOP/app" |
| 34 |
|
| 35 | # Mbed TLS for the PPU (once) and the root certificates |
| 36 | if [ ! -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" |
| 39 | fi |
| 40 | python3 tools/make-ca-bundle.py src/ps3/ca_bundle.h |
| 41 |
|
| 42 | ppu-gcc --version | head -1 |
| 43 | make -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 | } |
| 47 | grep -E 'warning' build.log | awk '!seen[$0]++' | head -20 || true |
| 48 | echo "r2off stubs (must be 0): $(ppu-nm build/ps3/ps3world.elf | grep -c r2off || true)" |
| 49 | make -f Makefile.ps3 MBEDTLS_DIR="$TOP/mbedtls" PS3PY_DIR="$PY/tools/ps3py" pkg > pkg.log 2>&1 || { tail -20 pkg.log; exit 1; } |
| 50 | for 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; } |
| 52 | done |
| 53 | mkdir -p "$REPO/PS3World" |
| 54 | cp build/ps3/ps3world.gnpdrm.pkg "$REPO/PS3World/PS3World.pkg" |
| 55 | ls -la "$REPO/PS3World/PS3World.pkg" |