Each fork kept a recipe beside its source and a tarball in distfiles/ whose
distinfo had to be regenerated after every commit (tools/ext-dist.sh,
tools/mcde-dist.sh), and the work directory of a build could not see a later
commit at all (tools/ext-resync.sh merged an archive into it). Three tools,
one artefact per fork in git, and the failure mode that cost the 2026-11-23
release: mcde 288d1383 built from the commit of the day before, because the
recipe's mtime said "not stale".
Now the recipe builds the source tree itself, which is how pkgsrc's own
net/fetch and pkgtools/pkg_install do it: DISTFILES= # empty, do-extract
fills WRKSRC. What is gone with that:
- the tarballs (distfiles/{mcde,splinter,junction,wikid,skilld,memoryd,
tasksd}-*) and their .key
- tools/ext-dist.sh, tools/mcde-dist.sh, tools/ext-resync.sh and its test
- fork_archives in tools/makronix-distfiles.sh (nothing to fetch or stage)
- the distinfo files of the eight recipes
What replaces it: tools/ext-extract.sh, called from do-extract. It hashes
the tree, copies only the files that differ, keeps the time stamp of the rest
(so a commit rebuilds what it touched and not 27 minutes of MCDE) and
removes the copy when a file left the tree. The build key of a fork carries
the source commit for the same reason: a commit does not change the recipe.
The recipes keep $Makronix$ as their header; afpfs-ng keeps its upstream
$NetBSD: ...$ line and its real distfile, and fork_src() leaves it alone.
Verified:
- bmake package built all eight recipes from the tree with no distinfo:
splinter, junction, wikid, skilld, memoryd, tasksd, mcde (16 MB), and
mcde-motif's shared tree
- tools/test-tools.sh: 38 ok, 0 bad (5 new cases for ext-extract.sh)
- tools/makronix-distfiles.sh check: 0 missing, 0 wrong hash
- tools/makronix-pins.sh check: PINS matches
9.8 KiB
tools/ -- scripts around the build
What it is for
The scripts the root Makefile targets call, and the helpers for tests,
media, the source sets and MCDE. Building is cross and native, never in a VM;
a VM is only for testing installs and upgrades (root AGENTS.md).
What is in it
All scripts are POSIX sh; each one's header says usage and purpose, read it
before running it.
Build and release (called by make):
build-stamp.sh-- content key of the sources;make isoruns it with-c(check only),make build|releasewithout (removes the derived artefacts when the key changed, so after a source changemake releaseis needed). It writesbuild/objand refuses to run outside the build lock.build-lock.sh 'command'-- one build at a time in the tree. The root Makefile'sbuild,release,stamp,iso,usb,sourcesets,tools,kernel,userland,clean-sanity,cdtest,compress,test,install,isosrc,mcde-linuxandmcde-hosttake it. A second build is refused with the holder's pid; a stale lock (dead pid, or a pid reused after reboot, detected by the stored start time) is taken over. The lock is re-entrant (BUILD_LOCK_HELD), somake cdtestholds it across release, iso and the VM test.--heldis the guard for tools that writebuild/objorreleasedir:build-stamp.sh,cd2.sh,cd3.sh,cd-source.sh,images.sh,srctree-stage.sh,userland.sh,mcde-linux.shandmcde-host.shrefuse to run outside the lock; start them through make ortools/build-lock.sh '...'. Tests (test.sh,mediacheck.sh,install-simple.sh,install-cgd.sh,mcde-tests.sh) callbuild-lock.sh --check: they refuse to start beside a build, and--checkpasses when the caller is inside the lock (make test/make cdtest). The reason is t0286:clean_METALOGmovesMETALOG.sanitisedtoMETALOGwhile a concurrent build'scopy-releasedirstill needs it, and the error looks like a missing file in the CD staging.pkgsrc-cross.mk.conf-- the pkgsrc cross configuration (rootAGENTS.md).makronix-set.sh-- themakronixset list and METALOG records from the installed/usr/pkg.userland.sh(make userland) -- buildspackages.list, cross or native as the host is;pkglist.shis the one reader of that list (kinds: set, repo, fetch, games;@ARCH).ext-sync.sh-- the recipe of a fork inext/, made visible inside pkgsrc (a mirror of symlinks; the recipe builds the source tree itself, no archive).ext-resync.sh-- a new archive of a fork changes only the files that differ in the work directory (.pristineis the archive pkgsrc extracted);userland.shcalls it, and falls back tobmake cleanwhen it says no (a file pkgsrc changed, no work directory)..pristineis kept after a failed build too, so an error does not mean a build from nothing; a changed recipe drops pkgsrc's cookies fromdependson (fork_reconfigure) and keeps sources and objects. Never delete a fork's work directory by hand: that is hours of MCDE.check-buildtools.sh-- after a cross build, checks that the programs a fork builds and runs while building (tradcpp, makestrs, wml ...) are host binaries;userland.shruns it before the set is written (t0197).mcde-plist.sh LOG-- puts the files that the PLIST check of wm/mcde reports intoext/src/mcde/pkgsrc/PLIST.keep-images.sh [-n N] NAME-- copies the install images tobuild/keep-NAME/before the nextmake releaseremoves the release directory; keeps NAME and the newest N (by time, default 1: one 10 GB medium is enough)build/keep-*, removes the older ones.pkg-binaries.sh-- fetch the NetBSD project's binary packages.images.sh--unpack|pack|sumsof the install images (make usb,make compress); images stay raw unless packing is asked for.cd2.sh,cd3.sh,cd-com0.sh-- the second and further install CDs (cd3: packages in dependency order,desktop.list/games.listper medium for sysinst) (make iso), and a CD copy whose loader talks oncom0.makronix-distfiles.sh,makronix-pins.sh,srctree-stage.sh-- the source set (make sourcesets,docs/OFFLINE-BUILD.md);cd-source.sh-- the source DVD (make isosrc).
Tests (they run VMs; docs/PLATFORMS.md):
test-tools.sh-- tests for the build tools (pkglist, makronix-set, keep-images, mxupgrade, ext-resync), no network, no build; run first bymake test.test-ext-resync.sh [SCRIPT]-- the cases ofext-resync.shin a scratch tree with a stand-in bmake (changed, unchanged, stale.pristine, pkgsrc-changed, removed, configure.ac);test-tools.shruns it.mcde-tests.sh-- the unit tests of MCDE (libMcdeSys, libDtSvc, libDtWidget, the plain-C parts of dtbar/dtlaunch/dtsystemsettings/dtterm), from a native build of this host; run bymake testbefore the release tests.vmsh.sh-- a QEMU machine on a serial console driven fromsh; state inbuild/vmsession/. The VM driver to use.vm-boot-iso.sh,vm-screendump.sh-- boot an image once, log the serial console or save the screen. A UEFI boot is judged on the SCREEN (-U stick), never on the serial line: after efiboot the kernel's console is the framebuffer, so a serial log ends at efiboot's:-(although the boot goes on (the stick was thought not to boot under OVMF until 2026-11-17,t0086).write-stick.sh-- an image to a USB stick, guarded; afterwards the backup GPT is moved to the end of the device (fdisk) and the stale one in the image area is zeroed.install-simple.sh,install-cgd.sh-- end-to-end installation tests.test-desktop-login.sh-- boots an installed disk and logs in at dtlogin: the user name and the password are typed through the QEMU monitor (the greeter is on the framebuffer, the serial console cannot reach it), then dtsession, dtwm, dtbar, mcdesoundd, ttsession and rpcbind are checked from a root shell on the serial console; the screen is saved to build/logs/desktop-login-.png.-kkeeps the machine running.test.sh(make test),mediacheck.sh-- the tests of a release.devvm.sh,host-nfs-setup.sh-- the kept VM ofdocs/BUILD-VM.md.
MCDE and the logo:
mcde-host.sh(make mcde-host),mcde-linux.sh(make mcde-linux),mcde-shot.sh-- MCDE on this host, and screenshots.mcde-keytest.sh-- tries the shortcuts ofdocs/reference/shortcuts.txton a private X display (t0058; dtwm keys need a working dtwm, t0216).mcde-desktop.sh-- starts MCDE through dtlogin on a private Xvfb display, logs in as $USER, and runs a control script (wait/shot/type/key/click/move/run/ focus/close/exit) to take targeted screenshots for the website; backs up and restores $HOME/.dt and /etc/pam.d/dtlogin. Hazard: for the length of the run the HOST's dtlogin service is pam_permit (sudo); the trap that puts it back is set before the switch.mcde-desktop-webshots.cmdsis the script for the website's pictures (raw shots inwww/screenshots/, not tracked; the kept ones are copied towww/img/).dtlogin-check.sh-- the INSTALLED package (make debian-install, /usr/mdt with /etc/mdt) through dtlogin: greeter, login, session, front panel.mcde-desktop.shdoes that for the dev tree; this is the path of a package user, which the tree never exercises. Runs on:94, exit 0 means the front panel'sApplicationsmenu was in the window tree. Hazard, likemcde-desktop.sh:/etc/pam.d/dtloginis pam_permit for the length of the run (sudo). Two things it must do in the right order, both learned the hard way: kill the display's dtlogin and its Xvfb BEFORE putting$HOME/.dtback (dtsession writessessions/currentanderrorlogwhile it dies, and a copy restored too early is written over), and rolldtlogin.logbefore the run (a previous run'sGreeter startedsatisfies the wait loop and the test then measures a display that never came up).-acon the Xvfb line is not optional: dtlogin starts the server asnobodyand nothing can look at it otherwise.mcde-xkey.sh-- presses keys by their plain keycodes (XTest),mcde-xkey.sh Super_L h;xdotool key F8on Xvfb sends Alt+F8 (header of the script).logo-ascii.sh,theme-logo.sh-- the logo as ASCII, and in a palette's colours (docs/logo/AGENTS.md).
claude-build-gate.sh -- build gate that enforces the forbidden commands
(root AGENTS.md). Its match is textual: a command that
names releasedir and performs hand work on it (rm, mv, cp, touch,
chmod, mkdir, sed -i, tee, or a shell redirection whose target path is
under releasedir) is refused. A read-only command that only redirects
stderr/stdout (such as 2>&1) is allowed.
claude-build-gate-test.sh -- POSIX-sh test cases for the hook.
Legacy, still here for the test VM only: devvm.sh and vm-boot.cfg
(docs/BUILD-VM.md). Building in a VM is gone: vmbuild/, packages.vm.list,
vm-pkgbuild.sh and vm-pkgcollect.sh were removed on 2026-11-13; the unused
Python drivers vmctl.py and vmmon.py were removed later (no longer called by
the tree). Do not extend the drivers and do not describe them as the way to
build.
What may be changed
Anything here, freely, as long as it stays POSIX sh (check with dash -n)
and its header and this list stay true. A script that gains or loses a job
changes here in the same commit.
What must not be touched
- No script builds by a path the root
Makefiledoes not name, and none writes under the release directory by hand. - No Python, no unattended loops or timers (root
AGENTS.md, "Forbidden"). - Writing an install stick is not in the tree: check
lsblkfirst (a name that is not a block device makesddwrite a plain file into /dev) and read the stick back twice before it goes to a machine.