diff options
| author | YP3 Audiobook <noreply@example.invalid> | 2026-11-25 17:45:43 -0500 |
|---|---|---|
| committer | YP3 Audiobook <noreply@example.invalid> | 2026-11-25 17:45:43 -0500 |
| commit | 013e3857a1c6480dfd241fb14b36c55b0421939e (patch) | |
| tree | 59b3aa16d4f658eb7b76e5dfbc475c3a408507c7 /scripts | |
| download | yp3-audiobook-firmware-013e3857a1c6480dfd241fb14b36c55b0421939e.tar.gz | |
initial commit
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/build.sh | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..6b7ff67 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,79 @@ +#!/bin/sh +# Rebuild the firmware package from the sources in this repository: +# vendor/rockbox-822b9f5e.tar.xz upstream YP3 Rockbox (jaydens-tasty-slop/rockbox) +# patches/*.patch the audiobook changes +# vendor/yp3-assets-1.tar.xz themes and models the upstream build adds +# Downloaded: the Arm GNU toolchain (~150 MB), pinned by sha256 in the +# upstream tools/yp3/release.sh and cached in $YP3_CACHE; and rockslop's +# source at ROCKSLOP_COMMIT for its packager, packaging/mkpkg.py (or set +# MKPKG to a mkpkg.py you have). +# +# scripts/build.sh [VERSION] default VERSION: audiobook-dev +# +# Everything goes in build/ (not in git; safe to delete): +# build/rockbox/ the patched source, a git repository +# build/rockslop/ rockslop, for its mkpkg.py +# build/out/ the package: rockbox-yp3-VERSION.tar.xz (+ .sha256) +# Copy the package to release/ when it has been tested on a player. +# +# Needs: sh, tar, xz, bzip2, zip, git, make, gcc (host tools), perl, python3, curl. +set -eu +die() { echo "build.sh: $*" >&2; exit 1; } + +REPO=$(cd "$(dirname "$0")/.." && pwd) +VERSION=${1:-audiobook-dev} +UPSTREAM=822b9f5e999122bc25738fc9746bb7a17bb48fa6 +# Upstream's commit time: the build's SOURCE_DATE_EPOCH base +UPSTREAM_DATE="2026-11-21T18:01:21-0700" +ROCKSLOP_URL=https://github.com/jaydens-tasty-slop/rockslop.git +ROCKSLOP_COMMIT=8715cfc99d392de62dd30ce06dc9703098e22c0f +W=$REPO/build # keep short: see below +CACHE=${YP3_CACHE:-$HOME/.cache/yp3-audiobook} + +for t in tar xz bzip2 zip git make gcc perl python3 curl sha256sum; do + command -v "$t" >/dev/null || die "needs $t" +done +(cd "$REPO/vendor" && sha256sum -c --quiet SHA256SUMS) || die "vendor/ checksums" + +# The upstream build reaches the tree through a symlink and breaks +# ("Argument list too long") when it, or the output path, is long. +case ${#W} in [0-9]|[1-5][0-9]) ;; *) + die "repository path too long for the build (${#W} chars in $W): clone it to a shorter path" ;; +esac + +rm -rf "$W/rockbox" "$W/rockslop" "$W/out" "$W/s" +mkdir -p "$W/rockbox" "$W/rockslop" "$W/out" + +# upstream tree as a git repository (the build reads versions from git), +# then the patches on top +tar -xJf "$REPO/vendor/rockbox-822b9f5e.tar.xz" -C "$W/rockbox" +( + cd "$W/rockbox" + export GIT_AUTHOR_NAME=upstream GIT_AUTHOR_EMAIL=upstream@localhost + export GIT_COMMITTER_NAME=upstream GIT_COMMITTER_EMAIL=upstream@localhost + export GIT_AUTHOR_DATE=$UPSTREAM_DATE GIT_COMMITTER_DATE=$UPSTREAM_DATE + git init -q + git add -A + git commit -q -m "upstream jaydens-tasty-slop/rockbox $UPSTREAM" + git am -q --committer-date-is-author-date "$REPO"/patches/*.patch +) +# rockslop's packager (its package format is the one the flasher reads) +if [ -z "${MKPKG:-}" ]; then + git -C "$W/rockslop" init -q + git -C "$W/rockslop" fetch -q --depth 1 "$ROCKSLOP_URL" "$ROCKSLOP_COMMIT" || + die "could not fetch rockslop $ROCKSLOP_COMMIT (or set MKPKG)" + git -C "$W/rockslop" checkout -q FETCH_HEAD + MKPKG=$W/rockslop/packaging/mkpkg.py +fi +[ -f "$MKPKG" ] || die "no mkpkg.py at $MKPKG" + +echo "building $VERSION (log: $W/out/build.log)" +MKPKG=$(realpath "$MKPKG") \ +YP3_ASSETS="file://$REPO/vendor/yp3-assets-1.tar.xz" \ +YP3_ASSETS_SHA256=$(sed -n 's/ yp3-assets-1.tar.xz$//p' "$REPO/vendor/SHA256SUMS") \ +YP3_SRC_LINK="$W/s" YP3_CACHE="$CACHE" \ + "$W/rockbox/tools/yp3/release.sh" "$VERSION" "$W/out" + +echo +echo "package: $W/out/rockbox-yp3-$VERSION.tar.xz" +echo "check: tools/rockslop-cli check $W/out/rockbox-yp3-$VERSION.tar.xz" |
