package rosa import "hakurei.app/internal/pkg" func (s *S) newHakurei( t Toolchain, suffix, script string, withHostname bool, ) pkg.Artifact { hostname := ` echo 'Building test helper (hostname).' go build -o /bin/hostname /usr/src/hostname/main.go ` if !withHostname { hostname = "" } return s.New(t, "hakurei"+suffix+"-"+hakureiVersion, 0, s.AppendPresets(t, nil, Go, PkgConfig, // dist tarball Gzip, // statically linked Libseccomp, ACL, Fuse, XCB, Wayland, WaylandProtocols, KernelHeaders, ), nil, []string{ "CGO_ENABLED=1", "GOCACHE=/tmp/gocache", "CC=clang -O3 -Werror", }, hostname+` cd /usr/src/hakurei HAKUREI_VERSION='v`+hakureiVersion+`' `+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(` package main import "os" func main() { if name, err := os.Hostname(); err != nil { panic(err) } else { os.Stdout.WriteString(name) } } `), ))) } func init() { 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)." go generate ./... go build -trimpath -tags=rosa -o /work/system/libexec/hakurei -ldflags="-s -w -buildid= -linkmode external -extldflags=-static -X hakurei.app/internal/info.buildVersion=${HAKUREI_VERSION} -X hakurei.app/internal/info.hakureiPath=/system/bin/hakurei -X hakurei.app/internal/info.hsuPath=/system/bin/hsu -X main.hakureiPath=/system/bin/hakurei " ./... echo echo '##### Testing hakurei.' go test -ldflags='-buildid= -linkmode external -extldflags=-static' ./... echo mkdir -p /work/system/bin/ (cd /work/system/libexec/hakurei && mv \ hakurei \ sharefs \ ../../bin/) `, true), hakureiVersion }, Name: "hakurei", Description: "low-level userspace tooling for Rosa OS", Website: "https://hakurei.app/", ID: 388834, }) native.MustRegister(&Artifact{ f: func(t Toolchain, s *S) (pkg.Artifact, string) { name := "all" if s.opts&OptSkipCheck != 0 { name = "make" } return s.newHakurei(t, "-dist", ` export HAKUREI_VERSION DESTDIR=/work /usr/src/hakurei/`+name+`.sh `, true), hakureiVersion }, Name: "hakurei-dist", Description: "low-level userspace tooling for Rosa OS (distribution tarball)", Website: "https://hakurei.app/", }) }