|
| 1 | +# Adding a system |
| 2 | + |
| 3 | +A system enters `mcpp.platforms` as rows of its triples, each served by a |
| 4 | +provider that names the system's base and, where the system can be booted, a |
| 5 | +runner. The semantics are mcpp's ([SPEC-013 Platforms](https://github.com/mcpp-community/mcpp/blob/main/docs/specs/platforms.md), |
| 6 | +[SPEC-016 Targets and providers](https://github.com/mcpp-community/mcpp/blob/main/docs/specs/targets-and-providers.md)); this |
| 7 | +document states the procedure and what each part must hold. |
| 8 | + |
| 9 | +## The systems |
| 10 | + |
| 11 | +| System | Rows | Base | Runner | State | |
| 12 | +|---|---|---|---|---| |
| 13 | +| FreeBSD 14.5 | `x86_64-freebsd`, `aarch64-freebsd` (mcpp's built-in rows) | the release's base set | both | `preview` | |
| 14 | +| NetBSD 10.2 | `x86_64-netbsd`, `aarch64-netbsd` | the release's base and comp sets; the C++ layer is libc++ from source (`llvm.libcxx`) | x86_64 | `preview` | |
| 15 | +| OpenBSD 8.0 | `x86_64-openbsd`, `aarch64-openbsd` | the release's base and comp sets | x86_64 | `preview` | |
| 16 | +| illumos (OmniOS r151054) | none | assembled, not published | measured | not included: see below | |
| 17 | + |
| 18 | +illumos is not included. Its sysroot and disk image were assembled, and C and |
| 19 | +C++ programs linked with lld ran on OmniOS r151054. But clang's Solaris driver |
| 20 | +links only through the system's own linker: it runs `/usr/bin/ld` with Solaris |
| 21 | +options (`-C`, `-z ignore`), ignores `--ld-path` and `-B`, and refuses lld as a |
| 22 | +`-fuse-ld` name. A row can state no program that translates those options for |
| 23 | +lld. The row enters when either a platform can name the program the compiler |
| 24 | +links with, or clang's Solaris driver gives lld the GNU options. |
| 25 | + |
| 26 | +## Hosts |
| 27 | + |
| 28 | +The rows build on a Linux host, x86_64 or aarch64, which this repository's CI |
| 29 | +checks. A macOS or Windows host does not build them yet. Measured in the CI of |
| 30 | +0.1.0 with mcpp 2026.11.17.1, the host's own conventions reach the row: |
| 31 | + |
| 32 | +| Host | What reaches the row | |
| 33 | +|---|---| |
| 34 | +| macOS | the Apple SDK's headers in the std module's compile (FreeBSD); libc++ compiled against the host's ctype definitions (NetBSD, `_CTYPE_BL`); the Mach-O linker given ELF options (OpenBSD, `ld64.lld: unknown argument '--disable-new-dtags'`) | |
| 35 | +| Windows | the sysroot's headers not opened (NetBSD, `sys/cdefs.h`); the crt objects not found and the program named `.exe` (FreeBSD) | |
| 36 | + |
| 37 | +These are mcpp's to correct (the row, not the host, decides a cross build); the |
| 38 | +rows enter the build matrix of a host when it builds them. |
| 39 | + |
| 40 | +## What a system brings |
| 41 | + |
| 42 | +| Part | Where | Holds | |
| 43 | +|---|---|---| |
| 44 | +| The system | `[[platform.system]]` in `mcpp.toml` | `name`, the row's os word; `uname`, what `uname -s` answers there | |
| 45 | +| A row per architecture | `[[platform.define]]` | `triple`, `clang-triple` (with the release the sysroot is), `loader`, `object-format = "elf"`, `family`, `execution`, `tier = "preview"`, `standard` | |
| 46 | +| A provider per row | `[[platform.provider]]` | `serves`, `sysroot = "xim:<arch>-<system>-sysroot@<release>"`, `hosted = true`, and for a row whose image exists a `runner` with `enabled = false`; `layers` when a layer comes from a package rather than from the base (below) | |
| 47 | +| A sysroot package | xim-pkgindex, `<arch>-<system>-sysroot` | the release's own headers, crt objects, shared libraries and the static archives of the C library, the C++ run-time and the compiler run-time, with a `mcpp.toml` at its root stating the layers it provides ([mcpp docs/22](https://github.com/mcpp-community/mcpp/blob/main/docs/22-target-side.md), base packages; [SPEC-002 §2.5](https://github.com/mcpp-community/mcpp/blob/main/docs/specs/target-side.md)) | |
| 48 | +| A disk image package | xim-pkgindex, `<system>-disk-image` | the release's official media made a bootable qcow2 with a serial console, and the dirun profile that boots it ([xim-pkgindex docs/12](https://github.com/openxlings/xim-pkgindex/blob/main/docs/12-disk-image-assets.md)) | |
| 49 | +| A check | `.github/workflows/ci.yml` | the row builds a C program and a C++ program with an exception; where it has a runner, both run and their status returns | |
| 50 | + |
| 51 | +The assembly of each package is a script in xim-pkgindex `.agents/tools/` |
| 52 | +that starts from the publisher's signed or digest-listed release files and |
| 53 | +records them in the package's `PROVENANCE.md`. A change the image needs (a |
| 54 | +serial console, a login) is stated there, at its byte or as the script that |
| 55 | +made it. |
| 56 | + |
| 57 | +## `import std` |
| 58 | + |
| 59 | +Every row compiles `import std`. A base whose C++ library ships module sources |
| 60 | +states them (`std-module`, [mcpp docs/22](https://github.com/mcpp-community/mcpp/blob/main/docs/22-target-side.md)); FreeBSD and OpenBSD ship libc++, and |
| 61 | +their sysroots carry the module sources of its release. A system whose C++ |
| 62 | +library ships none (NetBSD: GCC 10's libstdc++) takes the C++ layer from a |
| 63 | +package instead, libc++ built from source over the system's C library: |
| 64 | + |
| 65 | +```toml |
| 66 | +[[platform.provider]] |
| 67 | +serves = ["x86_64-netbsd"] |
| 68 | +sysroot = "xim:x86_64-netbsd-sysroot@10.2" |
| 69 | +layers = { "c++-abi" = "llvm.libcxx@22.1.8.3" } |
| 70 | +``` |
| 71 | + |
| 72 | +The package replaces the base for that layer alone: the base's C++ headers and |
| 73 | +libraries leave the build, and the C library and the compiler runtime stay the |
| 74 | +system's. What the replacement needs of the compiler runtime and the driver |
| 75 | +does not name is stated for the system's rows (`[platform.build.'cfg(os = |
| 76 | +"netbsd")'] ldflags`: libc++abi unwinds through libgcc_s). |
| 77 | + |
| 78 | +## The image |
| 79 | + |
| 80 | +The image's profile states what the image answers: the boot prompts, the |
| 81 | +login, the shell's quoting and where a disk of files is mounted. It needs no |
| 82 | +network and no interaction beyond the profile's steps. A runner is |
| 83 | +`dirun --profile {pkg:<system>-disk-image}/dirun.toml -- {}`, with the |
| 84 | +emulator a package of xim; it stays `enabled = false`, because its first use |
| 85 | +fetches a machine image ([SPEC-016 §6](https://github.com/mcpp-community/mcpp/blob/main/docs/specs/targets-and-providers.md)). A project or a machine enables it: |
| 86 | + |
| 87 | +```toml |
| 88 | +[target.x86_64-netbsd] |
| 89 | +runner = true |
| 90 | +``` |
| 91 | + |
| 92 | +## Tiers |
| 93 | + |
| 94 | +- `preview`: the row builds in this repository's CI; where it has a runner, |
| 95 | + its programs run there. |
| 96 | +- `stable`: in addition, a project outside this repository has built and run |
| 97 | + a program of the row through mcpp's own commands (`mcpp build`, `mcpp run`, |
| 98 | + `mcpp test`), and the row's packages have had one release without a |
| 99 | + correction. |
| 100 | +- A row moves into mcpp's built-in table when its system is common enough that |
| 101 | + a project should not need a platform for it, and the engine then carries the |
| 102 | + row's data; its provider stays here. |
| 103 | + |
| 104 | +## What may not be added |
| 105 | + |
| 106 | +- A system name in the engine: the engine reads the rows as data. |
| 107 | +- A sysroot or image assembled from anything but the publisher's media. |
| 108 | +- A runner that needs a network or a person to finish booting. |
0 commit comments