Skip to content

Build for 33 targets with mcpp, graded by level, on all eleven systems the project lists - #1

Open
Sunrisepeak wants to merge 55 commits into
mainfrom
mcpp-openkal-platforms
Open

Sunrisepeak wants to merge 55 commits into
mainfrom
mcpp-openkal-platforms

Conversation

@Sunrisepeak

@Sunrisepeak Sunrisepeak commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

简介 / Summary

用 mcpp(2026.11.22.1)在一台机器上为 33 个目标构建 cmd.exe 与 COMMAND.COM,CI 在 README 列出的全部 11 个系统上运行解释器(Linux、Windows、MSYS2/MinGW、macOS、FreeBSD、NetBSD、OpenBSD、Haiku、GNU/Hurd、PureDarwin、System V),并新增 Windows MSVC、Android、WebAssembly(含在线试用页)、openkal 映像、UEFI 与 MS-DOS。现有构建方式均不受影响。

With mcpp (2026.11.22.1), one machine builds cmd.exe and COMMAND.COM for 33 targets. CI runs the interpreter on all eleven systems the README lists, and adds Windows MSVC, Android, WebAssembly (with a playground), openkal images, UEFI and MS-DOS. The existing builds are unchanged.

按能力分级 / Graded by what a system offers

test.bat 分三段:L0 解释器本身,L1 文件,L2 启动程序。每个目标在 .github/mcpp/floor.txt 中有最低级别,低于即失败;实际达到的级别写进运行摘要,平台补上能力后自动显示。The script has three parts: L0 the interpreter alone, L1 files, L2 starting a program. Each target has a floor in floor.txt; a run below it fails, and the level reached is reported, so a capability a platform gains shows by itself.

级别 / Level 目标 / Targets
L2 (26) Linux gnu/musl (x86_64, aarch64, i686), Windows MinGW and MSVC (x86_64, aarch64, i686), macOS (incl. PureDarwin), FreeBSD (also over openkal-musl), NetBSD, OpenBSD, GNU/Hurd, Haiku, System V R4, Android x86_64, openkal images x86_64/aarch64
L1 (6) WebAssembly (no processes; node and the page), UEFI and openkal DOS (no program start yet), DJGPP (no fork or posix_spawn), x86_64-windows-musl (POSIX names), i686-openkal (mcpplibs/openkal-image#46); the openkal package in FreeBSD (#47)
built (1) aarch64-linux-android

完整表格与原因见 / The full table and the reasons: mcpp/README.md.

改动 / Changes

  • 源码 / Sources (POSIX only, C89, tlint.sh): the l-layer for musl, DJGPP and Emscripten; lexec.c uses posix_spawn where fork reports ENOSYS; lselfpath.c prefers argv[0] naming a path, so %COMSPEC% is the interpreter even when a loader started it (ld.so, okrun); cinterp.c opens a batch file in binary mode.
  • mcpp.toml, build.mcpp: the openkal platform named once, as the 0.31 series (cfg(any(env = "musl", os = "openkal", os = "uefi"))); the System V and PureDarwin runners; output names; the web build.
  • CI (.github/workflows/mcpp.yml, .github/mcpp/): one line of data per target; check.sh grades each run; a pty prompt test; Chrome; Pages and a preview per pull request.
  • 网页 / Web page (mcpp/web.html): the playground is also the project's home page — what cmd is, a language button (English / 中文), cmd's message language (LANG), and a picker of system × arch × variant that gives each target's level and its mcpp commands. Deployed to GitHub Pages from main (chenpi11.github.io/cmd); one-time setting: Settings → Pages → Deploy from branch gh-pages.
  • 发布 / Release (.github/workflows/release.yml, run by hand): checks the version against tpack.sh and mcpp.toml (now 1.0.0), builds and runs all 33 targets through mcpp.yml, and publishes only if all pass. Files: the programs as built (<target>-cmd.exe, <target>-COMMAND.COM, as in the 1.0.0 release), mcpp's package per target, the web page and the openkal package (input assets: both, bare or pack), and tpack.sh's source archives. A program built elsewhere (MSYS2, i686 GNU/Hurd) is added with gh release upload. Verified as a draft on this fork (130 files, run 45059073017), then deleted.
  • 文档 / Docs: the README links the page after the tagline (all four translations); its mcpp section is three commands and a link; mcpp/README.md (and README.zh_CN.md) is the build guide.

验证 / Verification

  • CI run 45062610086 (head cd6ee00): every job passes (Pages is skipped for a pull request). A machine that does not finish booting within dirun's limit is booted once more; nothing else retries.
  • make CFLAGS="-std=c89 -pedantic -Wall -Wextra -O2": the same two warnings as main (lterm.c).

生态侧尚缺的行与能力(riscv64-linux-musl、wasm32-wasi、iOS 模拟器、裸机 openkal 行、UEFI/DOS 启动程序)汇总在 mcpp-community/mcpp#1005;补齐后此处只需加一行或无需改动。Rows and capabilities the ecosystem has yet to supply are collected in mcpp-community/mcpp#1005; each is one line here, or none, once supplied.

mcpp.toml states the rows the openkal platform and the DJGPP platform serve
beyond mcpp's built-in table (i686 Linux, the i386 openkal image, UEFI, DOS),
the musl define for the FreeBSD and macOS rows, the Emscripten flags, and the
System V shims for DJGPP.  mcpp/cmd.rc is cmd.rc without its winres.h include,
so the version resource also compiles for the UEFI row.

Sources: lselfpath.c skips sysctl and _NSGetExecutablePath under musl;
glibcmd.h, lreadline.c, llinenoise.c and lsysport.c build where SIGTSTP,
<sys/select.h>, EWOULDBLOCK and clock_settime are absent (DJGPP).  Every other
build is unchanged.

README: the mcpp section lists each target with its build command.
mcpp.toml states the rows platform packages serve as one [target] table and
keeps its comments short. The README's table opens from one sentence.

.github/workflows/mcpp.yml builds every target in the table. Linux x86_64 and
arm64, macOS and Windows build and run on the machine itself; the others are
built on Linux and run on Windows arm64, macOS x86_64, FreeBSD (x86_64 and
aarch64), the Android emulator, DOSBox and UEFI firmware, or are only built.
Each run of .github/mcpp/test.bat is compared with .github/mcpp/expected.txt.
…s under node.

build.mcpp states the Emscripten link: node's file system by default, and with
the web profile an in-memory file system and a module that mcpp/web.html
starts.  mcpp's dist-web plugin packs that page and the program as a web
directory (mcpp pack cmd.exe --profile web --target wasm32-emscripten
--pkg-format web).

llinenoise.c: Emscripten accepts tcsetattr() but has no raw mode, so Enter
arrived as '\n' inside the edited line and no typed command ever ran; lines
are now read whole there, as on an unsupported terminal.

The workflow types lines at the prompt of the Linux and node builds, runs the
web directory in Chrome and, on main, publishes it to GitHub Pages.  The
README states what each target was verified to do.
The page shows why it cannot start instead of failing silently: opened
from disk, a browser refuses to fetch the .wasm, and the page says how to
serve the directory.  Standard input reads end of file, so set /p and
pause no longer open a browser dialog.
…arm64.

The Windows arm64 run had not finished after 40 minutes; the probe starts
the program with /c ver and standard input closed first.
@Sunrisepeak Sunrisepeak changed the title Build for 21 targets with mcpp and openkal Build for 22 targets with mcpp and openkal, with CI and a web playground Nov 15, 2026
The interpreter starts there, and the script stops without output.
…rm64.

CALL saves its return point with ftell() and EXIT /B restores it with
fseek().  In text mode the Windows C runtime miscounts ftell() on a file
whose lines end in LF alone, so EXIT /B returned to the CALL line and the
script never ended.  The line readers already strip the CR of CR LF.

The workflow runs the script with both line endings on every native
target, and drops the per-command probe.
…I runs test.bat with its arguments, the machine runners are enabled on request
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.2

QR code for preview link

🚀 View preview at
https://Sunrisepeak.github.io/cmd/pr-preview/pr-1/

Built to branch gh-pages at 2026-11-22 19:50 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

…mcpp run, and NetBSD and OpenBSD

- The platform of a row the built-in table does not serve is the one the package
  index names (openkal-platform, mcpp.platforms); only DJGPP's is stated.
- COMMAND.COM names cmain.c as its entry with its own define; the wrapper is gone.
- mcpp.plugins 0.22.1, the version openkal-platform 0.29.1 builds with.
- CI: setup-mcpp; FreeBSD, NetBSD, OpenBSD, Android, UEFI and both DOS rows run
  test.bat through `mcpp run --file` (the openkal DOS row now runs it: its stack
  is 1 MiB); UEFI and openkal DOS run it without its part that writes files; the
  openkal package runs in FreeBSD through its own launcher.
@Sunrisepeak Sunrisepeak changed the title Build for 22 targets with mcpp and openkal, with CI and a web playground Build for 26 targets with mcpp and openkal, with CI and a web playground Nov 17, 2026
…e's default, 0.28.0, builds with mcpp.plugins 0.20.0); djgpp-platform 0.2.0, whose runner delivers test.bat
….30.0, run under an emulation of the interface
…ach system's base and run in its image

mcpp/platforms/hurd and mcpp/platforms/haiku each state a row, the base
system it is built over (xim's x86_64-hurd-sysroot: Debian GNU/Hurd's glibc;
x86_64-haiku-sysroot: Haiku's libroot, both with GCC's run-time) and the
machine it is run in (hurd-disk-image, haiku-disk-image, booted by dirun
0.7.0). The workflow builds both on Linux and runs test.bat in each system.
…s release build

On a Linux machine the Darwin row's runner boots PureDarwin (xnu with no
macOS above it) from the image its project publishes (xim's
puredarwin-disk-image: a developer preview, not mirrored) and runs test.bat
there. The row links openkal-macos 0.23.5, taken from its repository by tag,
which calls only the parts of fork the system library exports. The release
build links since openkal-macos 0.23.4, so the row is built as the others.
@Sunrisepeak Sunrisepeak changed the title Build for 26 targets with mcpp and openkal, with CI and a web playground Build for 29 targets with mcpp and openkal and run on all eleven systems the project lists, with CI and a web playground Nov 18, 2026
…nce the prompt is shown

UEFI (openkal-uefi 0.11.2) and openkal DOS now make, rename, list and
remove files as the script asks, so neither leaves that part out. DOS
without long names keeps a name in upper case (F1.TXT for f1.txt), so the
DOS row's output is compared without regard to case (check.sh,
CHECK_FOLD_CASE=1).

prompt.py typed each line after a fixed wait; under node the interpreter
had not yet shown its prompt, the terminal echoed the line ahead of the
banner, and the line's output followed the prompt on one line (seen once on
ubuntu-24.04). Each line is now typed once the prompt is shown.
…nd Haiku from mcpp.platforms 0.2.0

The System V row (openkal-platform 0.30.1) is run on AT&T UNIX System
V/386 Release 4.0 Version 3.0 in QEMU: xim's svr4-disk-image (technical
verification only: the system is proprietary), booted by dirun 0.8.0, whose
files disk carries the system's own label. mcpp.toml states that runner for
i686-svr4-musl; the platform's own runner, an emulation of the interface
(ibcs-us), is replaced, and the workflow no longer opens a user namespace.

GNU/Hurd and Haiku are rows of mcpp.platforms 0.2.0, which the package index
names for them, so mcpp/platforms/ is removed. The Hurd row is built over
Debian GNU/Hurd's base at the versions of the image it runs in
(x86_64-hurd-sysroot 20260314); both bases state GCC's std module.
On a GitHub-hosted runner the kernel of AT&T UNIX System V/386 Release 4.0
Version 3.0 stopped while it booted under KVM (the machine reset just after
"Booting the UNIX System...", which dirun's -no-reboot ends). Under TCG the
same run, through the packages the index publishes, is as expected in about
nine seconds on a developer machine. The PureDarwin runner names TCG the
same way.
…usl and PureDarwin start programs

The interpreter decided whether a name may be started by stat's execute
bits. A system that keeps no execute permission reports none there:
Windows under openkal's C library, and PureDarwin, whose root volume is
ext4, which openkal-macos does not claim execute bits for
(mcpplibs/openkal-macos#53). access(X_OK) asks the system that decides,
and is the right question on Unix too (the owner's bit says nothing about
another user's file). lexec.c's search and lselfpath.c's argv[0] fallback
both ask it now.

Under openkal's C library (CMD_LIBC_MUSL):
- fork reports ENOSYS where openkal.space is absent (Windows): the program
  is started with posix_spawn instead, its argument zero in the system's
  spelling (cmd.exe takes a '/' in its own name for a switch);
- the search follows the system's conventions, which openkal states
  (kal_env_system): on Windows PATH is split on ';', a name with a volume
  is not searched for, and a name without a suffix is tried with each
  suffix PATHEXT lists, as the C library's own search does.

Measured: x86_64-windows-musl (wine) and PureDarwin (twice) give the whole
script, the program start included; linux-gnu, x86_64/i686-linux-musl
unchanged; every musl row builds; make -std=c89 gives main's two warnings.
CI: neither row leaves the program start out any more.
…AWN), no openkal call

9e3500b asked openkal (kal_env_system) whether the system's conventions
are Windows', to search PATH with ';' and PATHEXT and to spell a started
program's argument zero with '\'. That is not the interpreter's to ask:
its l-layer uses a POSIX.1 C library or Win32 (AGENTS.md), and a C library
that presents POSIX on another system (openkal-musl) answers the system's
conventions itself (its execvp and posix_spawnp search by them). Removed;
the search is the original one with access(X_OK).

posix_spawn where fork reports ENOSYS stays, under POSIX's own option
macro _POSIX_SPAWN rather than CMD_LIBC_MUSL. Every target builds (the
macOS rows wait for the index, mcpplibs/mcpp-index#847); make -std=c89
gives main's two warnings.
…easured reason

Measured on windows-2022 (temporary draft PR #4): the POSIX build hands a
started program its own name with '/' for '\' (cdispatch.c, as a POSIX
program wants it), and Windows' cmd.exe reads that as switches ("The syntax
of the command is incorrect"); whoami.exe, started the same way, runs. The
start itself works (posix_spawn where fork reports ENOSYS). openkal passes
arguments unaltered by its specification (clause 7.6), so the spelling is
not the C library's to change.
A newer openkal-macos listed alone in the index no longer displaces the
one openkal-platform 0.31.0 names (mcpp#956). 2026.11.19.1 serves mcpp's
own openkal rows with 0.31.0 as well; the rows keep stating it so the pair
with mcpp.plugins 0.26.1 holds when a later mcpp moves its default.
A loader started explicitly -- the system's ld.so, or a runner of images
such as okrun -- is what /proc/self/exe names, so COMSPEC named the loader
and "%COMSPEC%" started it, not this program (measured: COMSPEC=ld.so
and status 127 under /lib64/ld-linux-x86-64.so.2 ./cmd.exe). argv[0] with
a '/' names the program as it was started; resolved against the starting
directory, it stays right after a cd. POSIX interfaces only.
One selector over the triple as written (env = musl, os = openkal or uefi)
names openkal-platform ^0.31 for every row it serves, in place of a pin
per row; a patch release of the series (0.31.2: okrun 0.7.2, openkal-macos
0.24.1) reaches the project unedited, and the series keeps the pair with
mcpp.plugins 0.26.1. DOS with DJGPP takes the platform the index names
(djgpp-platform 0.2.0).
test.bat is in parts: L0 the interpreter alone, L1 files, L2 a program it
starts. Every row runs the whole script; check.sh compares each part and
fails a run below the row's floor, and reports the level it reaches, so a
capability the row's platform gains shows in the summary by itself. The
per-row lists of a part left out (prepare.sh, process: false, the case of
the native job) are gone; floor.txt says why a row is below L2. The openkal
image rows are L2 with okrun 0.7.2 and the self path from argv[0].
x86_64-windows-msvc is the toolchain of the project's Visual Studio build;
i686-windows-msvc (mcpp 2026.11.22.1) runs on x86_64 Windows. The
<arch>-freebsd-musl rows (openkal-platform 0.31.2) are FreeBSD with no C
library of its own beneath, run in the FreeBSD virtual machines.
…starts

Measured: the i386 image starts host programs (4, 0) but an image it
starts ends with status 127 in okrun's fork copy, before it is entered
(mcpplibs/openkal-image#46); x86_64 enters it. Its run reports L2 by
itself once that start works.
…pp/README.md

The main README keeps three commands and a link. mcpp/README.md (and its
Chinese version) gives one row per system with its targets, its level
(L0 a console, L1 files, L2 starting a program) and where CI runs it,
with one note per row below L2.
…image an image starts

Measured: the FreeBSD runner hands such an image to the kernel (Exec
format error, mcpplibs/openkal-image#47), as the Linux runner did before
0.7.2 (#42). Its run reports L2 by itself once that start works.
…ooted once more

Measured three times in four runs on GitHub's runners (PureDarwin twice,
x86_64-freebsd-musl once): dirun's boot limit expired before the program
started, and the next run of the same job passed. Only that message
retries; any other outcome is graded as before.
@Sunrisepeak Sunrisepeak changed the title Build for 29 targets with mcpp and openkal and run on all eleven systems the project lists, with CI and a web playground Build for 33 targets with mcpp, graded by level, on all eleven systems the project lists Nov 22, 2026
The README links the page right after the project's tagline. mcpp/README.md
(and its Chinese version) is a quick start, one table of every target with
its arch, variant and level, what the levels mean, and how to run a target
in a virtual machine.
A header that says what cmd is and where it runs, GitHub and a language
button (English or Chinese, from the browser's language on a first visit);
the playground, with a menu for the language of cmd's own messages (LANG,
set before the C library starts: build.mcpp exports ENV); three cards; and
a picker of system, arch and variant that gives a target's level and its
mcpp commands, with a copy that answers. The footer names mcpp and openkal.
The page is the project's GitHub Pages site (chenpi11.github.io/cmd), which
the workflow deploys from main. The Microsoft-translated and Classical
Chinese READMEs link the page and mcpp/README.zh_CN.md, as the English and
Simplified Chinese ones do.
… target

release.yml checks the version against tpack.sh and mcpp.toml, calls
mcpp.yml (the same 33 builds and runs; nothing is published unless all
pass), and publishes the release with GitHub's notes. Its files: the
programs as built, named <target>-cmd.exe and <target>-COMMAND.COM as in
the project's releases; mcpp's package of each target, the web page and
the openkal package; and tpack.sh's source archives (cmd-<version>.tar,
...). The choice of bare, pack or both is an input; a program built on a
machine CI does not have is added with gh release upload.
Measured: mcpp pack -o dist/pack/ empties the project's dist/, so the
programs collected in dist/bare/ were gone by the next pack; output into
another directory keeps its siblings and earlier packages (reported in
mcpp#1007). Only target/<target>/<build>/bin/ is collected, not a step's
intermediates (obj/platform/bin/*.unsealed).
Measured in a draft release (130 files): the MSVC rows' bin/ also holds
the run-time libraries mcpp places beside the programs, and the DJGPP
row a hidden intermediate (.COMMAND.exe). The bare files are cmd.exe*
and COMMAND.COM* only; the libraries stay in the target's package.
oweb.png (8.3 name, overview prefix): the page running the Files example.
Its caption, Web, links the page, in the English, Simplified Chinese and
Microsoft-translated Chinese READMEs (the Classical Chinese one has no
screenshots).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant