Repository navigation
feat(targets): install target toolchains with pocket target add - #594
Merged
Merged
Conversation
HalfSweet
force-pushed
the
feat/target-install
branch
from
October 19, 2026 07:08
10dcf5d to
ef7e8ca
Compare
HalfSweet
force-pushed
the
feat/cli-target-selection
branch
from
October 19, 2026 07:08
84d1e11 to
542d50e
Compare
HalfSweet
force-pushed
the
feat/target-install
branch
from
October 19, 2026 07:28
ef7e8ca to
9b1002f
Compare
HalfSweet
force-pushed
the
feat/cli-target-selection
branch
from
October 19, 2026 07:28
542d50e to
21332cc
Compare
HalfSweet
force-pushed
the
feat/target-install
branch
from
October 19, 2026 07:35
9b1002f to
5beef3d
Compare
HalfSweet
force-pushed
the
feat/cli-target-selection
branch
from
October 19, 2026 07:35
21332cc to
6768188
Compare
HalfSweet
force-pushed
the
feat/target-install
branch
from
October 19, 2026 07:49
5beef3d to
159229e
Compare
HalfSweet
force-pushed
the
feat/cli-target-selection
branch
from
October 19, 2026 07:49
6768188 to
7a87fb1
Compare
The framework pinned the PSP toolchain in tools/cli/psp-toolchain.json, which the CLI tarball also carried, so pocket doctor checked the CLI's pins rather than the pins of the framework that builds. tools/bootstrap.ts installed into per-tool cache paths, and a PSP build compiled QuickJS with whatever clang it found; Homebrew's LLVM 23 fails the link. pocket target add|list|remove installs the toolchains the framework pins in tools/targets/<id>.toolchain.json (pocket-toolchain/2: rustup, archive, file and cargo-install components). Each component stages under <cache>/tmp, is checked against its SHA-256, and publishes by rename to <cache>/store/<component digest>; the install record <cache>/targets/<id>/<toolchain digest>.json names what a build reads. A component digest covers its pin, so equal pins share one store entry; a pin change gives a new toolchain digest and a new record. Archive entries and links that leave the directory are rejected. A second add downloads nothing. - pocket build for a target with a manifest stops before type checking when its toolchain is not installed, outdated or broken, naming `pocket target add <id>`, and holds the record shared until the backend finishes; remove waits for it. pocket show prints every target's state; pocket target list --check gates CI on the project's targets. - The PSP manifest pins nightly-2026-05-28 with rust-src, cargo-psp, the SDK release, and libquickjs-mipsel-sony-psp.a from pocket-nexus/quickjs-rs prebuilt-psp-a5cac5d8631b. hosts/psp links libquickjs-sys at a5cac5d and tools/psp.ts sets QUICKJS_PREBUILT_LIB: a PSP build runs no C compiler and installs on Linux as well as macOS. Every path comes from the record. - pocket doctor, pocket setup, tools/bootstrap.ts and the CLI's psp-toolchain.json are removed; `bun run pocket target add psp` replaces `bun run bootstrap` in a checkout. - .github/workflows/psp-build.yml installs the PSP toolchain into an empty cache on Ubuntu and macOS and builds hero with the target C compiler set to /usr/bin/false.
HalfSweet
force-pushed
the
feat/target-install
branch
from
October 19, 2026 07:57
159229e to
b8f1a92
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #593.
Why
The framework pinned the PSP toolchain in
tools/cli/psp-toolchain.json, a copy of which also shipped in the CLI tarball, sopocket doctorchecked the CLI's pins instead of the pins of the framework doing the build.tools/bootstrap.tsinstalled into per-tool cache paths with tool-specific receipts. A PSP build also took whateverclang/llvm-arit found. With Homebrew's LLVM 23 every QuickJS object fails to link (floating point ABI '-msingle-float' is incompatible with target floating point ABI '-mdouble-float'), and nothing pinned a working version.What
pocket target add|list|remove: an install engine for the toolchains the framework pins (tools/targets/).pocket-toolchain/2) live beside the catalog. The component kinds arerustup(a version or dated channel, neverstable),archive(zip/tar, SHA-256, root, markers),file(SHA-256) andcargo-install(git revision).<cache>/store/<component digest>/{receipt.json,tree/}, with install records at<cache>/targets/<id>/<toolchain digest>.json.<cache>/tmpand publishes by rename.adddownloads nothing.add/removetake it exclusive and a build takes it shared, soremovewaits for a running build;addholds it shared and prune takes it exclusive, so a prune never deletes what an unfinishedaddpublished.withArtifactLock/publishStagedDirectorymove totools/targets/lock.ts.pocket buildfor a target that has a manifest stops before type checking when the record isnot installed,outdated(installed for another framework version's digest) orbroken(a store entry or rustup toolchain is gone), and namespocket target add <id>.pocket showprints each target's state.pocket target list --checkexits 1 unless every target inpocket.config.tsis ready.web-app,macos-app,linux-appandmacos-widgethave empty manifests. Targets whose scripts still install their own tools showno manifestuntil their own PRs.PSP:
tools/targets/psp.toolchain.jsonpins four components:nightly-2026-05-28+rust-src;2cbaf8c9;libquickjs-mipsel-sony-psp.afrom pocket-nexus/quickjs-rsprebuilt-psp-a5cac5d8631b(feat(libquickjs-sys): link a prebuilt PSP library and publish one from CI quickjs-rs#8).hosts/psplinks libquickjs-sys ata5cac5d, andtools/psp.tssetsQUICKJS_PREBUILT_LIB. A PSP build runs no C compiler: no LLVM requirement, noTARGET_CC/TARGET_CFLAGS/AR_mipsel_sony_psp. The PSP toolchain now installs on Linux as well as macOS.PSP_SDK/PSPDEV/POCKETJS_LLVM_BINno longer select tools; every path comes from the record.Removed:
pocket doctor,pocket setup,tools/bootstrap.ts,bun run bootstrap, andtools/cli/psp-toolchain.json; the CLI carries no pins. In a checkout,bun run pocket target add pspreplacesbun run bootstrap.CI:
.github/workflows/psp-build.ymlruns on Ubuntu 24.04 and macOS:pocket target add pspinto an empty cache;addthat must not download;pocket +psp buildof hero withTARGET_CC/CC_mipsel_sony_psp/ARset to/usr/bin/false.Validation
PSP build workflow on this PR: green on both runners (run):
target add pspinto an empty cacheaddpocket +psp build(C compiler/usr/bin/false)cargo install cargo-psp, SDK 157 MB, QuickJS 1.5 MB); toolchain616351b5The SDK and QuickJS store digests on Linux (
ad0880352fff,afca6a7ff64d) equal the ones on macOS; cargo-psp's digest includes the host.Local, macOS arm64:
POCKET_NEXUS_CACHE_DIR=/tmp/… bun run pocket target add pspfinished in 32 s. Store entries: SDK 386 MB, cargo-psp 5.4 MB, QuickJS 1.4 MB. Toolchain9fc39642. A secondaddprinted every component as installed and downloaded nothing.pocket +psp build --manifest apps/hero/pocket.json --project-root . -- --releasewithTARGET_CC,TARGET_AR,CC_mipsel_sony_pspandAR_mipsel_sony_psppointing at a program that exits 97.libquickjs-syscompiled ata5cac5dand linked the prebuilt archive; the EBOOT is 3 752 847 bytes, and the fake tools were never called. Not run on PPSSPP.+psp buildandbun tools/psp.ts herostop withtarget psp is not installed for @pocketjs/framework 0.14.0 (toolchain 9fc39642) / run: pocket target add psp;brokennames the missing entry;target remove pspdeleted the record and pruned both orphaned store entries.tests/targets-install.test.ts(19) uses a local HTTP server, ustar archives the test writes itself (../entries, links that leave the directory), and a fake rustup. It covers:tests/targets-psp.test.ts(5):hosts/psp/Cargo.tomlandCargo.lock;QUICKJS_PREBUILT_LIBand no C toolchain variables.bun run e2e:install: 4 ok. The newpocket target list --checkstep passes from the read-only installed framework.bun tools/test.ts, stage by stage: every stage passes except unit, which has 1097 passing and 1 failing. The failure is--strict-classes fails on the ones in a class attribute; it also fails locally on main and passes in CI.tsc --noEmit: only the existing errors intests/runtime-glyphs.test.tsandtests/pocket3d-icon.test.ts.Not in this PR
pocket component add|list|remove: no target has arunordeploycomponent until the run/deploy backends land.git,container,providedandderivedcomponents;target add --verify.tests/psp-prx.test.ts's opt-in link test now needsPOCKETJS_LLVM_BINforclang, which assembles its fixture; PSP builds no longer use clang.