Platform
NAME
App::Ariza::Platform - name the machine ariza is building for
SYNOPSIS
use App::Ariza::Platform;
say current-slug; # macos-arm64
say known-slugs; # (linux-aarch64-glibc linux-aarch64-musl ...)
# Non-fatal form: Str type object instead of a die
without detect-slug() -> $ {
say "no bundle for this box";
}
# Force a slug (cross-builds, CI matrices, tests):
%*ENV<ARIZA_PLATFORM> = 'linux-x86_64-musl';
say current-slug; # linux-x86_64-musl
# Inject probe results instead of touching the real system:
say detect-slug(:os<linux>, :hardware<aarch64>, :libc<musl>, :override(Str));
# linux-aarch64-musl
DESCRIPTION
A self-contained bundle is only self-contained for one platform, so
every artefact ariza produces is named after one. This module produces
that name and nothing else: it has no state, touches no configuration,
and its only side effects are reading $*KERNEL, %*ENV, /lib,
and (on Linux) running ldd --version.
The slugs
macos-arm64,macos-x86_64linux-x86_64-glibc,linux-aarch64-glibclinux-x86_64-musl,linux-aarch64-muslwindows-x86_64,windows-arm64
These strings are not ariza's to choose. They are exactly Notcurses-Native's platform slugs, because a bundle ships that distribution's prebuilt notcurses libraries and has to agree with it about what platform it is on. If Notcurses-Native ever gains a slug, this map gains it in the same shape.
Detection
The probe builds a key from $*KERNEL.name.lc and
$*KERNEL.hardware.lc, plus ā on Linux only ā a libc suffix, then
looks that key up:
darwin-arm64 -> macos-arm64
linux-x86_64-glibc -> linux-x86_64-glibc
linux-aarch64-musl -> linux-aarch64-musl
mswin32-x86_64 -> windows-x86_64
Windows reports its kernel name as either win32 or mswin32
depending on the build, so both keys are mapped.
The libc axis exists because a glibc binary does not run on Alpine and
a musl binary does not run on Debian. detect-libc looks for a
ld-musl-*.so.1 loader under /lib or /usr/lib first (its
presence is conclusive), then falls back to parsing ldd --version
for a glibc version. A Linux system with neither ā uclibc, a static
busybox image ā yields no libc, hence no matching key, hence an honest
"unsupported platform" rather than a bundle that will not run.
The ARIZA_PLATFORM override
Setting ARIZA_PLATFORM to a known slug short-circuits all detection.
This is what makes cross-building and CI matrices possible, and what
lets this distribution's own tests exercise Linux and Windows paths on
a Mac.
An override that is not a known slug is a hard error, in both
current-slug and detect-slug. Every other input to this module is
a system fact that might legitimately be something ariza cannot name;
an override is a human typing a string, and silently ignoring a
misspelled one would produce a bundle for the wrong platform. An empty
or whitespace-only value is treated as unset, so ARIZA_PLATFORM=
in a shell profile does not wedge the tool.
SUBROUTINES
current-slug(:$os, :$hardware, :$libc, :$override --> Str)
The slug for this machine. Dies if there isn't one, with a message naming the probed key, every key ariza recognises, and the override that would force the issue.
detect-slug(:$os, :$hardware, :$libc, :$override --> Str)
Same, but returns the undefined Str type object instead of dying on
an unknown platform. A bad ARIZA_PLATFORM still dies.
detect-libc(:$os, :@lib-dirs, :&glibc-probe --> Str)
'musl', 'glibc', or the undefined Str. Off Linux, always the
undefined Str. :@lib-dirs and :&glibc-probe replace the two
system probes, so every branch is reachable from a test on any host.
detect-glibc-version(--> Version)
The version ldd --version reports, or an undefined Version.
platform-key(:$os, :$hardware, :$libc --> Str)
The os-hardware[-libc] string detection looks up. Exposed for
diagnostics.
known-slugs(--> List) / known-platform-keys(--> List) / known-slug(Str --> Bool)
The supported slugs, the recognised probe keys, and a membership test.
AUTHOR
Matt Doughty
COPYRIGHT AND LICENSE
Copyright 2026 Matt Doughty
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.