Files
hakurei/internal/rosa/all.go
Ophestra f1758a6fa8
All checks were successful
Test / Create distribution (push) Successful in 59s
Test / Sandbox (push) Successful in 2m32s
Test / Hakurei (push) Successful in 3m49s
Test / ShareFS (push) Successful in 3m55s
Test / Hpkg (push) Successful in 4m25s
Test / Sandbox (race detector) (push) Successful in 5m9s
Test / Hakurei (race detector) (push) Successful in 5m53s
Test / Flake checks (push) Successful in 1m41s
internal/rosa: nss artifacts
Not used by anything for now, but will be part of Rosa OS.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-27 08:17:58 +09:00

82 lines
1.2 KiB
Go

package rosa
import (
"sync"
"hakurei.app/internal/pkg"
)
// PArtifact is a lazily-initialised [pkg.Artifact] preset.
type PArtifact int
const (
ACL PArtifact = iota
Attr
Autoconf
Bash
Busybox
CMake
Coreutils
Diffutils
Fuse
Gettext
Git
Go
Gperf
Hakurei
HakureiDist
IniConfig
KernelHeaders
LibXau
Libexpat
Libffi
Libgd
Libseccomp
Libxml2
M4
Make
Meson
NSS
NSSCACert
Ninja
Packaging
Patch
Perl
PkgConfig
Pluggy
PyTest
Pygments
Python
Rsync
Setuptools
Wayland
WaylandProtocols
XCB
XCBProto
Xproto
Zlib
buildcatrust
// _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]
}