aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/hakurei.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-05-17 13:07:12 +0900
committerOphestra <cat@gensokyo.uk>2026-05-17 15:56:53 +0900
commit30eb0d6a613ad268f6805ccbcdcabf158e7f526f (patch)
tree07e55baa52748fd139e183017eeb43f5f64cee59 /internal/rosa/hakurei.go
parentc2ff9c9fa55ea569a5e70ee90d2eb0b2ee2a0540 (diff)
internal/rosa: key metadata by string
For upcoming azalea integration. The API is quite ugly right now to ease migration. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/hakurei.go')
-rw-r--r--internal/rosa/hakurei.go27
1 files changed, 14 insertions, 13 deletions
diff --git a/internal/rosa/hakurei.go b/internal/rosa/hakurei.go
index 276547a8..9f5fba30 100644
--- a/internal/rosa/hakurei.go
+++ b/internal/rosa/hakurei.go
@@ -2,7 +2,8 @@ package rosa
import "hakurei.app/internal/pkg"
-func (t Toolchain) newHakurei(
+func (s *S) newHakurei(
+ t Toolchain,
suffix, script string,
withHostname bool,
) pkg.Artifact {
@@ -14,7 +15,7 @@ go build -o /bin/hostname /usr/src/hostname/main.go
hostname = ""
}
- return t.New("hakurei"+suffix+"-"+hakureiVersion, 0, t.AppendPresets(nil,
+ return s.New(t, "hakurei"+suffix+"-"+hakureiVersion, 0, s.AppendPresets(t, nil,
Go,
PkgConfig,
@@ -38,8 +39,8 @@ go build -o /bin/hostname /usr/src/hostname/main.go
cd /usr/src/hakurei
HAKUREI_VERSION='v`+hakureiVersion+`'
-`+script, pkg.Path(AbsUsrSrc.Append("hakurei"), true, t.NewPatchedSource(
- "hakurei", hakureiVersion, hakureiSource, false, hakureiPatches...,
+`+script, pkg.Path(AbsUsrSrc.Append("hakurei"), true, s.NewPatchedSource(
+ t, "hakurei", hakureiVersion, hakureiSource, false, hakureiPatches...,
)), pkg.Path(AbsUsrSrc.Append("hostname", "main.go"), false, pkg.NewFile(
"hostname.go",
[]byte(`
@@ -58,9 +59,9 @@ func main() {
)))
}
func init() {
- artifactsM[Hakurei] = Metadata{
- f: func(t Toolchain) (pkg.Artifact, string) {
- return t.newHakurei("", `
+ native.MustRegister(&Artifact{
+ f: func(t Toolchain, s *S) (pkg.Artifact, string) {
+ return s.newHakurei(t, "", `
mkdir -p /work/system/libexec/hakurei/
echo "Building hakurei for $(go env GOOS)/$(go env GOARCH)."
@@ -93,14 +94,14 @@ mkdir -p /work/system/bin/
Website: "https://hakurei.app/",
ID: 388834,
- }
- artifactsM[HakureiDist] = Metadata{
- f: func(t Toolchain) (pkg.Artifact, string) {
+ })
+ native.MustRegister(&Artifact{
+ f: func(t Toolchain, s *S) (pkg.Artifact, string) {
name := "all"
- if presetOpts&OptSkipCheck != 0 {
+ if s.opts&OptSkipCheck != 0 {
name = "make"
}
- return t.newHakurei("-dist", `
+ return s.newHakurei(t, "-dist", `
export HAKUREI_VERSION
DESTDIR=/work /usr/src/hakurei/`+name+`.sh
`, true), hakureiVersion
@@ -109,5 +110,5 @@ DESTDIR=/work /usr/src/hakurei/`+name+`.sh
Name: "hakurei-dist",
Description: "low-level userspace tooling for Rosa OS (distribution tarball)",
Website: "https://hakurei.app/",
- }
+ })
}