Skip to main content

Module link_kit

Module link_kit 

Source
Expand description

The link kit: one target’s link line, its inputs, and the modules on it.

A link kit is what lets a machine with no Rust toolchain produce an executable with the engine and a chosen set of runtime modules compiled in. The release workflow builds the static launcher once per target with a recorder in the linker’s place (tools/link-recorder), keeps every file that link read, and writes a Manifest describing the command that produced the binary. Replaying that command with a module’s object files left out, or its register symbol forced in, is how one prebuilt kit turns into any of the executables its modules can spell.

A second kind of kit records the link of the engine’s shared library instead (ArtifactKind::SharedEngine): liblumen_engine on Linux and macOS, lumen.dll on Windows. Replaying it with only the capabilities an app uses, and with the export list cut down to what the files shipped beside it resolve, gives each packaged app an engine of its own.

Two things about the recorded line are not obvious and are why the manifest is typed rather than a list of strings:

  • Some arguments name files that must travel with the kit (the rlibs and the temporary objects), some name directories that must not (the host’s /usr/lib), and some name neither. A replay has to tell them apart to re-root the first kind and leave the third alone.
  • A module’s contribution to the line is a subset of it: its rlib, and the native libraries its own crate graph asked for. Dropping a module means dropping exactly that subset, which is what the module attribution on LinkArg::File and LinkArg::SysLib records.

Everything here is data. Nothing in this module opens a file, and nothing in the engine reads it: the producer is lumenc link-kit emit and the consumer is a lumenc running on someone else’s machine.

The schema is versioned and pre-1.0, so it changes whenever a better shape turns up; a kit whose Manifest::schema is not SCHEMA_VERSION is refused rather than guessed at.

Structs§

Artifact
How the app’s compiled artifact reaches the executable a replay produces.
Driver
What replays the line.
KitCapability
One optional subsystem a kit can link in.
KitModule
One runtime module a kit can link in.
Manifest
One target’s link kit.
Record
One line of the link recorder’s JSON Lines output.
RecordEnv
Environment the recorded line reads.

Enums§

ArtifactKind
How a replay’s output carries the app: the two ways a launcher finds the artifact it runs, and the shared engine, which carries none.
DriverKind
The kind of program a replay runs.
KitSelect
When a package carries a capability the app did not name.
LinkArg
One argument of the recorded link line.

Constants§

SCHEMA_VERSION
The manifest version this build writes and accepts.

Functions§

dropped_but_used
The capabilities requested turns off although sources mention their builtins, each with the markers found. An app that says os-tray = false and calls tray_icon packages without the tray, and the call does nothing; this is what the package step warns about.
select_capabilities
The capabilities a package of one app carries, out of the ones a kit offers.