From 68a05615fa3f4fd5d780fbd9e2d1b3e1257ddd15 Mon Sep 17 00:00:00 2001 From: jrg Date: Thu, 29 Oct 2026 08:39:21 -0500 Subject: [PATCH] template: `make pkg` packs the tarball; pkg/-.tar.gz, no arch The tarball is no longer part of the default build. `make` stops at dist/ (the BPF object + the bundle), which is all `yeet run` needs; `make pkg` packs dist/ into pkg/-.tar.gz on demand, with its own done row and artifact line. The arch suffix is dropped from the name: pkg/ holds one package per version. --- template/Makefile | 27 ++++++++++++--------------- template/README.md | 7 ++++--- template/build/ui.mk | 2 -- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/template/Makefile b/template/Makefile index e9a7615..691ff1c 100644 --- a/template/Makefile +++ b/template/Makefile @@ -4,7 +4,7 @@ # make bpf — compile bpf/*.bpf.c into dist/bin/probe.bpf.o only # make veristat — load the built object with veristat (verifier check on this kernel) # make bundle — bundle the JS entry with esbuild -# make tarball — pack dist/ into pkg/--.tar.gz, the shippable artifact +# make pkg — pack dist/ into pkg/-.tar.gz, the shippable artifact # make postgen — finalize a freshly generated project (git init) # make clangd — write a local .clangd pointing at the resolved toolchain # make clean — remove build artifacts @@ -34,15 +34,12 @@ BUILD_START := $(shell date +%s%N 2>/dev/null) # name); the directory name and 0.0.0 as fallbacks. NAME := $(or $(shell sed -n 's/^ "name": "\(.*\)",$$/\1/p' package.json),$(notdir $(CURDIR))) VERSION := $(or $(shell sed -n 's/^ "version": "\(.*\)",$$/\1/p' package.json),0.0.0) -# The BPF object is compiled for one target arch, so the package is named by -# it too (UNAME_M from build/toolchain.mk: x86_64 or aarch64). -TARBALL := pkg/$(NAME)-$(VERSION)-$(UNAME_M).tar.gz +TARBALL := pkg/$(NAME)-$(VERSION).tar.gz -all: bpf bundle tarball +all: bpf bundle $(call done,$(NAME)) $(call artifact,$(BPF_OUT)) $(call artifact,dist/index.js) - $(call artifact,$(TARBALL)) # Bundle the entry with the vendored esbuild. esbuild honors tsconfig `paths` # (so `#/` resolves at bundle time), while `yeet:*` builtins and `*.bpf.o` @@ -71,15 +68,15 @@ bundle: | toolchain $(call step,bundle,dist/index.js,$(ESBUILD) src/main.jsx $(ESBUILD_FLAGS) --log-level=warning '--external:yeet:*' '--external:*.bpf.o') # The shippable artifact: all of dist/ (index.js + bin/) as -# pkg/--.tar.gz. Entries are relative (./index.js, +# pkg/-.tar.gz. Entries are relative (./index.js, # ./bin/probe.bpf.o), so it unpacks into any directory you choose, and -# `yeet run .` there runs it. pkg/ holds one package per version and arch -# built; bump "version" in package.json to cut a new one. -tarball: bpf bundle | pkg - $(call step,tarball,$(TARBALL),tar -czf $(TARBALL) -C dist .) - -pkg: - $(Q)mkdir -p pkg +# `yeet run .` there runs it. Not part of the default build — `yeet run` +# needs only dist/ — so it's a separate target. pkg/ holds one package per +# version built; bump "version" in package.json to cut a new one. +pkg: bpf bundle + $(call step,pkg,$(TARBALL),mkdir -p pkg && tar -czf $(TARBALL) -C dist .) + $(call done,$(NAME)) + $(call artifact,$(TARBALL)) # Post-generation finalize: initialize a git repository with the vendored git # (fetched via `vendored-git`). Idempotent — skipped if this is already a repo. @@ -102,4 +99,4 @@ clean: clean-bpf $(call status,clean,pkg) $(Q)rm -rf node_modules dist pkg -.PHONY: all bundle tarball clean postgen +.PHONY: all bundle pkg clean postgen diff --git a/template/README.md b/template/README.md index 9a6ff7b..7f6a81b 100644 --- a/template/README.md +++ b/template/README.md @@ -50,8 +50,8 @@ src/lib/format.js pure render helpers (rate, duration, heat color) src/bpf/cpusched.bpf.c sched_switch program + the runtime knob src/bpf/runqlat.bpf.c wakeup→on-CPU latency histogram dist/ build output: index.js + bin/probe.bpf.o — runs on its own (gitignored) -pkg/ dist/ packed for shipping as --.tar.gz - (from package.json); unpack anywhere, `yeet run .` (gitignored) +pkg/ dist/ packed for shipping as -.tar.gz + (`make pkg`); unpack anywhere, `yeet run .` (gitignored) .github/workflows/kernel-matrix.yml CI: verify the object across kernels build/verify-kernel.sh the in-VM gate that workflow runs ``` @@ -64,8 +64,9 @@ the `#/` root; `main.jsx` wires them together and owns input. ## Build & run ```sh -make # compile BPF + bundle JS + pack pkg/--.tar.gz +make # compile BPF + bundle JS into dist/ make V=1 # same, showing every command behind the status lines +make pkg # also pack dist/ into pkg/-.tar.gz for shipping yeet run . # runs the bundled dist/index.js (needs root for BPF) ``` diff --git a/template/build/ui.mk b/template/build/ui.mk index f3d96bc..5f9c54d 100644 --- a/template/build/ui.mk +++ b/template/build/ui.mk @@ -7,12 +7,10 @@ # ✔ runqlat .build/bpf/runqlat.bpf.o # ✔ link dist/bin/probe.bpf.o # ✔ bundle dist/index.js -# ✔ tarball pkg/myproject-0.1.0-x86_64.tar.gz # ✔ done myproject (0.66s) # # ==> dist/bin/probe.bpf.o (8.1kb) # ==> dist/index.js (15.5kb) -# ==> pkg/myproject-0.1.0-x86_64.tar.gz (9.2kb) # # Rows go to stderr, so the build's stdout stays clean for piping. While a # step runs, its row shows a spinner, then settles into the check. The