Files
hakurei/internal/rosa/all.go
Ophestra 826347fe1f
All checks were successful
Test / Create distribution (push) Successful in 1m4s
Test / Sandbox (push) Successful in 3m19s
Test / Hakurei (push) Successful in 4m35s
Test / ShareFS (push) Successful in 4m43s
Test / Hpkg (push) Successful in 5m12s
Test / Sandbox (race detector) (push) Successful in 5m24s
Test / Hakurei (race detector) (push) Successful in 6m21s
Test / Flake checks (push) Successful in 1m49s
internal/rosa: expose standalone musl
This is useful in the system image and might also be used elsewhere.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-02-26 14:21:32 +09:00

267 lines
5.7 KiB
Go

package rosa
import (
"sync"
"hakurei.app/internal/pkg"
)
// PArtifact is a lazily-initialised [pkg.Artifact] preset.
type PArtifact int
const (
// ImageInitramfs is the Rosa OS initramfs archive.
ImageInitramfs PArtifact = iota
// Kernel is the generic Rosa OS Linux kernel.
Kernel
// KernelHeaders is an installation of kernel headers for [Kernel].
KernelHeaders
// KernelSource is a writable kernel source tree installed to [AbsUsrSrc].
KernelSource
ACL
ArgpStandalone
Attr
Autoconf
Automake
BC
Bash
Binutils
Bison
Bzip2
CMake
Coreutils
Curl
DTC
Diffutils
Elfutils
Fakeroot
Findutils
Flex
Fuse
GMP
GLib
Gawk
Gettext
Git
Go
Gperf
Grep
Gzip
Hakurei
HakureiDist
IniConfig
Kmod
LibXau
Libcap
Libexpat
Libiconv
Libpsl
Libffi
Libgd
Libtool
Libseccomp
Libucontext
Libxml2
Libxslt
M4
MPC
MPFR
Make
Meson
Mksh
MuslFts
MuslObstack
NSS
NSSCACert
Ncurses
Ninja
OpenSSL
PCRE2
Packaging
Patch
Perl
PerlLocaleGettext
PerlMIMECharset
PerlModuleBuild
PerlPodParser
PerlSGMLS
PerlTermReadKey
PerlTextCharWidth
PerlTextWrapI18N
PerlUnicodeGCString
PerlYAMLTiny
PkgConfig
Pluggy
Procps
PyTest
Pygments
Python
QEMU
Rsync
Sed
Setuptools
SquashfsTools
TamaGo
Tar
Texinfo
Toybox
toyboxEarly
Unzip
UtilLinux
Wayland
WaylandProtocols
XCB
XCBProto
Xproto
XZ
Zlib
Zstd
buildcatrust
utilMacros
// musl is a standalone libc that does not depend on the toolchain.
musl
// gcc is a hacked-to-pieces GCC toolchain meant for use in intermediate
// stages only. This preset and its direct output must never be exposed.
gcc
// Stage0 is a tarball containing all compile-time dependencies of artifacts
// part of the [Std] toolchain.
Stage0
// _presetEnd is the total number of presets and does not denote a preset.
_presetEnd
)
var (
// artifactsF is an array of functions for the result of [PArtifact].
artifactsF [_presetEnd]func(t Toolchain) pkg.Artifact
// artifacts stores the result of artifactsF.
artifacts [_toolchainEnd][len(artifactsF)]pkg.Artifact
// artifactsOnce is for lazy initialisation of artifacts.
artifactsOnce [_toolchainEnd][len(artifactsF)]sync.Once
)
// Load returns the resulting [pkg.Artifact] of [PArtifact].
func (t Toolchain) Load(p PArtifact) pkg.Artifact {
artifactsOnce[t][p].Do(func() {
artifacts[t][p] = artifactsF[p](t)
})
return artifacts[t][p]
}
// ResolveName returns a [PArtifact] by name.
func ResolveName(name string) (p PArtifact, ok bool) {
p, ok = map[string]PArtifact{
"initramfs-image": ImageInitramfs,
"kernel": Kernel,
"kernel-headers": KernelHeaders,
"kernel-source": KernelSource,
"acl": ACL,
"argp-standalone": ArgpStandalone,
"attr": Attr,
"autoconf": Autoconf,
"automake": Automake,
"bc": BC,
"bash": Bash,
"binutils": Binutils,
"bison": Bison,
"bzip2": Bzip2,
"cmake": CMake,
"coreutils": Coreutils,
"curl": Curl,
"dtc": DTC,
"diffutils": Diffutils,
"elfutils": Elfutils,
"fakeroot": Fakeroot,
"findutils": Findutils,
"flex": Flex,
"fuse": Fuse,
"gmp": GMP,
"glib": GLib,
"gawk": Gawk,
"gettext": Gettext,
"git": Git,
"go": Go,
"gperf": Gperf,
"grep": Grep,
"gzip": Gzip,
"hakurei": Hakurei,
"hakurei-dist": HakureiDist,
"iniconfig": IniConfig,
"kmod": Kmod,
"libXau": LibXau,
"libcap": Libcap,
"libexpat": Libexpat,
"libiconv": Libiconv,
"libpsl": Libpsl,
"libseccomp": Libseccomp,
"libucontext": Libucontext,
"libxml2": Libxml2,
"libxslt": Libxslt,
"libffi": Libffi,
"libgd": Libgd,
"libtool": Libtool,
"m4": M4,
"mpc": MPC,
"mpfr": MPFR,
"make": Make,
"meson": Meson,
"mksh": Mksh,
"musl-fts": MuslFts,
"musl-obstack": MuslObstack,
"nss": NSS,
"nss-cacert": NSSCACert,
"ncurses": Ncurses,
"ninja": Ninja,
"openssl": OpenSSL,
"pcre2": PCRE2,
"packaging": Packaging,
"patch": Patch,
"perl": Perl,
"Locale::gettext": PerlLocaleGettext,
"MIME::Charset": PerlMIMECharset,
"Module::Build": PerlModuleBuild,
"Pod::Parser": PerlPodParser,
"SGMLS": PerlSGMLS,
"Term::ReadKey": PerlTermReadKey,
"Text::CharWidth": PerlTextCharWidth,
"Text::WrapI18N": PerlTextWrapI18N,
"Unicode::GCString": PerlUnicodeGCString,
"YAML::Tiny": PerlYAMLTiny,
"pkg-config": PkgConfig,
"pluggy": Pluggy,
"procps": Procps,
"pytest": PyTest,
"pygments": Pygments,
"python": Python,
"qemu": QEMU,
"rsync": Rsync,
"sed": Sed,
"setuptools": Setuptools,
"squashfs-tools": SquashfsTools,
"tamago": TamaGo,
"tar": Tar,
"texinfo": Texinfo,
"toybox": Toybox,
"unzip": Unzip,
"util-linux": UtilLinux,
"wayland": Wayland,
"wayland-protocols": WaylandProtocols,
"xcb": XCB,
"xcb-proto": XCBProto,
"xproto": Xproto,
"xz": XZ,
"zlib": Zlib,
"zstd": Zstd,
}[name]
return
}