internal/rosa: remove global handles
All checks were successful
Test / Create distribution (push) Successful in 1m4s
Test / Sandbox (push) Successful in 4m18s
Test / Hakurei (push) Successful in 6m13s
Test / ShareFS (push) Successful in 6m11s
Test / Sandbox (race detector) (push) Successful in 6m55s
Test / Hakurei (race detector) (push) Successful in 8m5s
Test / Flake checks (push) Successful in 1m21s

These no longer serve any purpose.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-05-20 08:07:43 +09:00
parent 2e502ede6c
commit b482fd4abf
17 changed files with 120 additions and 125 deletions

View File

@@ -60,9 +60,9 @@ func (t Toolchain) newBison() (pkg.Artifact, string) {
"check",
},
},
M4,
Diffutils,
Sed,
H("m4"),
diffutils,
H("sed"),
), version
}
func init() {

View File

@@ -19,7 +19,7 @@ func (t Toolchain) NewViaGit(
path.Base(url),
".git",
)+"-src-"+path.Base(rev), THostNet, t.Append(nil,
NSSCACert,
nssCACert,
Git,
), &checksum, nil, `
git \

View File

@@ -6,11 +6,13 @@ import (
"hakurei.app/internal/pkg"
)
var _go = H("go")
// newGoBootstrap returns the Go bootstrap toolchain.
func (t Toolchain) newGoBootstrap() pkg.Artifact {
const checksum = "8o9JL_ToiQKadCTb04nvBDkp8O1xiWOolAxVEqaTGodieNe4lOFEjlOxN3bwwe23"
return t.New("go1.4-bootstrap", 0, t.Append(nil,
Bash,
bash,
), nil, []string{
"CGO_ENABLED=0",
}, `
@@ -39,7 +41,7 @@ func (t Toolchain) newGo(
name = "make"
}
return t.New("go"+version, 0, t.Append(extra,
Bash,
bash,
), nil, slices.Concat([]string{
"CC=cc",
"GOCACHE=/tmp/gocache",
@@ -78,7 +80,7 @@ func (t Toolchain) newGoLatest() (pkg.Artifact, string) {
case "arm64", "riscv64":
bootstrapEnv = append(bootstrapEnv, "GOROOT_BOOTSTRAP=/system")
bootstrapExtra = t.Append(bootstrapExtra, gcc)
bootstrapExtra = t.Append(bootstrapExtra, H("gcc"))
finalEnv = append(finalEnv, "CGO_ENABLED=0")
default:

View File

@@ -48,21 +48,17 @@ HAKUREI_VERSION='v` + hakureiVersion + `'
Check: check,
Install: install,
},
Go,
PkgConfig,
_go,
H("pkg-config"),
// dist tarball
Gzip,
H("libseccomp"),
H("acl"),
H("fuse"),
H("xcb"),
H("wayland"),
H("wayland-protocols"),
// statically linked
Libseccomp,
ACL,
Fuse,
XCB,
Wayland,
WaylandProtocols,
KernelHeaders,
kernelHeaders,
)
}
func init() {

View File

@@ -5,6 +5,8 @@ import (
"hakurei.app/internal/pkg"
)
var earlyInit = H("earlyinit")
func init() {
meta := Metadata{
Name: "earlyinit",
@@ -35,17 +37,17 @@ func init() {
}
native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) {
return &meta, t.New("system.img", TNoToolchain, t.Append(nil,
SquashfsTools,
H("squashfs-tools"),
), nil, nil, `
mksquashfs /mnt/system /work/system.img
`, pkg.Path(fhs.AbsRoot.Append("mnt"), false, t.Append(nil,
Musl,
musl,
Mksh,
Toybox,
Kmod,
Kernel,
Firmware,
H("kmod"),
H("kernel"),
H("firmware"),
)...))
})
}
@@ -58,9 +60,9 @@ func init() {
}
native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) {
return &meta, t.New("initramfs", TNoToolchain, t.Append(nil,
Zstd,
EarlyInit,
GenInitCPIO,
zstd,
earlyInit,
H("gen_init_cpio"),
), nil, nil, `
gen_init_cpio -t 4294967295 -c /usr/src/initramfs | zstd > /work/initramfs.zst
`, pkg.Path(AbsUsrSrc.Append("initramfs"), false, pkg.NewFile("initramfs", []byte(`

View File

@@ -8,7 +8,25 @@ import (
"hakurei.app/internal/pkg"
)
// litArgs returns [LIT] arguments for optional verbosity and check skipping.
var (
llvmSource = H("llvm-project")
muslHeaders = H("musl-headers")
earlyCompilerRT = H("early-compiler-rt")
earlyRuntimes = H("early-runtimes")
musl = H("musl")
bash = H("bash")
gawk = H("gawk")
coreutils = H("coreutils")
diffutils = H("diffutils")
findutils = H("findutils")
zlib = H("zlib")
zstd = H("zstd")
kernelHeaders = H("kernel-headers")
)
// litArgs returns LIT arguments for optional verbosity and check skipping.
func litArgs(verbose bool, skipChecks ...string) string {
args := []string{"-sv"}
if verbose {
@@ -36,7 +54,7 @@ func init() {
Description: "early LLVM runtime: compiler-rt",
Dependencies: P{
Musl,
musl,
},
}
_meta, source := t.MustLoad(llvmSource)
@@ -91,7 +109,7 @@ ln -s \
Python,
muslHeaders,
KernelHeaders,
kernelHeaders,
)
})
@@ -146,10 +164,10 @@ ln -s \
},
Python,
Zlib,
Zstd,
zlib,
zstd,
earlyCompilerRT,
KernelHeaders,
kernelHeaders,
)
})
@@ -180,9 +198,9 @@ ln -s \
Website: "https://llvm.org",
Dependencies: P{
Zlib,
Zstd,
Musl,
zlib,
zstd,
musl,
},
}
_meta, source := t.MustLoad(llvmSource)
@@ -335,16 +353,16 @@ ninja ` + jobsFlagE + ` check-all
},
Python,
Perl,
Diffutils,
Bash,
Gawk,
Coreutils,
Findutils,
diffutils,
bash,
gawk,
coreutils,
findutils,
Zlib,
Zstd,
zlib,
zstd,
early,
KernelHeaders,
kernelHeaders,
)
})

View File

@@ -55,8 +55,8 @@ func (attr *MakeHelper) extra(flag int) P {
extra := P{Make}
if (attr == nil || !attr.OmitDefaults) && flag&TEarly == 0 {
extra = append(extra,
Gawk,
Coreutils,
gawk,
coreutils,
)
}
return extra

View File

@@ -19,11 +19,11 @@ func init() {
ID: 2089,
}
native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) {
_, python := t.Load(Python)
_, bash := t.Load(Bash)
_, _python := t.Load(Python)
_, _bash := t.Load(bash)
return &meta, t.New(meta.Name+"-"+version, 0, []pkg.Artifact{
python,
bash,
_python,
_bash,
}, nil, nil, `
cd "$(mktemp -d)"
python3 /usr/src/ninja/configure.py \

View File

@@ -6,6 +6,12 @@ import (
"hakurei.app/internal/pkg"
)
var (
unzip = H("unzip")
nss = H("nss")
nssCACert = H("nss-cacert")
)
func (t Toolchain) newNSS() (pkg.Artifact, string) {
const (
version = "3.123.1"
@@ -58,12 +64,12 @@ cp -r \
},
Perl,
Python,
Unzip,
Gawk,
Coreutils,
unzip,
gawk,
coreutils,
Zlib,
KernelHeaders,
zlib,
kernelHeaders,
), version
}
func init() {
@@ -73,7 +79,7 @@ func init() {
Website: "https://firefox-source-docs.mozilla.org/security/nss/index.html",
Dependencies: P{
Zlib,
zlib,
},
ID: 2503,
@@ -82,9 +88,9 @@ func init() {
func (t Toolchain) newNSSCACert() (pkg.Artifact, string) {
return t.New("nss-cacert", 0, t.Append(nil,
Bash,
bash,
NSS,
nss,
H("buildcatrust"),
), nil, nil, `
mkdir -p /work/system/etc/ssl/{certs/unbundled,certs/hashed,trust-source}

View File

@@ -29,10 +29,13 @@ type PipHelper struct {
var _ Helper = new(PipHelper)
// pythonPyTest is used by [PipHelper] for automated testing.
var pythonPyTest = H("python-pytest")
// extra returns python, or pytest if defaults are assumed.
func (attr *PipHelper) extra(int) P {
if attr == nil || (!attr.SkipCheck && attr.Check == "") {
return P{PythonPyTest}
return P{pythonPyTest}
}
return P{Python}
}

View File

@@ -231,6 +231,10 @@ var (
// The Mksh shell is added by [Toolchain.New] and used by almost all packages.
Mksh = H("mksh")
// Toybox is standard utilities added by [Toolchain.New].
Toybox = H("toybox")
// LLVM is the standard toolchain added by [Toolchain.New].
LLVM = H("llvm")
)
// New returns a [pkg.Artifact] based on a [Toolchain] via s.
@@ -298,7 +302,7 @@ mkdir -vp /work/system/bin
base := LLVM
if flag&TNoToolchain != 0 {
base = Musl
base = musl
}
support = slices.Concat(extra, t.S.New(t.stage-1).Append([]pkg.Artifact{
@@ -335,6 +339,9 @@ mkdir -vp /work/system/bin
)
}
// patch is used by [Toolchain.NewPatchedSource].
var patch = H("patch")
// NewPatchedSource returns [pkg.Artifact] of source with patches applied. If
// passthrough is true, source is returned as is for zero length patches.
func (t Toolchain) NewPatchedSource(
@@ -371,7 +378,7 @@ cat /usr/src/` + name + `-patches/* | \
aname += "-patched"
}
return t.New(aname, 0, t.Append(nil,
Patch,
patch,
), nil, nil, script, paths...)
}

View File

@@ -5,6 +5,10 @@ import (
"hakurei.app/internal/pkg"
)
// Stage0 is the handle of the stage0 distribution tarball built on the
// toolchain of stage [Std].
var Stage0 = H("rosa-stage0")
func init() {
meta := Metadata{
Name: "rosa-stage0",
@@ -13,7 +17,7 @@ func init() {
}
native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) {
return &meta, t.New("rosa-stage0", 0, t.Append(nil,
Bzip2,
H("bzip2"),
), nil, nil, `
umask 377
tar \

View File

@@ -1,49 +0,0 @@
package rosa
var (
LLVM = H("llvm")
EarlyInit = H("earlyinit")
Kernel = H("kernel")
KernelHeaders = H("kernel-headers")
Firmware = H("firmware")
ACL = H("acl")
Bash = H("bash")
Bzip2 = H("bzip2")
Coreutils = H("coreutils")
Diffutils = H("diffutils")
Findutils = H("findutils")
Fuse = H("fuse")
GLib = H("glib")
Gawk = H("gawk")
GenInitCPIO = H("gen_init_cpio")
Go = H("go")
Gzip = H("gzip")
Hakurei = H("hakurei")
HakureiDist = H("hakurei-dist")
Kmod = H("kmod")
Libseccomp = H("libseccomp")
M4 = H("m4")
NSS = H("nss")
NSSCACert = H("nss-cacert")
Patch = H("patch")
PkgConfig = H("pkg-config")
PythonPyTest = H("python-pytest")
QEMU = H("qemu")
Sed = H("sed")
SquashfsTools = H("squashfs-tools")
Toybox = H("toybox")
toyboxEarly = H("toybox-early")
Unzip = H("unzip")
Wayland = H("wayland")
WaylandProtocols = H("wayland-protocols")
XCB = H("xcb")
Zlib = H("zlib")
Zstd = H("zstd")
llvmSource = H("llvm-project")
earlyCompilerRT = H("early-compiler-rt")
earlyRuntimes = H("early-runtimes")
Musl = H("musl")
muslHeaders = H("musl-headers")
gcc = H("gcc")
Stage0 = H("rosa-stage0")
)

View File

@@ -8,8 +8,8 @@ func (t Toolchain) newTamaGo() (pkg.Artifact, string) {
checksum = "-nH3MjAzDDLTeJ2hRKYJcJwo5-Ikci4zOHfB8j1vKn7zrF9TS6zYaoLi8qohGwAE"
)
return t.New("tamago-go"+version, 0, t.Append(nil,
Bash,
Go,
bash,
_go,
), nil, []string{
"CC=cc",
"GOCACHE=/tmp/gocache",

View File

@@ -2,6 +2,12 @@ package rosa
import "hakurei.app/internal/pkg"
var (
gzip = H("gzip")
toyboxEarly = H("toybox-early")
)
func (t Toolchain) newToybox(suffix, script string) (pkg.Artifact, string) {
const (
version = "0.8.13"
@@ -52,10 +58,10 @@ mkdir -p /work/usr/bin
ln -s ../../system/bin/env /work/usr/bin
`,
},
Bash,
Gzip,
bash,
gzip,
KernelHeaders,
kernelHeaders,
), version
}
func init() {