diff --git a/cmd/mbf/main.go b/cmd/mbf/main.go index ed4422b..e342356 100644 --- a/cmd/mbf/main.go +++ b/cmd/mbf/main.go @@ -172,6 +172,8 @@ func main() { p = rosa.Go case "gperf": p = rosa.Gperf + case "hakurei": + p = rosa.Hakurei case "kernel-headers": p = rosa.KernelHeaders case "libXau": diff --git a/internal/rosa/all.go b/internal/rosa/all.go index 686422c..4213a07 100644 --- a/internal/rosa/all.go +++ b/internal/rosa/all.go @@ -22,6 +22,7 @@ const ( Git Go Gperf + Hakurei KernelHeaders LibXau Libexpat diff --git a/internal/rosa/hakurei.go b/internal/rosa/hakurei.go new file mode 100644 index 0000000..c5f364d --- /dev/null +++ b/internal/rosa/hakurei.go @@ -0,0 +1,83 @@ +package rosa + +import ( + "hakurei.app/internal/pkg" +) + +func (t Toolchain) newHakurei() pkg.Artifact { + const ( + version = "0.3.3" + checksum = "iMN9qzDB000noZ6dOHh_aSdrhRZPopjyWHd0KFVjxjQLQstAOvLYZEZ74btlL0pu" + ) + return t.New("hakurei-"+version, false, []pkg.Artifact{ + t.Load(Go), + t.Load(PkgConfig), + + t.Load(KernelHeaders), + t.Load(Libseccomp), + t.Load(ACL), + t.Load(Attr), + + t.Load(Xproto), + t.Load(LibXau), + t.Load(XCBProto), + t.Load(XCB), + + t.Load(Libffi), + t.Load(Libexpat), + t.Load(Libxml2), + t.Load(Wayland), + t.Load(WaylandProtocols), + }, nil, []string{ + "GOCACHE=/tmp/gocache", + "CC=clang -O3 -Werror", + }, ` +echo '# Building test helper (hostname).' +go build -v -o /bin/hostname /usr/src/hostname/main.go +echo + +chmod -R +w /usr/src/hakurei +cd /usr/src/hakurei +mkdir -p /work/system/{bin,libexec/hakurei} + +echo '# Building hakurei.' +go generate -v ./... +go build -trimpath -v -o /work/system/libexec/hakurei -ldflags="-s -w + -buildid= + -extldflags=-static + -X hakurei.app/internal/info.buildVersion='v`+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= -extldflags=-static' ./... +echo + +mv \ + /work/system/libexec/hakurei/{hakurei,hpkg} \ + /work/system/bin +`, pkg.Path(AbsUsrSrc.Append("hakurei"), true, pkg.NewHTTPGetTar( + nil, "https://git.gensokyo.uk/security/hakurei/archive/"+ + "v"+version+".tar.gz", + mustDecode(checksum), + pkg.TarGzip, + )), 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() { artifactsF[Hakurei] = Toolchain.newHakurei }