Compare commits
12 Commits
master
...
90df5c13fb
| Author | SHA1 | Date | |
|---|---|---|---|
|
90df5c13fb
|
|||
|
3b5b903f0e
|
|||
|
443db2d03d
|
|||
|
f2d883ee8c
|
|||
|
536e3c97ea
|
|||
|
6a59d7df86
|
|||
|
e198a98daa
|
|||
|
4f0841e1eb
|
|||
|
90804b5653
|
|||
|
98b37cedf3
|
|||
|
f57d7fda33
|
|||
|
fce0375aef
|
1
cmd/dist/VERSION
vendored
1
cmd/dist/VERSION
vendored
@@ -1 +0,0 @@
|
|||||||
v0.4.3
|
|
||||||
7
cmd/dist/main.go
vendored
7
cmd/dist/main.go
vendored
@@ -18,13 +18,8 @@ import (
|
|||||||
"os/signal"
|
"os/signal"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:generate sh -c "git describe --tags > VERSION"
|
|
||||||
//go:embed VERSION
|
|
||||||
var version string
|
|
||||||
|
|
||||||
// getenv looks up an environment variable, and returns fallback if it is unset.
|
// getenv looks up an environment variable, and returns fallback if it is unset.
|
||||||
func getenv(key, fallback string) string {
|
func getenv(key, fallback string) string {
|
||||||
if v, ok := os.LookupEnv(key); ok {
|
if v, ok := os.LookupEnv(key); ok {
|
||||||
@@ -52,7 +47,7 @@ func main() {
|
|||||||
|
|
||||||
verbose := os.Getenv("VERBOSE") != ""
|
verbose := os.Getenv("VERBOSE") != ""
|
||||||
runTests := os.Getenv("HAKUREI_DIST_MAKE") == ""
|
runTests := os.Getenv("HAKUREI_DIST_MAKE") == ""
|
||||||
version = getenv("HAKUREI_VERSION", strings.TrimSpace(version))
|
version := getenv("HAKUREI_VERSION", "untagged")
|
||||||
prefix := getenv("PREFIX", "/usr")
|
prefix := getenv("PREFIX", "/usr")
|
||||||
destdir := getenv("DESTDIR", "dist")
|
destdir := getenv("DESTDIR", "dist")
|
||||||
|
|
||||||
|
|||||||
@@ -39,13 +39,14 @@ func commandInfo(
|
|||||||
t := rosa.Native().Std()
|
t := rosa.Native().Std()
|
||||||
for i, name := range args {
|
for i, name := range args {
|
||||||
handle := rosa.ArtifactH(unique.Make(name))
|
handle := rosa.ArtifactH(unique.Make(name))
|
||||||
if meta, a := t.Load(handle); meta == nil {
|
if meta := rosa.Native().Get(handle); meta == nil {
|
||||||
return fmt.Errorf("unknown artifact %q", name)
|
return fmt.Errorf("unknown artifact %q", name)
|
||||||
} else {
|
} else {
|
||||||
var suffix string
|
var suffix string
|
||||||
|
|
||||||
if meta.Version != rosa.Unversioned {
|
a, version := t.MustLoad(handle)
|
||||||
suffix += "-" + meta.Version
|
if version != rosa.Unversioned {
|
||||||
|
suffix += "-" + version
|
||||||
}
|
}
|
||||||
mustPrintln("name : " + name + suffix)
|
mustPrintln("name : " + name + suffix)
|
||||||
|
|
||||||
@@ -57,10 +58,9 @@ func commandInfo(
|
|||||||
if len(meta.Dependencies) > 0 {
|
if len(meta.Dependencies) > 0 {
|
||||||
mustPrint("depends on :")
|
mustPrint("depends on :")
|
||||||
for _, d := range meta.Dependencies {
|
for _, d := range meta.Dependencies {
|
||||||
_meta, _ := rosa.Native().Std().MustLoad(d)
|
s := rosa.Native().MustGet(d).Name
|
||||||
s := _meta.Name
|
if _, _version := t.Load(d); _version != rosa.Unversioned {
|
||||||
if _meta.Version != rosa.Unversioned {
|
s += "-" + _version
|
||||||
s += "-" + _meta.Version
|
|
||||||
}
|
}
|
||||||
mustPrint(" " + s)
|
mustPrint(" " + s)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ func TestInfo(t *testing.T) {
|
|||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
_t := rosa.Native().Std()
|
_t := rosa.Native().Std()
|
||||||
qemuMeta, _ := _t.Load(rosa.H("qemu"))
|
_, qemuVersion := _t.Load(rosa.QEMU)
|
||||||
glibMeta, _ := _t.Load(rosa.H("glib"))
|
_, glibVersion := _t.Load(rosa.GLib)
|
||||||
zlibMeta, zlib := _t.Load(rosa.H("zlib"))
|
zlib, zlibVersion := _t.Load(rosa.Zlib)
|
||||||
zstdMeta, _ := _t.Load(rosa.H("zstd"))
|
_, zstdVersion := _t.Load(rosa.Zstd)
|
||||||
hakureiMeta, _ := _t.Load(rosa.H("hakurei"))
|
_, hakureiVersion := _t.Load(rosa.Hakurei)
|
||||||
hakureiDistMeta, _ := _t.Load(rosa.H("hakurei-dist"))
|
_, hakureiDistVersion := _t.Load(rosa.HakureiDist)
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
@@ -38,24 +38,24 @@ func TestInfo(t *testing.T) {
|
|||||||
wantErr any
|
wantErr any
|
||||||
}{
|
}{
|
||||||
{"qemu", []string{"qemu"}, nil, "", `
|
{"qemu", []string{"qemu"}, nil, "", `
|
||||||
name : qemu-` + qemuMeta.Version + `
|
name : qemu-` + qemuVersion + `
|
||||||
description : a generic and open source machine emulator and virtualizer
|
description : a generic and open source machine emulator and virtualizer
|
||||||
website : https://www.qemu.org
|
website : https://www.qemu.org
|
||||||
depends on : glib-` + glibMeta.Version + ` zstd-` + zstdMeta.Version + `
|
depends on : glib-` + glibVersion + ` zstd-` + zstdVersion + `
|
||||||
`, nil},
|
`, nil},
|
||||||
|
|
||||||
{"multi", []string{"hakurei", "hakurei-dist"}, nil, "", `
|
{"multi", []string{"hakurei", "hakurei-dist"}, nil, "", `
|
||||||
name : hakurei-` + hakureiMeta.Version + `
|
name : hakurei-` + hakureiVersion + `
|
||||||
description : low-level userspace tooling for Rosa OS
|
description : low-level userspace tooling for Rosa OS
|
||||||
website : https://hakurei.app
|
website : https://hakurei.app
|
||||||
|
|
||||||
name : hakurei-dist-` + hakureiDistMeta.Version + `
|
name : hakurei-dist-` + hakureiDistVersion + `
|
||||||
description : low-level userspace tooling for Rosa OS (distribution tarball)
|
description : low-level userspace tooling for Rosa OS (distribution tarball)
|
||||||
website : https://hakurei.app
|
website : https://hakurei.app
|
||||||
`, nil},
|
`, nil},
|
||||||
|
|
||||||
{"nonexistent", []string{"zlib", "\x00"}, nil, "", `
|
{"nonexistent", []string{"zlib", "\x00"}, nil, "", `
|
||||||
name : zlib-` + zlibMeta.Version + `
|
name : zlib-` + zlibVersion + `
|
||||||
description : lossless data-compression library
|
description : lossless data-compression library
|
||||||
website : https://zlib.net
|
website : https://zlib.net
|
||||||
|
|
||||||
@@ -65,12 +65,12 @@ website : https://zlib.net
|
|||||||
"zstd": "internal/pkg (amd64) on satori\n",
|
"zstd": "internal/pkg (amd64) on satori\n",
|
||||||
"hakurei": "internal/pkg (amd64) on satori\n\n",
|
"hakurei": "internal/pkg (amd64) on satori\n\n",
|
||||||
}, "", `
|
}, "", `
|
||||||
name : zlib-` + zlibMeta.Version + `
|
name : zlib-` + zlibVersion + `
|
||||||
description : lossless data-compression library
|
description : lossless data-compression library
|
||||||
website : https://zlib.net
|
website : https://zlib.net
|
||||||
status : not yet cured
|
status : not yet cured
|
||||||
|
|
||||||
name : zstd-` + zstdMeta.Version + `
|
name : zstd-` + zstdVersion + `
|
||||||
description : a fast compression algorithm
|
description : a fast compression algorithm
|
||||||
website : https://facebook.github.io/zstd
|
website : https://facebook.github.io/zstd
|
||||||
status : internal/pkg (amd64) on satori
|
status : internal/pkg (amd64) on satori
|
||||||
@@ -79,7 +79,7 @@ status : internal/pkg (amd64) on satori
|
|||||||
{"status cache perm", []string{"zlib"}, map[string]string{
|
{"status cache perm", []string{"zlib"}, map[string]string{
|
||||||
"zlib": "\x00",
|
"zlib": "\x00",
|
||||||
}, "", `
|
}, "", `
|
||||||
name : zlib-` + zlibMeta.Version + `
|
name : zlib-` + zlibVersion + `
|
||||||
description : lossless data-compression library
|
description : lossless data-compression library
|
||||||
website : https://zlib.net
|
website : https://zlib.net
|
||||||
`, func(cm *cache) error {
|
`, func(cm *cache) error {
|
||||||
@@ -91,7 +91,7 @@ website : https://zlib.net
|
|||||||
}},
|
}},
|
||||||
|
|
||||||
{"status report", []string{"zlib"}, nil, strings.Repeat("\x00", len(pkg.Checksum{})+8), `
|
{"status report", []string{"zlib"}, nil, strings.Repeat("\x00", len(pkg.Checksum{})+8), `
|
||||||
name : zlib-` + zlibMeta.Version + `
|
name : zlib-` + zlibVersion + `
|
||||||
description : lossless data-compression library
|
description : lossless data-compression library
|
||||||
website : https://zlib.net
|
website : https://zlib.net
|
||||||
status : not in report
|
status : not in report
|
||||||
@@ -140,7 +140,7 @@ status : not in report
|
|||||||
|
|
||||||
if tc.status != nil {
|
if tc.status != nil {
|
||||||
for name, status := range tc.status {
|
for name, status := range tc.status {
|
||||||
_, a := _t.Load(rosa.ArtifactH(unique.Make(name)))
|
a, _ := _t.Load(rosa.ArtifactH(unique.Make(name)))
|
||||||
if a == nil {
|
if a == nil {
|
||||||
t.Fatalf("invalid name %q", name)
|
t.Fatalf("invalid name %q", name)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ var (
|
|||||||
// handleInfo writes constant system information.
|
// handleInfo writes constant system information.
|
||||||
func handleInfo(w http.ResponseWriter, _ *http.Request) {
|
func handleInfo(w http.ResponseWriter, _ *http.Request) {
|
||||||
infoPayloadOnce.Do(func() {
|
infoPayloadOnce.Do(func() {
|
||||||
infoPayload.Count = len(rosa.Native().Collect())
|
infoPayload.Count = int(rosa.Native().Count())
|
||||||
infoPayload.HakureiVersion = info.Version()
|
infoPayload.HakureiVersion = info.Version()
|
||||||
})
|
})
|
||||||
// TODO(mae): cache entire response if no additional fields are planned
|
// TODO(mae): cache entire response if no additional fields are planned
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ func TestAPIInfo(t *testing.T) {
|
|||||||
checkPayload(t, resp, struct {
|
checkPayload(t, resp, struct {
|
||||||
Count int `json:"count"`
|
Count int `json:"count"`
|
||||||
HakureiVersion string `json:"hakurei_version"`
|
HakureiVersion string `json:"hakurei_version"`
|
||||||
}{len(rosa.Native().Collect()), info.Version()})
|
}{rosa.Native().Count(), info.Version()})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAPIGet(t *testing.T) {
|
func TestAPIGet(t *testing.T) {
|
||||||
@@ -92,12 +92,11 @@ func TestAPIGet(t *testing.T) {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
count := len(rosa.Native().Collect())
|
|
||||||
t.Run("index", func(t *testing.T) {
|
t.Run("index", func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
checkValidate(
|
checkValidate(
|
||||||
t, "limit=1&sort=0&index", 0, count-1,
|
t, "limit=1&sort=0&index", 0, rosa.Native().Count()-1,
|
||||||
"index must be an integer between 0 and "+strconv.Itoa(count-1),
|
"index must be an integer between 0 and "+strconv.Itoa(rosa.Native().Count()-1),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -33,10 +33,10 @@ type packageIndex struct {
|
|||||||
// metadata holds [rosa.Metadata] extended with additional information.
|
// metadata holds [rosa.Metadata] extended with additional information.
|
||||||
type metadata struct {
|
type metadata struct {
|
||||||
handle rosa.ArtifactH
|
handle rosa.ArtifactH
|
||||||
*rosa.Metadata
|
*rosa.Artifact
|
||||||
|
|
||||||
// Copied from [rosa.Metadata], [rosa.Unversioned] is equivalent to the zero
|
// Populated via [rosa.Toolchain.Version], [rosa.Unversioned] is equivalent
|
||||||
// value. Otherwise, the zero value is invalid.
|
// to the zero value. Otherwise, the zero value is invalid.
|
||||||
Version string `json:"version,omitempty"`
|
Version string `json:"version,omitempty"`
|
||||||
// Output data size, available if present in report.
|
// Output data size, available if present in report.
|
||||||
Size int64 `json:"size,omitempty"`
|
Size int64 `json:"size,omitempty"`
|
||||||
@@ -61,12 +61,12 @@ func (index *packageIndex) populate(report *rosa.Report) (err error) {
|
|||||||
index.names = make(map[string]*metadata)
|
index.names = make(map[string]*metadata)
|
||||||
ir := pkg.NewIR()
|
ir := pkg.NewIR()
|
||||||
for i, handle := range handles {
|
for i, handle := range handles {
|
||||||
meta, a := rosa.Native().Std().MustLoad(handle)
|
a, version := rosa.Native().Std().MustLoad(handle)
|
||||||
m := metadata{
|
m := metadata{
|
||||||
handle: handle,
|
handle: handle,
|
||||||
|
|
||||||
Metadata: meta,
|
Artifact: rosa.Native().MustGet(handle),
|
||||||
Version: meta.Version,
|
Version: version,
|
||||||
}
|
}
|
||||||
if m.Version == "" {
|
if m.Version == "" {
|
||||||
return errors.New("invalid version from " + m.Name)
|
return errors.New("invalid version from " + m.Name)
|
||||||
|
|||||||
2
cmd/mbf/internal/pkgserver/ui/all_tests.ts
Normal file
2
cmd/mbf/internal/pkgserver/ui/all_tests.ts
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
// Import all test files to register their test suites.
|
||||||
|
import "./index_test.js";
|
||||||
@@ -5,11 +5,11 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="stylesheet" href="style.css">
|
<link rel="stylesheet" href="style.css">
|
||||||
<link rel="icon" href="https://hakurei.app/favicon.ico"/>
|
<link rel="icon" href="https://hakurei.app/favicon.ico"/>
|
||||||
<title>Rosa OS Packages</title>
|
<title>Hakurei PkgServer</title>
|
||||||
<script src="index.js"></script>
|
<script src="index.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Rosa OS Packages</h1>
|
<h1>Hakurei PkgServer</h1>
|
||||||
<div class="top-controls" id="top-controls-regular">
|
<div class="top-controls" id="top-controls-regular">
|
||||||
<p>Showing entries <span id="entry-counter"></span>.</p>
|
<p>Showing entries <span id="entry-counter"></span>.</p>
|
||||||
<span id="search-bar">
|
<span id="search-bar">
|
||||||
|
|||||||
2
cmd/mbf/internal/pkgserver/ui/index_test.ts
Normal file
2
cmd/mbf/internal/pkgserver/ui/index_test.ts
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
import { suite, test } from "./jstest/jstest.js";
|
||||||
|
import "./index.js";
|
||||||
48
cmd/mbf/internal/pkgserver/ui/jstest/cli.ts
Normal file
48
cmd/mbf/internal/pkgserver/ui/jstest/cli.ts
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
// Many editors have terminal emulators built in, so running tests with NodeJS
|
||||||
|
// provides faster iteration, especially for those acclimated to test-driven
|
||||||
|
// development.
|
||||||
|
|
||||||
|
import "../all_tests.js";
|
||||||
|
import { StreamReporter, GLOBAL_REGISTRAR } from "./jstest.js";
|
||||||
|
|
||||||
|
// TypeScript doesn't like process and Deno as their type definitions aren't
|
||||||
|
// installed, but doesn't seem to complain if they're accessed through
|
||||||
|
// globalThis.
|
||||||
|
const process: any = (globalThis as any).process;
|
||||||
|
const Deno: any = (globalThis as any).Deno;
|
||||||
|
|
||||||
|
function getArgs(): string[] {
|
||||||
|
if (process) {
|
||||||
|
const [runtime, program, ...args] = process.argv;
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
if (Deno) return Deno.args;
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
function exit(code?: number): never {
|
||||||
|
if (Deno) Deno.exit(code);
|
||||||
|
if (process) process.exit(code);
|
||||||
|
throw `exited with code ${code ?? 0}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const args = getArgs();
|
||||||
|
let verbose = false;
|
||||||
|
if (args.length > 1) {
|
||||||
|
console.error("Too many arguments");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (args.length === 1) {
|
||||||
|
if (args[0] === "-v" || args[0] === "--verbose" || args[0] === "-verbose") {
|
||||||
|
verbose = true;
|
||||||
|
} else if (args[0] !== "--") {
|
||||||
|
console.error(`Unknown argument '${args[0]}'`);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let reporter = new StreamReporter({ writeln: console.log }, verbose);
|
||||||
|
GLOBAL_REGISTRAR.run(reporter);
|
||||||
|
exit(reporter.succeeded() ? 0 : 1);
|
||||||
13
cmd/mbf/internal/pkgserver/ui/jstest/failure-closed.svg
Normal file
13
cmd/mbf/internal/pkgserver/ui/jstest/failure-closed.svg
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- See failure-open.svg for an explanation of the view box dimensions. -->
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" viewBox="-20,-20 160 130">
|
||||||
|
<!-- This triangle should match success-closed.svg, fill and stroke color notwithstanding. -->
|
||||||
|
<polygon points="0,0 100,50 0,100" fill="red" stroke="red" stroke-width="15" stroke-linejoin="round"/>
|
||||||
|
<!--
|
||||||
|
! y-coordinates go before x-coordinates here to highlight the difference
|
||||||
|
! (or, lack thereof) between these numbers and the ones in failure-open.svg;
|
||||||
|
! try a textual diff. Make sure to keep the numbers in sync!
|
||||||
|
-->
|
||||||
|
<line y1="30" x1="10" y2="70" x2="50" stroke="white" stroke-width="16"/>
|
||||||
|
<line y1="30" x1="50" y2="70" x2="10" stroke="white" stroke-width="16"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 788 B |
35
cmd/mbf/internal/pkgserver/ui/jstest/failure-open.svg
Normal file
35
cmd/mbf/internal/pkgserver/ui/jstest/failure-open.svg
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!--
|
||||||
|
! This view box is a bit weird: the strokes assume they're working in a view
|
||||||
|
! box that spans from the (0,0) to (100,100), and indeed that is convenient
|
||||||
|
! conceptualizing the strokes, but the stroke itself has a considerable width
|
||||||
|
! that gets clipped by restrictive view box dimensions. Hence, the view is
|
||||||
|
! shifted from (0,0)–(100,100) to (-20,-20)–(120,120), to make room for the
|
||||||
|
! clipped stroke, while leaving behind an illusion of working in a view box
|
||||||
|
! spanning from (0,0) to (100,100).
|
||||||
|
!
|
||||||
|
! However, the resulting SVG is too close to the summary text, and CSS
|
||||||
|
! properties to add padding do not seem to work with `content:` (likely because
|
||||||
|
! they're anonymous replaced elements); thus, the width of the view is
|
||||||
|
! increased considerably to provide padding in the SVG itself, while leaving
|
||||||
|
! the strokes oblivious.
|
||||||
|
!
|
||||||
|
! It gets worse: the summary text isn't vertically aligned with the icon! As
|
||||||
|
! a flexbox cannot be used in a summary to align the marker with the text, the
|
||||||
|
! simplest and most effective solution is to reduce the height of the view box
|
||||||
|
! from 140 to 130, thereby removing some of the bottom padding present.
|
||||||
|
!
|
||||||
|
! All six SVGs use the same view box (and indeed, they refer to this comment)
|
||||||
|
! so that they all appear to be the same size and position relative to each
|
||||||
|
! other on the DOM—indeed, the view box dimensions, alongside the width,
|
||||||
|
! directly control their placement on the DOM.
|
||||||
|
!
|
||||||
|
! TL;DR: CSS is janky, overflow is weird, and SVG is awesome!
|
||||||
|
-->
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" viewBox="-20,-20 160 130">
|
||||||
|
<!-- This triangle should match success-open.svg, fill and stroke color notwithstanding. -->
|
||||||
|
<polygon points="0,0 100,0 50,100" fill="red" stroke="red" stroke-width="15" stroke-linejoin="round"/>
|
||||||
|
<!-- See the comment in failure-closed.svg before modifying this. -->
|
||||||
|
<line x1="30" y1="10" x2="70" y2="50" stroke="white" stroke-width="16"/>
|
||||||
|
<line x1="30" y1="50" x2="70" y2="10" stroke="white" stroke-width="16"/>
|
||||||
|
</svg>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import "../all_tests.js";
|
||||||
|
import { GoTestReporter, GLOBAL_REGISTRAR } from "./jstest.js";
|
||||||
|
GLOBAL_REGISTRAR.run(new GoTestReporter());
|
||||||
39
cmd/mbf/internal/pkgserver/ui/jstest/index.html
Normal file
39
cmd/mbf/internal/pkgserver/ui/jstest/index.html
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="stylesheet" href="./style.css">
|
||||||
|
<title>PkgServer Tests</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
I hate JavaScript as much as you, but this page runs tests written in
|
||||||
|
JavaScript to test the functionality of code written in JavaScript, so it
|
||||||
|
wouldn't make sense for it to work without JavaScript. <strong>Please turn
|
||||||
|
JavaScript on!</strong>
|
||||||
|
</noscript>
|
||||||
|
|
||||||
|
<h1>PkgServer Tests</h1>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<p id="counters">
|
||||||
|
<span id="success-counter">0</span> succeeded, <span id="failure-counter">0</span>
|
||||||
|
failed<span id="skip-counter-text" hidden>, <span id="skip-counter">0</span> skipped</span>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p hidden id="success-description">Successful test</p>
|
||||||
|
<p hidden id="failure-description">Failed test</p>
|
||||||
|
<p hidden id="skip-description">Partially or fully skipped test</p>
|
||||||
|
|
||||||
|
<div id="root">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="module">
|
||||||
|
import "../all_tests.js";
|
||||||
|
import { DOMReporter, GLOBAL_REGISTRAR } from "./jstest.js";
|
||||||
|
GLOBAL_REGISTRAR.run(new DOMReporter());
|
||||||
|
</script>
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
478
cmd/mbf/internal/pkgserver/ui/jstest/jstest.ts
Normal file
478
cmd/mbf/internal/pkgserver/ui/jstest/jstest.ts
Normal file
@@ -0,0 +1,478 @@
|
|||||||
|
// =============================================================================
|
||||||
|
// DSL
|
||||||
|
|
||||||
|
type TestTree = TestGroup | Test;
|
||||||
|
type TestGroup = { name: string; children: TestTree[] };
|
||||||
|
type Test = { name: string; test: (t: TestController) => void };
|
||||||
|
|
||||||
|
// A registrar provides a central location to register test suites.
|
||||||
|
export class TestRegistrar {
|
||||||
|
// Note that, while this is equivalent to a new tree node sans a name, the
|
||||||
|
// lack of a name provides the illusion of multiple “top-level” suites,
|
||||||
|
// while still allowing reporters to pick their favorite name—say, “JS
|
||||||
|
// tests”—were they to need to label all suites together.
|
||||||
|
#suites: TestGroup[];
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.#suites = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
suite(name: string, children: TestTree[]) {
|
||||||
|
checkDuplicates(name, children);
|
||||||
|
this.#suites.push({ name, children });
|
||||||
|
}
|
||||||
|
|
||||||
|
run(reporter: Reporter) {
|
||||||
|
reporter.register(this.#suites);
|
||||||
|
for (const suite of this.#suites) {
|
||||||
|
for (const c of suite.children) runTests(reporter, [suite.name], c);
|
||||||
|
}
|
||||||
|
reporter.finalize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export let GLOBAL_REGISTRAR = new TestRegistrar();
|
||||||
|
|
||||||
|
// Register a suite in the global registrar.
|
||||||
|
export function suite(name: string, children: TestTree[]) {
|
||||||
|
GLOBAL_REGISTRAR.suite(name, children);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function group(name: string, children: TestTree[]): TestTree {
|
||||||
|
checkDuplicates(name, children);
|
||||||
|
return { name, children };
|
||||||
|
}
|
||||||
|
export const context = group;
|
||||||
|
export const describe = group;
|
||||||
|
|
||||||
|
export function test(name: string, test: (t: TestController) => void): TestTree {
|
||||||
|
return { name, test };
|
||||||
|
}
|
||||||
|
|
||||||
|
// While this function could certainly refine the type to a map instead of
|
||||||
|
// simply checking for duplicates and discarding that knowledge, these test
|
||||||
|
// trees are primarily for flooding—that is, iteration—for which an array is
|
||||||
|
// better suited.
|
||||||
|
function checkDuplicates(parent: string, names: { name: string }[]) {
|
||||||
|
let seen = new Set<string>();
|
||||||
|
for (const { name } of names) {
|
||||||
|
if (seen.has(name)) {
|
||||||
|
throw new RangeError(`duplicate name '${name}' in '${parent}'`);
|
||||||
|
}
|
||||||
|
seen.add(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TestState = "success" | "failure" | "skip";
|
||||||
|
|
||||||
|
class AbortSentinel {}
|
||||||
|
|
||||||
|
export class TestController {
|
||||||
|
#state: TestState;
|
||||||
|
logs: string[];
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.#state = "success";
|
||||||
|
this.logs = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
getState(): TestState {
|
||||||
|
return this.#state;
|
||||||
|
}
|
||||||
|
|
||||||
|
fail() {
|
||||||
|
this.#state = "failure";
|
||||||
|
}
|
||||||
|
|
||||||
|
failed(): boolean {
|
||||||
|
return this.#state === "failure";
|
||||||
|
}
|
||||||
|
|
||||||
|
failNow(): never {
|
||||||
|
this.fail();
|
||||||
|
throw new AbortSentinel();
|
||||||
|
}
|
||||||
|
|
||||||
|
log(message: string) {
|
||||||
|
this.logs.push(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
error(message: string) {
|
||||||
|
this.log(message);
|
||||||
|
this.fail();
|
||||||
|
}
|
||||||
|
|
||||||
|
fatal(message: string): never {
|
||||||
|
this.log(message);
|
||||||
|
this.failNow();
|
||||||
|
}
|
||||||
|
|
||||||
|
skip(message?: string): never {
|
||||||
|
if (message != null) this.log(message);
|
||||||
|
if (this.#state !== "failure") this.#state = "skip";
|
||||||
|
throw new AbortSentinel();
|
||||||
|
}
|
||||||
|
|
||||||
|
skipped(): boolean {
|
||||||
|
return this.#state === "skip";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// =============================================================================
|
||||||
|
// Execution
|
||||||
|
|
||||||
|
export interface TestResult {
|
||||||
|
state: TestState;
|
||||||
|
logs: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
function runTests(reporter: Reporter, parents: string[], node: TestTree) {
|
||||||
|
const path = [...parents, node.name];
|
||||||
|
if ("children" in node) {
|
||||||
|
for (const c of node.children) runTests(reporter, path, c);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let controller = new TestController();
|
||||||
|
try {
|
||||||
|
node.test(controller);
|
||||||
|
} catch (e) {
|
||||||
|
if (!(e instanceof AbortSentinel)) {
|
||||||
|
controller.error(extractExceptionString(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reporter.update(path, { state: controller.getState(), logs: controller.logs });
|
||||||
|
}
|
||||||
|
|
||||||
|
function extractExceptionString(e: any): string {
|
||||||
|
// String() instead of .toString() as null and undefined don't have
|
||||||
|
// properties.
|
||||||
|
const s = String(e);
|
||||||
|
if (!(e instanceof Error && e.stack)) return s;
|
||||||
|
// v8 (Chromium, NodeJS) includes the error message, while Firefox and
|
||||||
|
// WebKit do not.
|
||||||
|
if (e.stack.startsWith(s)) return e.stack;
|
||||||
|
return `${s}\n${e.stack}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// =============================================================================
|
||||||
|
// Reporting
|
||||||
|
|
||||||
|
export interface Reporter {
|
||||||
|
// A notable feature—or flaw, to some—of the DSL is that the tree of tests
|
||||||
|
// is statically known, which might greatly aid in implementing a reporter.
|
||||||
|
register(suites: TestGroup[]): void;
|
||||||
|
// While we could simply call a function with a tree representing all
|
||||||
|
// results, which would indeed greatly simplify implementation of reporters,
|
||||||
|
// simply registering a path and allowing the reporter to—either implicitly
|
||||||
|
// or explicitly—construct a tree themselves allows for results to be
|
||||||
|
// *incrementally reported*, instead of a great deal of silence until all
|
||||||
|
// tests finish.
|
||||||
|
update(path: string[], result: TestResult): void;
|
||||||
|
// With just update(), the reporter never knows when all tests have
|
||||||
|
// completed. The simplest possible use for this is to notify the user, but
|
||||||
|
// its intent is actually more tailored to the StreamReporter scenario:
|
||||||
|
// while destructively updated report rendering (as with a tree of DOM nodes
|
||||||
|
// which are mutated) always displays the results in a structured manner
|
||||||
|
// matching that of the tests, “rerendering” or otherwise destructively
|
||||||
|
// updating the rendered output might be infeasible in some paradigms, such
|
||||||
|
// as command-line applications—all existing implementations of such
|
||||||
|
// rendering both mess up the scrollback position and necessarily crop out
|
||||||
|
// some of the data at the bottom (since the top of the tree is forced to be
|
||||||
|
// at the top of the screen, as one cannot unscroll portably). Explicitly
|
||||||
|
// signaling to the reporter that no more results will be received permits
|
||||||
|
// it to simply display live test progress linearly, while building up
|
||||||
|
// a tree and displaying it once it's known the tree is complete.
|
||||||
|
finalize(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A reporter that diligently reports absolutely nothing. This is essentially
|
||||||
|
// a way to “undo” the incremental reporting update() provides, getting back the
|
||||||
|
// underlying result tree; this makes it extremely convenient in some cases like
|
||||||
|
// testing ourself.
|
||||||
|
export class NoOpReporter implements Reporter {
|
||||||
|
suites: TestGroup[];
|
||||||
|
results: ({ path: string[] } & TestResult)[];
|
||||||
|
finalized: boolean;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.suites = [];
|
||||||
|
this.results = [];
|
||||||
|
this.finalized = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
register(suites: TestGroup[]) {
|
||||||
|
this.suites = suites;
|
||||||
|
}
|
||||||
|
|
||||||
|
update(path: string[], result: TestResult) {
|
||||||
|
this.results.push({ path, ...result });
|
||||||
|
}
|
||||||
|
|
||||||
|
finalize() {
|
||||||
|
this.finalized = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Stream {
|
||||||
|
writeln(s: string): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const SEP = " ❯ ";
|
||||||
|
|
||||||
|
// A simple reporter that outputs to some stream; suitable for CLIs.
|
||||||
|
export class StreamReporter implements Reporter {
|
||||||
|
stream: Stream;
|
||||||
|
verbose: boolean;
|
||||||
|
#successes: ({ path: string[] } & TestResult)[];
|
||||||
|
#failures: ({ path: string[] } & TestResult)[];
|
||||||
|
#skips: ({ path: string[] } & TestResult)[];
|
||||||
|
|
||||||
|
constructor(stream: Stream, verbose: boolean = false) {
|
||||||
|
this.stream = stream;
|
||||||
|
this.verbose = verbose;
|
||||||
|
this.#successes = [];
|
||||||
|
this.#failures = [];
|
||||||
|
this.#skips = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
succeeded(): boolean {
|
||||||
|
return this.#successes.length > 0 && this.#failures.length === 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We don't need the structure for reporting.
|
||||||
|
register(suites: TestGroup[]) {}
|
||||||
|
|
||||||
|
update(path: string[], result: TestResult) {
|
||||||
|
if (path.length === 0) throw new RangeError("path is empty");
|
||||||
|
const pathStr = path.join(SEP);
|
||||||
|
switch (result.state) {
|
||||||
|
case "success":
|
||||||
|
this.#successes.push({ path, ...result });
|
||||||
|
// NOTE: emojis are used instead of colored Unicode symbols as
|
||||||
|
// coloring isn't possible through all streams and detecting if
|
||||||
|
// colors should be used is very difficult¹. Furthermore, ensuring
|
||||||
|
// reasonable contrast is retained on every possible theme is
|
||||||
|
// difficult, with reverse video often being the only way (which
|
||||||
|
// also has questionable support across terminal emulators), and the
|
||||||
|
// Unicode characters might be too small to be immediately
|
||||||
|
// noticeable—consider ✓ and ⚠ and ✗. Emojis have an upper hand in
|
||||||
|
// that they're more common than obscure Unicode characters—which
|
||||||
|
// also means you're likely to have an emoji font but not a font for
|
||||||
|
// some weird symbols—and that they're double-width. Finally,
|
||||||
|
// Unicode characters are often very different across fonts; some
|
||||||
|
// fonts make ⚠ filled in, while others have just an outline for the
|
||||||
|
// triangle (which is much harder to comprehend), and the various
|
||||||
|
// crosses like all of x ⨯ × ✕ ✖ ✗ 🗙 🞨 🞩 🞪 🞫 🞬 🞭 🞮 look different
|
||||||
|
// across different fonts, which makes using them for some specific
|
||||||
|
// purpose difficult. Emojis don't have this problem because emoji
|
||||||
|
// vendors try to make them look similar to each other.
|
||||||
|
//
|
||||||
|
// ¹This necessitates checking if the stream is a TTY, checking if
|
||||||
|
// $TERM is `dumb` when connected to a TTY, checking
|
||||||
|
// https://no-color.org, https://bixense.com/clicolors, and
|
||||||
|
// https://force-color.org, checking if setting the
|
||||||
|
// ENABLE_VIRTUAL_TERMINAL_PROCESSING bit on the TTY works when on
|
||||||
|
// on Windows, and doing something similar for Cygwin.
|
||||||
|
if (this.verbose) this.stream.writeln(`✅️ ${pathStr}`);
|
||||||
|
break;
|
||||||
|
case "failure":
|
||||||
|
this.#failures.push({ path, ...result });
|
||||||
|
this.stream.writeln(`⚠️ ${pathStr}`);
|
||||||
|
break;
|
||||||
|
case "skip":
|
||||||
|
this.#skips.push({ path, ...result });
|
||||||
|
this.stream.writeln(`⏭️ ${pathStr}`);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
finalize() {
|
||||||
|
if (this.verbose) this.#displaySection("successes", this.#successes, true);
|
||||||
|
this.#displaySection("failures", this.#failures);
|
||||||
|
this.#displaySection("skips", this.#skips);
|
||||||
|
this.stream.writeln("");
|
||||||
|
this.stream.writeln(
|
||||||
|
`${this.#successes.length} succeeded, ${this.#failures.length} failed` +
|
||||||
|
(this.#skips.length ? `, ${this.#skips.length} skipped` : ""),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#displaySection(name: string, data: ({ path: string[] } & TestResult)[], ignoreEmpty: boolean = false) {
|
||||||
|
if (!data.length) return;
|
||||||
|
|
||||||
|
// Transform [{ path: ["a", "b", "c"] }, { path: ["a", "b", "d"] }] into
|
||||||
|
// { "a ❯ b": ["c", "d"] }. NOTE: intermediate nodes are collapsed as
|
||||||
|
// excessive nesting is difficult to convey clearly in a text-only
|
||||||
|
// environment.
|
||||||
|
let pathMap = new Map<string, ({ name: string } & TestResult)[]>();
|
||||||
|
for (const t of data) {
|
||||||
|
if (t.path.length === 0) throw new RangeError("path is empty");
|
||||||
|
const key = t.path.slice(0, -1).join(SEP);
|
||||||
|
if (!pathMap.has(key)) pathMap.set(key, []);
|
||||||
|
pathMap.get(key)!.push({ name: t.path.at(-1)!, ...t });
|
||||||
|
}
|
||||||
|
|
||||||
|
this.stream.writeln("");
|
||||||
|
this.stream.writeln(name.toUpperCase());
|
||||||
|
this.stream.writeln("=".repeat(name.length));
|
||||||
|
|
||||||
|
for (let [path, tests] of pathMap) {
|
||||||
|
if (ignoreEmpty) tests = tests.filter((t) => t.logs.length);
|
||||||
|
if (tests.length === 0) continue;
|
||||||
|
if (tests.length === 1) {
|
||||||
|
this.#writeOutput(tests[0], path ? `${path}${SEP}` : "", false);
|
||||||
|
} else {
|
||||||
|
this.stream.writeln(path);
|
||||||
|
for (const t of tests) this.#writeOutput(t, " - ", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#writeOutput(test: { name: string } & TestResult, prefix: string, nested: boolean) {
|
||||||
|
let output = "";
|
||||||
|
if (test.logs.length) {
|
||||||
|
// Individual logs might span multiple lines, so join them together
|
||||||
|
// then split it again.
|
||||||
|
const logStr = test.logs.join("\n");
|
||||||
|
const lines = logStr.split("\n");
|
||||||
|
if (lines.length <= 1) {
|
||||||
|
output = `: ${logStr}`;
|
||||||
|
} else {
|
||||||
|
const padding = nested ? " " : " ";
|
||||||
|
output = ":\n" + lines.map((line) => padding + line).join("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.stream.writeln(`${prefix}${test.name}${output}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertGetElementById(id: string): HTMLElement {
|
||||||
|
let elem = document.getElementById(id);
|
||||||
|
if (elem == null) throw new ReferenceError(`element with ID '${id}' missing from DOM`);
|
||||||
|
return elem;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A reporter that directly translates a tree of results into a tree of
|
||||||
|
// collapsible elements in the DOM.
|
||||||
|
export class DOMReporter implements Reporter {
|
||||||
|
// It is very difficult to implement this using the statically known tree,
|
||||||
|
// because Map doesn't handle array keys properly (to store the path), and
|
||||||
|
// it's unknown of there's any way to implement it without writing one's own
|
||||||
|
// data types. Oh well; using the DOM as a data structure might seem hacky
|
||||||
|
// but it does have its benefits, apart from encouraging a tagless final.
|
||||||
|
register(suites: TestGroup[]) {}
|
||||||
|
|
||||||
|
update(path: string[], result: TestResult) {
|
||||||
|
if (path.length === 0) throw new RangeError("path is empty");
|
||||||
|
if (result.state === "skip") {
|
||||||
|
assertGetElementById("skip-counter-text").hidden = false;
|
||||||
|
}
|
||||||
|
const counter = assertGetElementById(`${result.state}-counter`);
|
||||||
|
counter.innerText = (Number(counter.innerText) + 1).toString();
|
||||||
|
|
||||||
|
let parent = assertGetElementById("root");
|
||||||
|
for (const node of path) {
|
||||||
|
let child: HTMLDetailsElement | null = null;
|
||||||
|
let summary: HTMLElement | null = null;
|
||||||
|
let d: Element;
|
||||||
|
outer: for (d of parent.children) {
|
||||||
|
if (!(d instanceof HTMLDetailsElement)) continue;
|
||||||
|
for (const s of d.children) {
|
||||||
|
if (!(s instanceof HTMLElement)) continue;
|
||||||
|
if (!(s.tagName === "SUMMARY" && s.innerText === node)) continue;
|
||||||
|
child = d;
|
||||||
|
summary = s;
|
||||||
|
break outer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!child) {
|
||||||
|
child = document.createElement("details");
|
||||||
|
child.className = "test-node";
|
||||||
|
child.ariaRoleDescription = "test";
|
||||||
|
summary = document.createElement("summary");
|
||||||
|
summary.appendChild(document.createTextNode(node));
|
||||||
|
summary.ariaRoleDescription = "test name";
|
||||||
|
child.appendChild(summary);
|
||||||
|
parent.appendChild(child);
|
||||||
|
}
|
||||||
|
if (!summary) throw new Error("unreachable as assigned above");
|
||||||
|
|
||||||
|
switch (result.state) {
|
||||||
|
case "failure":
|
||||||
|
// Only expand failures, to minimize successes and skips.
|
||||||
|
child.open = true;
|
||||||
|
child.classList.add("failure");
|
||||||
|
child.classList.remove("skip");
|
||||||
|
child.classList.remove("success");
|
||||||
|
// The summary marker does not appear in the AOM, so setting its
|
||||||
|
// alt text is fruitless; label the summary itself instead.
|
||||||
|
summary.setAttribute("aria-labelledby", "failure-description");
|
||||||
|
break;
|
||||||
|
case "skip":
|
||||||
|
if (child.classList.contains("failure")) break;
|
||||||
|
child.classList.add("skip");
|
||||||
|
child.classList.remove("success");
|
||||||
|
summary.setAttribute("aria-labelledby", "skip-description");
|
||||||
|
break;
|
||||||
|
case "success":
|
||||||
|
if (child.classList.contains("failure") || child.classList.contains("skip")) break;
|
||||||
|
child.classList.add("success");
|
||||||
|
summary.setAttribute("aria-labelledby", "success-description");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
parent = child;
|
||||||
|
}
|
||||||
|
|
||||||
|
const p = document.createElement("p");
|
||||||
|
p.classList.add("test-desc");
|
||||||
|
if (result.logs.length) {
|
||||||
|
const pre = document.createElement("pre");
|
||||||
|
pre.appendChild(document.createTextNode(result.logs.join("\n")));
|
||||||
|
p.appendChild(pre);
|
||||||
|
} else {
|
||||||
|
p.classList.add("italic");
|
||||||
|
p.appendChild(document.createTextNode("No output."));
|
||||||
|
}
|
||||||
|
parent.appendChild(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
finalize() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface GoNode {
|
||||||
|
name: string;
|
||||||
|
subtests?: GoNode[];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Used to display results via `go test`, via some glue code from the Go side.
|
||||||
|
// TODO(ophestra): said glue code has to be written.
|
||||||
|
export class GoTestReporter implements Reporter {
|
||||||
|
register(suites: TestGroup[]) {
|
||||||
|
console.log(JSON.stringify(suites.map(GoTestReporter.serialize)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert a test tree into the one expected by the Go code.
|
||||||
|
static serialize(node: TestTree): GoNode {
|
||||||
|
return {
|
||||||
|
name: node.name,
|
||||||
|
subtests: "children" in node ? node.children.map(GoTestReporter.serialize) : undefined,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
update(path: string[], result: TestResult) {
|
||||||
|
let state: number;
|
||||||
|
switch (result.state) {
|
||||||
|
case "success": state = 0; break;
|
||||||
|
case "failure": state = 1; break;
|
||||||
|
case "skip": state = 2; break;
|
||||||
|
}
|
||||||
|
console.log(JSON.stringify({ path, state, logs: result.logs }));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unnecessary but convenient on the Go side, so that it doesn't have to
|
||||||
|
// infer this via process exit.
|
||||||
|
finalize() {
|
||||||
|
console.log("null");
|
||||||
|
}
|
||||||
|
}
|
||||||
21
cmd/mbf/internal/pkgserver/ui/jstest/skip-closed.svg
Normal file
21
cmd/mbf/internal/pkgserver/ui/jstest/skip-closed.svg
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- See failure-open.svg for an explanation of the view box dimensions. -->
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" viewBox="-20,-20 160 130">
|
||||||
|
<!-- This triangle should match success-closed.svg, fill and stroke color notwithstanding. -->
|
||||||
|
<polygon points="0,0 100,50 0,100" fill="blue" stroke="blue" stroke-width="15" stroke-linejoin="round"/>
|
||||||
|
<!--
|
||||||
|
! This path is extremely similar to the one in skip-open.svg; before
|
||||||
|
! making minor modifications, diff the two to understand how they should
|
||||||
|
! remain in sync.
|
||||||
|
-->
|
||||||
|
<path
|
||||||
|
d="M 50,50
|
||||||
|
A 23,23 270,1,1 30,30
|
||||||
|
l -10,20
|
||||||
|
m 10,-20
|
||||||
|
l -20,-10"
|
||||||
|
fill="none"
|
||||||
|
stroke="white"
|
||||||
|
stroke-width="12"
|
||||||
|
stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 812 B |
21
cmd/mbf/internal/pkgserver/ui/jstest/skip-open.svg
Normal file
21
cmd/mbf/internal/pkgserver/ui/jstest/skip-open.svg
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- See failure-open.svg for an explanation of the view box dimensions. -->
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" viewBox="-20,-20 160 130">
|
||||||
|
<!-- This triangle should match success-open.svg, fill and stroke color notwithstanding. -->
|
||||||
|
<polygon points="0,0 100,0 50,100" fill="blue" stroke="blue" stroke-width="15" stroke-linejoin="round"/>
|
||||||
|
<!--
|
||||||
|
! This path is extremely similar to the one in skip-closed.svg; before
|
||||||
|
! making minor modifications, diff the two to understand how they should
|
||||||
|
! remain in sync.
|
||||||
|
-->
|
||||||
|
<path
|
||||||
|
d="M 50,50
|
||||||
|
A 23,23 270,1,1 70,30
|
||||||
|
l 10,-20
|
||||||
|
m -10,20
|
||||||
|
l -20,-10"
|
||||||
|
fill="none"
|
||||||
|
stroke="white"
|
||||||
|
stroke-width="12"
|
||||||
|
stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 812 B |
87
cmd/mbf/internal/pkgserver/ui/jstest/style.css
Normal file
87
cmd/mbf/internal/pkgserver/ui/jstest/style.css
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* When updating the theme colors, also update them in success-closed.svg and
|
||||||
|
* success-open.svg!
|
||||||
|
*/
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--bg: #d3d3d3;
|
||||||
|
--fg: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
:root {
|
||||||
|
--bg: #2c2c2c;
|
||||||
|
--fg: ghostwhite;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
background-color: var(--bg);
|
||||||
|
color: var(--fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, p, summary, noscript {
|
||||||
|
font-family: sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
noscript {
|
||||||
|
font-size: 16pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
.root {
|
||||||
|
margin: 1rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
details.test-node {
|
||||||
|
margin-left: 1rem;
|
||||||
|
padding: 0.2rem 0.5rem;
|
||||||
|
border-left: 2px dashed var(--fg);
|
||||||
|
> summary {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
&.success > summary::marker {
|
||||||
|
/*
|
||||||
|
* WebKit only supports color and font-size properties in ::marker [1], and
|
||||||
|
* its ::-webkit-details-marker only supports hiding the marker entirely
|
||||||
|
* [2], contrary to mdn's example [3]; thus, set a color as a fallback:
|
||||||
|
* while it may not be accessible for colorblind individuals, it's better
|
||||||
|
* than no indication of a test's state for anyone, as that there's no other
|
||||||
|
* way to include an indication in the marker on WebKit.
|
||||||
|
*
|
||||||
|
* [1]: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Selectors/::marker#browser_compatibility
|
||||||
|
* [2]: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/summary#default_style
|
||||||
|
* [3]: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/summary#changing_the_summarys_icon
|
||||||
|
*/
|
||||||
|
color: var(--fg);
|
||||||
|
content: url("./success-closed.svg") / "success";
|
||||||
|
}
|
||||||
|
&.success[open] > summary::marker {
|
||||||
|
content: url("./success-open.svg") / "success";
|
||||||
|
}
|
||||||
|
&.failure > summary::marker {
|
||||||
|
color: red;
|
||||||
|
content: url("./failure-closed.svg") / "failure";
|
||||||
|
}
|
||||||
|
&.failure[open] > summary::marker {
|
||||||
|
content: url("./failure-open.svg") / "failure";
|
||||||
|
}
|
||||||
|
&.skip > summary::marker {
|
||||||
|
color: blue;
|
||||||
|
content: url("./skip-closed.svg") / "skip";
|
||||||
|
}
|
||||||
|
&.skip[open] > summary::marker {
|
||||||
|
content: url("./skip-open.svg") / "skip";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
p.test-desc {
|
||||||
|
margin: 0 0 0 1rem;
|
||||||
|
padding: 2px 0;
|
||||||
|
> pre {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.italic {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
16
cmd/mbf/internal/pkgserver/ui/jstest/success-closed.svg
Normal file
16
cmd/mbf/internal/pkgserver/ui/jstest/success-closed.svg
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- See failure-open.svg for an explanation of the view box dimensions. -->
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" viewBox="-20,-20 160 130">
|
||||||
|
<style>
|
||||||
|
.adaptive-stroke {
|
||||||
|
stroke: black;
|
||||||
|
}
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
.adaptive-stroke {
|
||||||
|
stroke: ghostwhite;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<!-- When updating this triangle, also update the other five SVGs. -->
|
||||||
|
<polygon points="0,0 100,50 0,100" fill="none" class="adaptive-stroke" stroke-width="15" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 572 B |
16
cmd/mbf/internal/pkgserver/ui/jstest/success-open.svg
Normal file
16
cmd/mbf/internal/pkgserver/ui/jstest/success-open.svg
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- See failure-open.svg for an explanation of the view box dimensions. -->
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" viewBox="-20,-20 160 130">
|
||||||
|
<style>
|
||||||
|
.adaptive-stroke {
|
||||||
|
stroke: black;
|
||||||
|
}
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
.adaptive-stroke {
|
||||||
|
stroke: ghostwhite;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<!-- When updating this triangle, also update the other five SVGs. -->
|
||||||
|
<polygon points="0,0 100,0 50,100" fill="none" class="adaptive-stroke" stroke-width="15" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 572 B |
13
cmd/mbf/internal/pkgserver/ui/test_ui.go
Normal file
13
cmd/mbf/internal/pkgserver/ui/test_ui.go
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
//go:build frontend && frontend_test
|
||||||
|
|
||||||
|
package ui
|
||||||
|
|
||||||
|
import "embed"
|
||||||
|
|
||||||
|
//go:generate tsc -p tsconfig.test.json
|
||||||
|
//go:generate cp index.html style.css favicon.ico static
|
||||||
|
//go:generate cp jstest/index.html jstest/style.css static/jstest
|
||||||
|
//go:generate sh -c "cp jstest/*.svg static/jstest"
|
||||||
|
//go:embed static
|
||||||
|
var _static embed.FS
|
||||||
|
var static = staticFS(_static)
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
|
// This file defines the common options for all TypeScript here. This shouldn't
|
||||||
|
// be directly used as the project file in builds; see tsconfig.*.json instead,
|
||||||
|
// which inherit from this file and essentially define specific build targets.
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2024",
|
"target": "ES2024",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"alwaysStrict": true,
|
"alwaysStrict": true,
|
||||||
"outDir": "static"
|
"outDir": "static",
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
5
cmd/mbf/internal/pkgserver/ui/tsconfig.test.json
Normal file
5
cmd/mbf/internal/pkgserver/ui/tsconfig.test.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
// Project file for building pkgserver alongside its tests. test_ui.go uses this
|
||||||
|
// as its project file.
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
}
|
||||||
6
cmd/mbf/internal/pkgserver/ui/tsconfig.ui.json
Normal file
6
cmd/mbf/internal/pkgserver/ui/tsconfig.ui.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
// Project file for building just the pkgserver UI, with none of the testing
|
||||||
|
// stuff attached. ui_full.go uses this as its project file.
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"exclude": ["jstest", "all_tests.ts", "*_test.ts"],
|
||||||
|
}
|
||||||
@@ -1,7 +1,19 @@
|
|||||||
// Package ui holds the static web UI.
|
// Package ui holds the static web UI.
|
||||||
package ui
|
package ui
|
||||||
|
|
||||||
import "net/http"
|
import (
|
||||||
|
"io/fs"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// staticFS is an internal helper to wrap around go:embed's filesystem.
|
||||||
|
func staticFS(static fs.FS) fs.FS {
|
||||||
|
if f, err := fs.Sub(static, "static"); err != nil {
|
||||||
|
panic(err)
|
||||||
|
} else {
|
||||||
|
return f
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Register arranges for mux to serve the embedded frontend.
|
// Register arranges for mux to serve the embedded frontend.
|
||||||
func Register(mux *http.ServeMux) {
|
func Register(mux *http.ServeMux) {
|
||||||
|
|||||||
@@ -1,21 +1,11 @@
|
|||||||
//go:build frontend
|
//go:build frontend && !frontend_test
|
||||||
|
|
||||||
package ui
|
package ui
|
||||||
|
|
||||||
import (
|
import "embed"
|
||||||
"embed"
|
|
||||||
"io/fs"
|
|
||||||
)
|
|
||||||
|
|
||||||
//go:generate tsc
|
//go:generate tsc -p tsconfig.ui.json
|
||||||
//go:generate cp index.html style.css static
|
//go:generate cp index.html style.css static
|
||||||
//go:embed static
|
//go:embed static
|
||||||
var _static embed.FS
|
var _static embed.FS
|
||||||
|
var static = staticFS(_static)
|
||||||
var static = func() fs.FS {
|
|
||||||
if f, err := fs.Sub(_static, "static"); err != nil {
|
|
||||||
panic(err)
|
|
||||||
} else {
|
|
||||||
return f
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|||||||
@@ -58,19 +58,6 @@ func main() {
|
|||||||
log.Fatal("this program must not run as root")
|
log.Fatal("this program must not run as root")
|
||||||
}
|
}
|
||||||
|
|
||||||
defer func() {
|
|
||||||
r := recover()
|
|
||||||
if r == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
e, ok := r.(rosa.LoadError)
|
|
||||||
if !ok {
|
|
||||||
panic(r)
|
|
||||||
}
|
|
||||||
log.Fatal(e)
|
|
||||||
}()
|
|
||||||
|
|
||||||
ctx, stop := signal.NotifyContext(context.Background(),
|
ctx, stop := signal.NotifyContext(context.Background(),
|
||||||
syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP)
|
syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP)
|
||||||
defer stop()
|
defer stop()
|
||||||
@@ -84,21 +71,12 @@ func main() {
|
|||||||
flagArch string
|
flagArch string
|
||||||
flagCheck bool
|
flagCheck bool
|
||||||
flagLTO bool
|
flagLTO bool
|
||||||
flagPT bool
|
|
||||||
|
|
||||||
flagCrossOverride int
|
flagCrossOverride int
|
||||||
|
|
||||||
addr net.UnixAddr
|
addr net.UnixAddr
|
||||||
)
|
)
|
||||||
c := command.New(os.Stderr, log.Printf, "mbf", func([]string) error {
|
c := command.New(os.Stderr, log.Printf, "mbf", func([]string) error {
|
||||||
if !rosa.Native().HasStageEarly() {
|
|
||||||
return pkg.UnsupportedArchError(runtime.GOARCH)
|
|
||||||
}
|
|
||||||
|
|
||||||
if flagPT {
|
|
||||||
log.Println("parsed in", rosa.ParseTime())
|
|
||||||
}
|
|
||||||
|
|
||||||
msg.SwapVerbose(!flagQuiet)
|
msg.SwapVerbose(!flagQuiet)
|
||||||
cm.ctx, cm.msg = ctx, msg
|
cm.ctx, cm.msg = ctx, msg
|
||||||
cm.base = os.ExpandEnv(cm.base)
|
cm.base = os.ExpandEnv(cm.base)
|
||||||
@@ -122,7 +100,7 @@ func main() {
|
|||||||
rosa.Native().DropCaches("", flags)
|
rosa.Native().DropCaches("", flags)
|
||||||
cross := flagArch != "" && flagArch != runtime.GOARCH
|
cross := flagArch != "" && flagArch != runtime.GOARCH
|
||||||
if flagQEMU || cross {
|
if flagQEMU || cross {
|
||||||
_, cm.qemu = rosa.Native().Std().MustLoad(rosa.H("qemu"))
|
cm.qemu, _ = rosa.Native().Std().Load(rosa.QEMU)
|
||||||
}
|
}
|
||||||
|
|
||||||
if cross {
|
if cross {
|
||||||
@@ -131,7 +109,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rosa.Native().DropCaches(flagArch, flags)
|
rosa.Native().DropCaches(flagArch, flags)
|
||||||
if !rosa.Native().HasStageEarly() {
|
if !rosa.HasStage0() {
|
||||||
return pkg.UnsupportedArchError(flagArch)
|
return pkg.UnsupportedArchError(flagArch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -192,10 +170,6 @@ func main() {
|
|||||||
&addr.Name,
|
&addr.Name,
|
||||||
"socket", command.StringFlag("$MBF_DAEMON_SOCKET"),
|
"socket", command.StringFlag("$MBF_DAEMON_SOCKET"),
|
||||||
"Pathname of socket to bind to",
|
"Pathname of socket to bind to",
|
||||||
).Flag(
|
|
||||||
&flagPT,
|
|
||||||
"parse-time", command.BoolFlag(false),
|
|
||||||
"Print duration of the initial azalea parse",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
c.NewCommand(
|
c.NewCommand(
|
||||||
@@ -362,7 +336,7 @@ func main() {
|
|||||||
for range max(flagJobs, 1) {
|
for range max(flagJobs, 1) {
|
||||||
wg.Go(func() {
|
wg.Go(func() {
|
||||||
for p := range w {
|
for p := range w {
|
||||||
meta, _ := rosa.Native().Std().MustLoad(p)
|
meta := rosa.Native().MustGet(p)
|
||||||
if meta.ID == 0 {
|
if meta.ID == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -375,9 +349,13 @@ func main() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if latest := meta.GetLatest(v); meta.Version != latest {
|
_, version := rosa.Native().Std().Load(p)
|
||||||
|
if current, latest :=
|
||||||
|
version,
|
||||||
|
meta.GetLatest(v); current != latest {
|
||||||
|
|
||||||
n.Add(1)
|
n.Add(1)
|
||||||
log.Printf("%s %s < %s", meta.Name, meta.Version, latest)
|
log.Printf("%s %s < %s", meta.Name, current, latest)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,7 +365,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
for _, p := range rosa.Native().CollectAll() {
|
for _, p := range rosa.Native().Collect() {
|
||||||
select {
|
select {
|
||||||
case w <- p:
|
case w <- p:
|
||||||
break
|
break
|
||||||
@@ -452,9 +430,8 @@ func main() {
|
|||||||
checksum [2]unique.Handle[pkg.Checksum]
|
checksum [2]unique.Handle[pkg.Checksum]
|
||||||
)
|
)
|
||||||
|
|
||||||
_llvm := rosa.H("llvm")
|
|
||||||
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
||||||
_, llvm := rosa.Native().New(s - 2).Load(_llvm)
|
llvm, _ := rosa.Native().New(s - 2).Load(rosa.LLVM)
|
||||||
pathname, _, err = cache.Cure(llvm)
|
pathname, _, err = cache.Cure(llvm)
|
||||||
return
|
return
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
@@ -463,7 +440,7 @@ func main() {
|
|||||||
log.Println("stage1:", pathname)
|
log.Println("stage1:", pathname)
|
||||||
|
|
||||||
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
||||||
_, llvm := rosa.Native().New(s - 1).Load(_llvm)
|
llvm, _ := rosa.Native().New(s - 1).Load(rosa.LLVM)
|
||||||
pathname, checksum[0], err = cache.Cure(llvm)
|
pathname, checksum[0], err = cache.Cure(llvm)
|
||||||
return
|
return
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
@@ -471,7 +448,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
log.Println("stage2:", pathname)
|
log.Println("stage2:", pathname)
|
||||||
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
||||||
_, llvm := rosa.Native().New(s).Load(_llvm)
|
llvm, _ := rosa.Native().New(s).Load(rosa.LLVM)
|
||||||
pathname, checksum[1], err = cache.Cure(llvm)
|
pathname, checksum[1], err = cache.Cure(llvm)
|
||||||
return
|
return
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
@@ -493,7 +470,8 @@ func main() {
|
|||||||
|
|
||||||
if flagStage0 {
|
if flagStage0 {
|
||||||
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
||||||
pathname, _, err = cache.Cure(rosa.Native().Std().NewStage0())
|
stage0, _ := rosa.Native().New(s).Load(rosa.Stage0)
|
||||||
|
pathname, _, err = cache.Cure(stage0)
|
||||||
return
|
return
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return
|
return
|
||||||
@@ -546,7 +524,7 @@ func main() {
|
|||||||
t -= 1
|
t -= 1
|
||||||
}
|
}
|
||||||
|
|
||||||
_, a := rosa.Native().New(t).Load(rosa.ArtifactH(unique.Make(args[0])))
|
a, _ := rosa.Native().New(t).Load(rosa.ArtifactH(unique.Make(args[0])))
|
||||||
if a == nil {
|
if a == nil {
|
||||||
return fmt.Errorf("unknown artifact %q", args[0])
|
return fmt.Errorf("unknown artifact %q", args[0])
|
||||||
}
|
}
|
||||||
@@ -759,22 +737,22 @@ func main() {
|
|||||||
"shell",
|
"shell",
|
||||||
"Interactive shell in the specified Rosa OS environment",
|
"Interactive shell in the specified Rosa OS environment",
|
||||||
func(args []string) error {
|
func(args []string) error {
|
||||||
handles := make([]rosa.ArtifactH, len(args), len(args)+3)
|
handles := make([]rosa.ArtifactH, len(args)+3)
|
||||||
for i, arg := range args {
|
for i, arg := range args {
|
||||||
handles[i] = rosa.ArtifactH(unique.Make(arg))
|
handles[i] = rosa.ArtifactH(unique.Make(arg))
|
||||||
if meta, _ := rosa.Native().Std().Load(handles[i]); meta == nil {
|
if rosa.Native().Get(handles[i]) == nil {
|
||||||
return fmt.Errorf("unknown artifact %q", arg)
|
return fmt.Errorf("unknown artifact %q", arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
base := rosa.H("llvm")
|
base := rosa.LLVM
|
||||||
if !flagWithToolchain {
|
if !flagWithToolchain {
|
||||||
base = rosa.H("musl")
|
base = rosa.Musl
|
||||||
}
|
}
|
||||||
handles = append(handles,
|
handles = append(handles,
|
||||||
base,
|
base,
|
||||||
rosa.H("mksh"),
|
rosa.Mksh,
|
||||||
rosa.H("toybox"),
|
rosa.Toybox,
|
||||||
)
|
)
|
||||||
|
|
||||||
root := make(pkg.Collect, 0, 6+len(args))
|
root := make(pkg.Collect, 0, 6+len(args))
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ func TestCureAll(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
for _, handle := range rosa.Native().Collect() {
|
for _, handle := range rosa.Native().Collect() {
|
||||||
_, a := rosa.Native().Std().MustLoad(handle)
|
a, _ := rosa.Native().Std().MustLoad(handle)
|
||||||
t.Run(handle.String(), func(t *testing.T) {
|
t.Run(rosa.Native().MustGet(handle).Name, func(t *testing.T) {
|
||||||
_, err := cureRemote(t.Context(), &addr, a, 0)
|
_, err := cureRemote(t.Context(), &addr, a, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
|
|||||||
@@ -139,6 +139,7 @@
|
|||||||
GOCACHE="$(mktemp -d)" \
|
GOCACHE="$(mktemp -d)" \
|
||||||
PATH="${pkgs.pkgsStatic.musl.bin}/bin:$PATH" \
|
PATH="${pkgs.pkgsStatic.musl.bin}/bin:$PATH" \
|
||||||
DESTDIR="$out" \
|
DESTDIR="$out" \
|
||||||
|
HAKUREI_VERSION="v${hakurei.version}" \
|
||||||
./all.sh
|
./all.sh
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -183,10 +183,10 @@ func TestExec(t *testing.T) {
|
|||||||
"checksum/OLBgp1GsljhM2TJ-sbHjaiH9txEUvgdDTAzHv2P24donTt6_529l-9Ua0vFImLlb": {Mode: 0400, Data: []byte{}},
|
"checksum/OLBgp1GsljhM2TJ-sbHjaiH9txEUvgdDTAzHv2P24donTt6_529l-9Ua0vFImLlb": {Mode: 0400, Data: []byte{}},
|
||||||
|
|
||||||
"identifier": {Mode: fs.ModeDir | 0700},
|
"identifier": {Mode: fs.ModeDir | 0700},
|
||||||
|
"identifier/IY91PCtOpCYy21AaIK0c9f8-Z6fb2_2ewoHWkt4dxoLf0GOrWqS8yAGFLV84b1Dw": {Mode: fs.ModeSymlink | 0777, Data: []byte("../checksum/" + wantOfflineEncode)},
|
||||||
"identifier/QwS7SmiatdqryQYgESdGw7Yw2PcpNf0vNfpvUA0t92BTlKiUjfCrXyMW17G2X77X": {Mode: fs.ModeSymlink | 0777, Data: []byte("../checksum/MGWmEfjut2QE2xPJwTsmUzpff4BN_FEnQ7T0j7gvUCCiugJQNwqt9m151fm9D1yU")},
|
"identifier/QwS7SmiatdqryQYgESdGw7Yw2PcpNf0vNfpvUA0t92BTlKiUjfCrXyMW17G2X77X": {Mode: fs.ModeSymlink | 0777, Data: []byte("../checksum/MGWmEfjut2QE2xPJwTsmUzpff4BN_FEnQ7T0j7gvUCCiugJQNwqt9m151fm9D1yU")},
|
||||||
"identifier/_gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA": {Mode: fs.ModeSymlink | 0777, Data: []byte("../checksum/OLBgp1GsljhM2TJ-sbHjaiH9txEUvgdDTAzHv2P24donTt6_529l-9Ua0vFImLlb")},
|
"identifier/_gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA": {Mode: fs.ModeSymlink | 0777, Data: []byte("../checksum/OLBgp1GsljhM2TJ-sbHjaiH9txEUvgdDTAzHv2P24donTt6_529l-9Ua0vFImLlb")},
|
||||||
"identifier/" + expected.Offline: {Mode: fs.ModeSymlink | 0777, Data: []byte("../checksum/" + wantOfflineEncode)},
|
"identifier/" + expected.Offline: {Mode: fs.ModeSymlink | 0777, Data: []byte("../checksum/" + wantOfflineEncode)},
|
||||||
"identifier/" + expected.OfflineS: {Mode: fs.ModeSymlink | 0777, Data: []byte("../checksum/" + wantOfflineEncode)},
|
|
||||||
"identifier/vjz1MHPcGBKV7sjcs8jQP3cqxJ1hgPTiQBMCEHP9BGXjGxd-tJmEmXKaStObo5gK": {Mode: fs.ModeSymlink | 0777, Data: []byte("../checksum/MGWmEfjut2QE2xPJwTsmUzpff4BN_FEnQ7T0j7gvUCCiugJQNwqt9m151fm9D1yU")},
|
"identifier/vjz1MHPcGBKV7sjcs8jQP3cqxJ1hgPTiQBMCEHP9BGXjGxd-tJmEmXKaStObo5gK": {Mode: fs.ModeSymlink | 0777, Data: []byte("../checksum/MGWmEfjut2QE2xPJwTsmUzpff4BN_FEnQ7T0j7gvUCCiugJQNwqt9m151fm9D1yU")},
|
||||||
|
|
||||||
"substitute": {Mode: fs.ModeDir | 0700},
|
"substitute": {Mode: fs.ModeDir | 0700},
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
package expected
|
package expected
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Offline = "q5ktDTq0miP-VvB2blxqXQeaRXCUWgP_KbC18KNtUDtyoaI_h5mHmGuPMArVEBDs"
|
Offline = "q5ktDTq0miP-VvB2blxqXQeaRXCUWgP_KbC18KNtUDtyoaI_h5mHmGuPMArVEBDs"
|
||||||
OfflineS = "IY91PCtOpCYy21AaIK0c9f8-Z6fb2_2ewoHWkt4dxoLf0GOrWqS8yAGFLV84b1Dw"
|
OvlRoot = "NacZGXwuRkTvcHaG08a22ujJ8qCWN0RSoFlRSR5FSt0ZcBbJ28FRvkYsHEtX7G8i"
|
||||||
OvlRoot = "NacZGXwuRkTvcHaG08a22ujJ8qCWN0RSoFlRSR5FSt0ZcBbJ28FRvkYsHEtX7G8i"
|
Layers = "WBJDrATtX6rIE5yAu8ePX3WmDF0Tt9kFiue0m3cRnyRoVx1my8a67fh3CAW486oP"
|
||||||
Layers = "WBJDrATtX6rIE5yAu8ePX3WmDF0Tt9kFiue0m3cRnyRoVx1my8a67fh3CAW486oP"
|
Net = "CmYtj2sNB3LHtqiDuck_Lz3MjLLIiwyP8N4NDitQ1Icvv__LVP9p8tm-sHeQaKKp"
|
||||||
Net = "CmYtj2sNB3LHtqiDuck_Lz3MjLLIiwyP8N4NDitQ1Icvv__LVP9p8tm-sHeQaKKp"
|
Promote = "TX3eCloaQFkV-SZIH6Jg6E5WKH--rcXY1P0jnZKmLFKWrNqnOzd4G9eIBh6i5ywN"
|
||||||
Promote = "TX3eCloaQFkV-SZIH6Jg6E5WKH--rcXY1P0jnZKmLFKWrNqnOzd4G9eIBh6i5ywN"
|
Work = "OuNiLSC68pZhAOr1YQ4WbV1tzASA0nxLEBcK7lO7MqxDY_j8dmP_C612RTuF23Lu"
|
||||||
Work = "OuNiLSC68pZhAOr1YQ4WbV1tzASA0nxLEBcK7lO7MqxDY_j8dmP_C612RTuF23Lu"
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
package expected
|
package expected
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Offline = "WapqyoPxbWSnq07dWHt71mHaJXq99pAjJfFlELlJljSiZMhTFqqlzU1_mN86shSj"
|
Offline = "WapqyoPxbWSnq07dWHt71mHaJXq99pAjJfFlELlJljSiZMhTFqqlzU1_mN86shSj"
|
||||||
OfflineS = "ibQZHcdXgNQ1OiMX1FrburBbGPVvKEHvPilbQCkm_0oV0BQCHomyyTbYNrFMGIwl"
|
OvlRoot = "V9anFOiRvjGfAeBhLl14AL8TKdWZyD0WTPYe4fS9mOBw8iW5Lmarvt6TG6MV8uWm"
|
||||||
OvlRoot = "V9anFOiRvjGfAeBhLl14AL8TKdWZyD0WTPYe4fS9mOBw8iW5Lmarvt6TG6MV8uWm"
|
Layers = "tKx7JNRoSBdK_7MdzI-nwTNV2wmiPzwYdcd17oLmXKL_iLmUzUiA79qTqdrTasrv"
|
||||||
Layers = "tKx7JNRoSBdK_7MdzI-nwTNV2wmiPzwYdcd17oLmXKL_iLmUzUiA79qTqdrTasrv"
|
Net = "aXyDLzBCJ9XltXZIfetEVsEkrqHfcXuD5XE_FcUnYbN3emwL55N6P8LlHzNfGnM5"
|
||||||
Net = "aXyDLzBCJ9XltXZIfetEVsEkrqHfcXuD5XE_FcUnYbN3emwL55N6P8LlHzNfGnM5"
|
Promote = "3k4V16n96Lq04gjFSKmm4sFjyQ883FFBNXgTy9s_DjeTwxT3pg_iacEh8yMb_S4m"
|
||||||
Promote = "3k4V16n96Lq04gjFSKmm4sFjyQ883FFBNXgTy9s_DjeTwxT3pg_iacEh8yMb_S4m"
|
Work = "6Q49MhFWRE3Ne6MycwAotgl1GtoU5WCHqJNWG2byYZCY-zX-IxPrWiKk7bKkNzhE"
|
||||||
Work = "6Q49MhFWRE3Ne6MycwAotgl1GtoU5WCHqJNWG2byYZCY-zX-IxPrWiKk7bKkNzhE"
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
package expected
|
package expected
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Offline = "Z6yXE5gOJScL3srmnVMWgCXccDiUNZ5snSrf6RkXuU1_U0rX_kGVwsfHUgNG_awd"
|
Offline = "Z6yXE5gOJScL3srmnVMWgCXccDiUNZ5snSrf6RkXuU1_U0rX_kGVwsfHUgNG_awd"
|
||||||
OfflineS = "zN16xv6LKRJRipUJwupyxg2rZcvf-qpsMn_qCxUmgxlTSuNwYI70ZEb7dHW5k0gO"
|
OvlRoot = "zYXJHFRLuxvUhuisZEXgGgVvdQd6piMfp5jmtT6jdVjvC2gICXquOq-UTwlrSD5I"
|
||||||
OvlRoot = "zYXJHFRLuxvUhuisZEXgGgVvdQd6piMfp5jmtT6jdVjvC2gICXquOq-UTwlrSD5I"
|
Layers = "_F8EDazHbcLeT0sVSQXRN_kn9IjduqJcDYgzXpsT-hpKU4EBcZ0PISN2zchpqMbm"
|
||||||
Layers = "_F8EDazHbcLeT0sVSQXRN_kn9IjduqJcDYgzXpsT-hpKU4EBcZ0PISN2zchpqMbm"
|
Net = "CA_FAaSIYJgapBEHV40doxpH23PdUEy_6s1TZc7wfSPN0XYqwGpMceXXDSabGveO"
|
||||||
Net = "CA_FAaSIYJgapBEHV40doxpH23PdUEy_6s1TZc7wfSPN0XYqwGpMceXXDSabGveO"
|
Promote = "_3LPrLp--4h9k4GsNNApu9hHtAafq-GUhfU6d4hJKBDKT3bz_szOsvkXxc5sK53d"
|
||||||
Promote = "_3LPrLp--4h9k4GsNNApu9hHtAafq-GUhfU6d4hJKBDKT3bz_szOsvkXxc5sK53d"
|
Work = "FEgHeiCD_WT4wsfB-9kDH5n6cRWCEYtJmXdKZgmUUukAOoXumH_hLlosXREC-tqq"
|
||||||
Work = "FEgHeiCD_WT4wsfB-9kDH5n6cRWCEYtJmXdKZgmUUukAOoXumH_hLlosXREC-tqq"
|
|
||||||
)
|
)
|
||||||
|
|||||||
110
internal/rosa/acl.go
Normal file
110
internal/rosa/acl.go
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newAttr() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "2.5.2"
|
||||||
|
checksum = "YWEphrz6vg1sUMmHHVr1CRo53pFXRhq_pjN-AlG8UgwZK1y6m7zuDhxqJhD0SV0l"
|
||||||
|
)
|
||||||
|
return t.NewPackage("attr", version, newTar(
|
||||||
|
"https://download.savannah.nongnu.org/releases/attr/"+
|
||||||
|
"attr-"+version+".tar.gz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
), &PackageAttr{
|
||||||
|
Patches: []KV{
|
||||||
|
{"libgen-basename", `From 8a80d895dfd779373363c3a4b62ecce5a549efb2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
|
||||||
|
Date: Sat, 30 Mar 2024 10:17:10 +0100
|
||||||
|
Subject: tools/attr.c: Add missing libgen.h include for basename(3)
|
||||||
|
|
||||||
|
Fixes compilation issue with musl and modern C99 compilers.
|
||||||
|
|
||||||
|
See: https://bugs.gentoo.org/926294
|
||||||
|
---
|
||||||
|
tools/attr.c | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/tools/attr.c b/tools/attr.c
|
||||||
|
index f12e4af..6a3c1e9 100644
|
||||||
|
--- a/tools/attr.c
|
||||||
|
+++ b/tools/attr.c
|
||||||
|
@@ -28,6 +28,7 @@
|
||||||
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <locale.h>
|
||||||
|
+#include <libgen.h>
|
||||||
|
|
||||||
|
#include <attr/attributes.h>
|
||||||
|
|
||||||
|
--
|
||||||
|
cgit v1.1`},
|
||||||
|
|
||||||
|
{"musl-errno", `diff --git a/test/attr.test b/test/attr.test
|
||||||
|
index 6ce2f9b..e9bde92 100644
|
||||||
|
--- a/test/attr.test
|
||||||
|
+++ b/test/attr.test
|
||||||
|
@@ -11,7 +11,7 @@ Try various valid and invalid names
|
||||||
|
|
||||||
|
$ touch f
|
||||||
|
$ setfattr -n user -v value f
|
||||||
|
- > setfattr: f: Operation not supported
|
||||||
|
+ > setfattr: f: Not supported
|
||||||
|
|
||||||
|
$ setfattr -n user. -v value f
|
||||||
|
> setfattr: f: Invalid argument
|
||||||
|
`},
|
||||||
|
},
|
||||||
|
|
||||||
|
ScriptEarly: `
|
||||||
|
ln -s ../../system/bin/perl /usr/bin
|
||||||
|
`,
|
||||||
|
}, (*MakeHelper)(nil),
|
||||||
|
Perl,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newAttr,
|
||||||
|
|
||||||
|
Name: "attr",
|
||||||
|
Description: "Commands for Manipulating Filesystem Extended Attributes",
|
||||||
|
Website: "https://savannah.nongnu.org/projects/attr/",
|
||||||
|
|
||||||
|
ID: 137,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t Toolchain) newACL() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "2.3.2"
|
||||||
|
checksum = "-fY5nwH4K8ZHBCRXrzLdguPkqjKI6WIiGu4dBtrZ1o0t6AIU73w8wwJz_UyjIS0P"
|
||||||
|
)
|
||||||
|
return t.NewPackage("acl", version, newTar(
|
||||||
|
"https://download.savannah.nongnu.org/releases/acl/"+
|
||||||
|
"acl-"+version+".tar.gz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
), nil, &MakeHelper{
|
||||||
|
// makes assumptions about uid_map/gid_map
|
||||||
|
SkipCheck: true,
|
||||||
|
},
|
||||||
|
Attr,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newACL,
|
||||||
|
|
||||||
|
Name: "acl",
|
||||||
|
Description: "Commands for Manipulating POSIX Access Control Lists",
|
||||||
|
Website: "https://savannah.nongnu.org/projects/acl/",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
Attr,
|
||||||
|
},
|
||||||
|
|
||||||
|
ID: 16,
|
||||||
|
})
|
||||||
|
}
|
||||||
36
internal/rosa/argp-standalone.go
Normal file
36
internal/rosa/argp-standalone.go
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newArgpStandalone() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "1.3"
|
||||||
|
checksum = "vtW0VyO2pJ-hPyYmDI2zwSLS8QL0sPAUKC1t3zNYbwN2TmsaE-fADhaVtNd3eNFl"
|
||||||
|
)
|
||||||
|
return t.NewPackage("argp-standalone", version, newTar(
|
||||||
|
"http://www.lysator.liu.se/~nisse/misc/"+
|
||||||
|
"argp-standalone-"+version+".tar.gz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
), &PackageAttr{
|
||||||
|
Env: []string{
|
||||||
|
"CC=cc -std=gnu89 -fPIC",
|
||||||
|
},
|
||||||
|
}, &MakeHelper{
|
||||||
|
Install: `
|
||||||
|
install -D -m644 /usr/src/argp-standalone/argp.h /work/system/include/argp.h
|
||||||
|
install -D -m755 libargp.a /work/system/lib/libargp.a
|
||||||
|
`,
|
||||||
|
},
|
||||||
|
Diffutils,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newArgpStandalone,
|
||||||
|
|
||||||
|
Name: "argp-standalone",
|
||||||
|
Description: "hierarchical argument parsing library broken out from glibc",
|
||||||
|
Website: "http://www.lysator.liu.se/~nisse/misc/",
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -5,13 +5,12 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"maps"
|
"maps"
|
||||||
"reflect"
|
"reflect"
|
||||||
"slices"
|
|
||||||
"unique"
|
"unique"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Value are types supported by the language.
|
// Value are types supported by the language.
|
||||||
type Value interface {
|
type Value interface {
|
||||||
bool | int64 | string | []string | []int64 | [][2]string
|
bool | int64 | string | []string | [][2]string
|
||||||
}
|
}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@@ -24,12 +23,9 @@ type (
|
|||||||
// FArgs are arguments passed to [F].
|
// FArgs are arguments passed to [F].
|
||||||
FArgs []FArg
|
FArgs []FArg
|
||||||
|
|
||||||
// PF implements the package declaration function.
|
|
||||||
PF func(name Ident, args FArgs) (v any, set bool, err error)
|
|
||||||
|
|
||||||
// F is the implementation of a [Func].
|
// F is the implementation of a [Func].
|
||||||
F struct {
|
F struct {
|
||||||
F func(args FArgs) (v any, set bool, err error)
|
F func(isPackage bool, args FArgs) (v any, set bool, err error)
|
||||||
V map[unique.Handle[Ident]]any
|
V map[unique.Handle[Ident]]any
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -81,20 +77,8 @@ func (e UndefinedError) Error() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// evaluate is evaluateAny with a type parameter.
|
// evaluate is evaluateAny with a type parameter.
|
||||||
func evaluate[T Value](d PF, s []Frame, expr any, rp *T) bool {
|
func evaluate[T Value](s []Frame, expr any, rp *T) bool {
|
||||||
return evaluateAny(d, s, expr, rp)
|
return evaluateAny(s, expr, rp)
|
||||||
}
|
|
||||||
|
|
||||||
// evaluateArray evaluates expr and returns its values as a slice.
|
|
||||||
func evaluateArray[T Value](d PF, s []Frame, expr Array) []T {
|
|
||||||
r := make([]T, 0, len(expr))
|
|
||||||
for i := range expr {
|
|
||||||
var _r T
|
|
||||||
if evaluate(d, s, expr[i], &_r) {
|
|
||||||
r = append(r, _r)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return r
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TypeError is an unexpected type during evaluation.
|
// TypeError is an unexpected type during evaluation.
|
||||||
@@ -103,7 +87,7 @@ type TypeError struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e TypeError) Error() string {
|
func (e TypeError) Error() string {
|
||||||
return fmt.Sprintf("expected %s, got %s", e.Asserted, e.Concrete)
|
return "expected " + e.Asserted.String() + ", got " + e.Concrete.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e TypeError) Is(err error) bool {
|
func (e TypeError) Is(err error) bool {
|
||||||
@@ -148,25 +132,8 @@ func (e EvaluationError) Error() string {
|
|||||||
return fmt.Sprintf("expression %#v: %v", e.Expr, e.Err)
|
return fmt.Sprintf("expression %#v: %v", e.Expr, e.Err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
|
||||||
// IdentInputs is a special array argument in a package declaration whose
|
|
||||||
// values of [Ident] are kept as is when passed to a [PF].
|
|
||||||
IdentInputs = unique.Make(Ident("inputs"))
|
|
||||||
// IdentRuntime has the same semantics as [IdentInputs].
|
|
||||||
IdentRuntime = unique.Make(Ident("runtime"))
|
|
||||||
// IdentExtra has the same semantics as [IdentInputs].
|
|
||||||
IdentExtra = unique.Make(Ident("extra"))
|
|
||||||
// IdentSource is a special argument in a package declaration where an
|
|
||||||
// assignment of a [Val] with a single [Ident] passes through the evaluator.
|
|
||||||
IdentSource = unique.Make(Ident("source"))
|
|
||||||
|
|
||||||
// ErrInvalidSpecial is panicked for a special [PF] argument sharing its
|
|
||||||
// value or set for R.
|
|
||||||
ErrInvalidSpecial = errors.New("special must not be common or bound to scope")
|
|
||||||
)
|
|
||||||
|
|
||||||
// evaluateAny implements [Evaluate].
|
// evaluateAny implements [Evaluate].
|
||||||
func evaluateAny(d PF, s []Frame, expr, rp any) bool {
|
func evaluateAny(s []Frame, expr, rp any) bool {
|
||||||
defer func() {
|
defer func() {
|
||||||
r := recover()
|
r := recover()
|
||||||
if r == nil {
|
if r == nil {
|
||||||
@@ -226,17 +193,17 @@ func evaluateAny(d PF, s []Frame, expr, rp any) bool {
|
|||||||
store(rp, false)
|
store(rp, false)
|
||||||
return true
|
return true
|
||||||
default:
|
default:
|
||||||
return evaluateAny(d, s, v, rp)
|
return evaluateAny(s, v, rp)
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return evaluateAny(d, s, e[0], rp)
|
return evaluateAny(s, e[0], rp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var v string
|
var v string
|
||||||
for i := range e {
|
for i := range e {
|
||||||
var _r string
|
var _r string
|
||||||
if evaluate(d, s, e[i], &_r) {
|
if evaluate(s, e[i], &_r) {
|
||||||
v += _r
|
v += _r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -244,20 +211,21 @@ func evaluateAny(d PF, s []Frame, expr, rp any) bool {
|
|||||||
return true
|
return true
|
||||||
|
|
||||||
case Array:
|
case Array:
|
||||||
if len(e) > 0 && len(e[0]) == 1 {
|
r := make([]string, 0, len(e))
|
||||||
if _, ok := e[0][0].(Int); ok {
|
for i := range e {
|
||||||
store(rp, evaluateArray[int64](d, s, e))
|
var _r string
|
||||||
return true
|
if evaluate(s, e[i], &_r) {
|
||||||
|
r = append(r, _r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
store(rp, evaluateArray[string](d, s, e))
|
store(rp, r)
|
||||||
return true
|
return true
|
||||||
|
|
||||||
case []KV:
|
case []KV:
|
||||||
r := make([][2]string, 0, len(e))
|
r := make([][2]string, 0, len(e))
|
||||||
for i := range e {
|
for i := range e {
|
||||||
var _r string
|
var _r string
|
||||||
if e[i].V == nil || evaluate(d, s, e[i].V, &_r) {
|
if e[i].V == nil || evaluate(s, e[i].V, &_r) {
|
||||||
r = append(r, [2]string{string(e[i].K), _r})
|
r = append(r, [2]string{string(e[i].K), _r})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -269,96 +237,44 @@ func evaluateAny(d PF, s []Frame, expr, rp any) bool {
|
|||||||
f F
|
f F
|
||||||
ok bool
|
ok bool
|
||||||
)
|
)
|
||||||
if !e.Package {
|
for i := range s {
|
||||||
for i := range s {
|
f, ok = s[len(s)-1-i].Func[unique.Make(e.Ident)]
|
||||||
f, ok = s[len(s)-1-i].Func[unique.Make(e.Ident)]
|
if ok {
|
||||||
if ok {
|
break
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !ok {
|
|
||||||
panic(UndefinedError(e.Ident))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if !ok {
|
||||||
|
panic(UndefinedError(e.Ident))
|
||||||
|
}
|
||||||
|
|
||||||
argc := len(e.Args)
|
argc := len(e.Args)
|
||||||
for _, arg := range e.Args {
|
for _, arg := range e.Args {
|
||||||
argc += len(arg.K) - 1
|
argc += len(arg.K) - 1
|
||||||
}
|
}
|
||||||
fargs := make([]FArg, 0, len(e.Args))
|
fargs := make([]FArg, 0, len(e.Args))
|
||||||
s = append(s, Frame{})
|
s = append(s, Frame{Val: maps.Clone(f.V)})
|
||||||
fp := &s[len(s)-1]
|
fp := &s[len(s)-1]
|
||||||
if !e.Package {
|
|
||||||
fp.Val = maps.Clone(f.V)
|
|
||||||
}
|
|
||||||
|
|
||||||
args:
|
|
||||||
for _, arg := range e.Args {
|
for _, arg := range e.Args {
|
||||||
names := make([]unique.Handle[Ident], len(arg.K))
|
|
||||||
for i, name := range arg.K {
|
|
||||||
names[i] = unique.Make(name)
|
|
||||||
}
|
|
||||||
|
|
||||||
farg := FArg{R: arg.R}
|
farg := FArg{R: arg.R}
|
||||||
if e.Package {
|
if !evaluateAny(s, arg.V, &farg.V) {
|
||||||
for _, special := range [...]unique.Handle[Ident]{
|
|
||||||
IdentInputs,
|
|
||||||
IdentRuntime,
|
|
||||||
IdentExtra,
|
|
||||||
} {
|
|
||||||
if slices.Contains(names, special) {
|
|
||||||
if len(names) != 1 || len(arg.V) != 1 || arg.R {
|
|
||||||
panic(ErrInvalidSpecial)
|
|
||||||
}
|
|
||||||
farg.K = names[0]
|
|
||||||
if err := storeE(&farg.V, arg.V[0]); err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
fargs = append(fargs, farg)
|
|
||||||
continue args
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if slices.Contains(names, IdentSource) {
|
|
||||||
if len(names) != 1 || len(arg.V) != 1 || arg.R {
|
|
||||||
panic(ErrInvalidSpecial)
|
|
||||||
}
|
|
||||||
if _, ok = arg.V[0].(Ident); ok {
|
|
||||||
farg.K = names[0]
|
|
||||||
if err := storeE(&farg.V, arg.V[0]); err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
fargs = append(fargs, farg)
|
|
||||||
continue args
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !evaluateAny(d, s, arg.V, &farg.V) {
|
|
||||||
farg.V = nil
|
farg.V = nil
|
||||||
}
|
}
|
||||||
for _, name := range names {
|
for _, name := range arg.K {
|
||||||
farg.K = name
|
h := unique.Make(name)
|
||||||
|
farg.K = h
|
||||||
fargs = append(fargs, farg)
|
fargs = append(fargs, farg)
|
||||||
|
|
||||||
if arg.R && farg.V != nil {
|
if arg.R && farg.V != nil {
|
||||||
if fp.Val == nil {
|
if fp.Val == nil {
|
||||||
fp.Val = make(map[unique.Handle[Ident]]any)
|
fp.Val = make(map[unique.Handle[Ident]]any)
|
||||||
}
|
}
|
||||||
(*fp).Val[name] = farg.V
|
(*fp).Val[h] = farg.V
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
v, set, err := f.F(e.Package, fargs)
|
||||||
v any
|
|
||||||
err error
|
|
||||||
)
|
|
||||||
if !e.Package {
|
|
||||||
v, ok, err = f.F(fargs)
|
|
||||||
} else {
|
|
||||||
v, ok, err = d(e.Ident, fargs)
|
|
||||||
}
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
} else if v != nil {
|
} else if v != nil {
|
||||||
@@ -366,7 +282,7 @@ func evaluateAny(d PF, s []Frame, expr, rp any) bool {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ok
|
return set
|
||||||
|
|
||||||
default:
|
default:
|
||||||
panic(UnsupportedExprError{expr})
|
panic(UnsupportedExprError{expr})
|
||||||
@@ -374,7 +290,7 @@ func evaluateAny(d PF, s []Frame, expr, rp any) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Evaluate evaluates a statement and returns its value.
|
// Evaluate evaluates a statement and returns its value.
|
||||||
func Evaluate[T any](d PF, s []Frame, expr any) (v T, set bool, err error) {
|
func Evaluate[T Value](s []Frame, expr any) (v T, set bool, err error) {
|
||||||
defer func() {
|
defer func() {
|
||||||
r := recover()
|
r := recover()
|
||||||
if r == nil {
|
if r == nil {
|
||||||
@@ -387,6 +303,6 @@ func Evaluate[T any](d PF, s []Frame, expr any) (v T, set bool, err error) {
|
|||||||
}
|
}
|
||||||
err = _err
|
err = _err
|
||||||
}()
|
}()
|
||||||
set = evaluateAny(d, s, expr, &v)
|
set = evaluate[T](s, expr, &v)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,26 +16,19 @@ import (
|
|||||||
func makeStackCheck(check func(args FArgs) (any, error)) []Frame {
|
func makeStackCheck(check func(args FArgs) (any, error)) []Frame {
|
||||||
return []Frame{{Func: map[unique.Handle[Ident]]F{
|
return []Frame{{Func: map[unique.Handle[Ident]]F{
|
||||||
unique.Make(Ident("f")): {F: func(
|
unique.Make(Ident("f")): {F: func(
|
||||||
|
isPackage bool,
|
||||||
args FArgs,
|
args FArgs,
|
||||||
) (v any, set bool, err error) {
|
) (v any, set bool, err error) {
|
||||||
set = true
|
set = true
|
||||||
v, err = check(args)
|
v, err = check(args)
|
||||||
|
if isPackage {
|
||||||
|
err = errors.New("unexpected package")
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}},
|
}},
|
||||||
}}}
|
}}}
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkArgs is like makeStackCheck, but the resulting function asserts that its
|
|
||||||
// args match the expected value.
|
|
||||||
func checkArgs(want FArgs) []Frame {
|
|
||||||
return makeStackCheck(func(args FArgs) (any, error) {
|
|
||||||
if !reflect.DeepEqual(args, want) {
|
|
||||||
return nil, fmt.Errorf("%#v, want %#v", args, want)
|
|
||||||
}
|
|
||||||
return "\xfd", nil
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestEvaluate(t *testing.T) {
|
func TestEvaluate(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
@@ -43,7 +36,7 @@ func TestEvaluate(t *testing.T) {
|
|||||||
name string
|
name string
|
||||||
data string
|
data string
|
||||||
s []Frame
|
s []Frame
|
||||||
want any
|
want string
|
||||||
err error
|
err error
|
||||||
}{
|
}{
|
||||||
{"apply unset", `f { v = unset; }`, makeStackCheck(func(
|
{"apply unset", `f { v = unset; }`, makeStackCheck(func(
|
||||||
@@ -108,78 +101,6 @@ func TestEvaluate(t *testing.T) {
|
|||||||
Expr: Ident("nil"),
|
Expr: Ident("nil"),
|
||||||
Err: UndefinedError("nil"),
|
Err: UndefinedError("nil"),
|
||||||
}},
|
}},
|
||||||
|
|
||||||
{"common inputs", `package name { inputs, v = []; }`, nil, "", EvaluationError{
|
|
||||||
Expr: Func{
|
|
||||||
Ident: Ident("name"),
|
|
||||||
Package: true,
|
|
||||||
|
|
||||||
Args: []Arg{
|
|
||||||
{K: []Ident{
|
|
||||||
"inputs",
|
|
||||||
"v",
|
|
||||||
}, V: Val{Array(nil)}},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Err: ErrInvalidSpecial,
|
|
||||||
}},
|
|
||||||
|
|
||||||
{"bound inputs", `package name { inputs* = []; }`, nil, "", EvaluationError{
|
|
||||||
Expr: Func{
|
|
||||||
Ident: Ident("name"),
|
|
||||||
Package: true,
|
|
||||||
|
|
||||||
Args: []Arg{
|
|
||||||
{K: []Ident{"inputs"}, V: Val{Array(nil)}, R: true},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Err: ErrInvalidSpecial,
|
|
||||||
}},
|
|
||||||
|
|
||||||
{"bound runtime", `package name { runtime* = []; }`, nil, "", EvaluationError{
|
|
||||||
Expr: Func{
|
|
||||||
Ident: Ident("name"),
|
|
||||||
Package: true,
|
|
||||||
|
|
||||||
Args: []Arg{
|
|
||||||
{K: []Ident{"runtime"}, V: Val{Array(nil)}, R: true},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Err: ErrInvalidSpecial,
|
|
||||||
}},
|
|
||||||
|
|
||||||
{"concat inputs", `package name { inputs = ""+""; }`, nil, "", EvaluationError{
|
|
||||||
Expr: Func{
|
|
||||||
Ident: Ident("name"),
|
|
||||||
Package: true,
|
|
||||||
|
|
||||||
Args: []Arg{
|
|
||||||
{K: []Ident{"inputs"}, V: Val{String(""), String("")}},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Err: ErrInvalidSpecial,
|
|
||||||
}},
|
|
||||||
|
|
||||||
{"concat source", `package name { source = ""+""; }`, nil, "", EvaluationError{
|
|
||||||
Expr: Func{
|
|
||||||
Ident: Ident("name"),
|
|
||||||
Package: true,
|
|
||||||
|
|
||||||
Args: []Arg{
|
|
||||||
{K: []Ident{"source"}, V: Val{String(""), String("")}},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Err: ErrInvalidSpecial,
|
|
||||||
}},
|
|
||||||
|
|
||||||
{"source handle", `package name { source = name; }`, nil, FArgs{
|
|
||||||
{K: unique.Make(Ident("source")), V: Ident("name")},
|
|
||||||
}, nil},
|
|
||||||
|
|
||||||
{"integer array", `f { v = [ 0 ]; _v = [ 0, 9 ]; }`, checkArgs(FArgs{
|
|
||||||
{K: unique.Make(Ident("v")), V: []int64{0}},
|
|
||||||
{K: unique.Make(Ident("_v")), V: []int64{0, 9}},
|
|
||||||
}), "\xfd", nil},
|
|
||||||
}
|
}
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
@@ -193,23 +114,12 @@ func TestEvaluate(t *testing.T) {
|
|||||||
} else {
|
} else {
|
||||||
expr = e[0].(Func)
|
expr = e[0].(Func)
|
||||||
}
|
}
|
||||||
const rPackage = "\xff\xff\xff\xff"
|
r, set, err := Evaluate[string](tc.s, expr)
|
||||||
r, set, err := Evaluate[string](func(
|
|
||||||
name Ident,
|
|
||||||
args FArgs,
|
|
||||||
) (v any, set bool, err error) {
|
|
||||||
v = rPackage
|
|
||||||
if !reflect.DeepEqual(args, tc.want) {
|
|
||||||
err = fmt.Errorf("%#v, want %#v", args, tc.want)
|
|
||||||
}
|
|
||||||
set = true
|
|
||||||
return
|
|
||||||
}, tc.s, expr)
|
|
||||||
if set != (err == nil) {
|
if set != (err == nil) {
|
||||||
t.Error("Evaluate: unexpected unset")
|
t.Error("Evaluate: unexpected unset")
|
||||||
}
|
}
|
||||||
|
|
||||||
if r != rPackage && r != tc.want {
|
if r != tc.want {
|
||||||
t.Errorf("Evaluate: %q, want %q", r, tc.want)
|
t.Errorf("Evaluate: %q, want %q", r, tc.want)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,19 +147,36 @@ func TestEvaluateGCC(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var got [3]FArgs
|
var got [3]FArgs
|
||||||
if r, set, err := Evaluate[string](func(
|
if r, set, err := Evaluate[string]([]Frame{{
|
||||||
name Ident,
|
|
||||||
args FArgs,
|
|
||||||
) (v any, set bool, err error) {
|
|
||||||
v = "\x00"
|
|
||||||
set = true
|
|
||||||
got[0] = args
|
|
||||||
return
|
|
||||||
}, []Frame{{
|
|
||||||
Func: map[unique.Handle[Ident]]F{
|
Func: map[unique.Handle[Ident]]F{
|
||||||
unique.Make(Ident("remoteTar")): {F: func(
|
unique.Make(Ident("gcc")): {F: func(
|
||||||
|
isPackage bool,
|
||||||
args FArgs,
|
args FArgs,
|
||||||
) (v any, set bool, err error) {
|
) (v any, set bool, err error) {
|
||||||
|
v = "\x00"
|
||||||
|
if !isPackage {
|
||||||
|
err = errors.New("not a package")
|
||||||
|
}
|
||||||
|
set = true
|
||||||
|
got[0] = args
|
||||||
|
return
|
||||||
|
}, V: map[unique.Handle[Ident]]any{
|
||||||
|
unique.Make(Ident("binutils")): "binutils",
|
||||||
|
unique.Make(Ident("mpc")): "mpc",
|
||||||
|
unique.Make(Ident("zlib")): "zlib",
|
||||||
|
unique.Make(Ident("libucontext")): "libucontext",
|
||||||
|
unique.Make(Ident("kernel-headers")): "kernel-headers",
|
||||||
|
}},
|
||||||
|
|
||||||
|
unique.Make(Ident("remoteTar")): {F: func(
|
||||||
|
isPackage bool,
|
||||||
|
args FArgs,
|
||||||
|
) (v any, set bool, err error) {
|
||||||
|
if isPackage {
|
||||||
|
err = errors.New("unexpected package")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var url, checksum string
|
var url, checksum string
|
||||||
var compress int
|
var compress int
|
||||||
if err = args.Apply(map[unique.Handle[Ident]]any{
|
if err = args.Apply(map[unique.Handle[Ident]]any{
|
||||||
@@ -271,25 +198,37 @@ func TestEvaluateGCC(t *testing.T) {
|
|||||||
}},
|
}},
|
||||||
|
|
||||||
unique.Make(Ident("make")): {F: func(
|
unique.Make(Ident("make")): {F: func(
|
||||||
|
isPackage bool,
|
||||||
args FArgs,
|
args FArgs,
|
||||||
) (v any, set bool, err error) {
|
) (v any, set bool, err error) {
|
||||||
v = args
|
v = args
|
||||||
|
if isPackage {
|
||||||
|
err = errors.New("unexpected package")
|
||||||
|
}
|
||||||
set = true
|
set = true
|
||||||
return
|
return
|
||||||
}},
|
}},
|
||||||
|
|
||||||
unique.Make(Ident("arch")): {F: func(
|
unique.Make(Ident("arch")): {F: func(
|
||||||
|
isPackage bool,
|
||||||
args FArgs,
|
args FArgs,
|
||||||
) (v any, set bool, err error) {
|
) (v any, set bool, err error) {
|
||||||
set = false
|
set = false
|
||||||
|
if isPackage {
|
||||||
|
err = errors.New("unexpected package")
|
||||||
|
}
|
||||||
got[1] = args
|
got[1] = args
|
||||||
return
|
return
|
||||||
}},
|
}},
|
||||||
|
|
||||||
unique.Make(Ident("noop")): {F: func(
|
unique.Make(Ident("noop")): {F: func(
|
||||||
|
isPackage bool,
|
||||||
args FArgs,
|
args FArgs,
|
||||||
) (v any, set bool, err error) {
|
) (v any, set bool, err error) {
|
||||||
set = false
|
set = false
|
||||||
|
if isPackage {
|
||||||
|
err = errors.New("unexpected package")
|
||||||
|
}
|
||||||
set = true
|
set = true
|
||||||
got[2] = args
|
got[2] = args
|
||||||
return
|
return
|
||||||
@@ -335,12 +274,12 @@ func TestEvaluateGCC(t *testing.T) {
|
|||||||
{K: unique.Make(Ident("skip-check")), V: true},
|
{K: unique.Make(Ident("skip-check")), V: true},
|
||||||
}},
|
}},
|
||||||
|
|
||||||
{K: unique.Make(Ident("inputs")), V: Array{
|
{K: unique.Make(Ident("inputs")), V: []string{
|
||||||
{Ident("binutils")},
|
"binutils",
|
||||||
{Ident("mpc")},
|
"mpc",
|
||||||
{Ident("zlib")},
|
"zlib",
|
||||||
{Ident("libucontext")},
|
"libucontext",
|
||||||
{Ident("kernel-headers")},
|
"kernel-headers",
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -365,7 +304,21 @@ func BenchmarkEvaluate(b *testing.B) {
|
|||||||
|
|
||||||
s := []Frame{{
|
s := []Frame{{
|
||||||
Func: map[unique.Handle[Ident]]F{
|
Func: map[unique.Handle[Ident]]F{
|
||||||
|
unique.Make(Ident("gcc")): {F: func(
|
||||||
|
bool,
|
||||||
|
FArgs,
|
||||||
|
) (v any, set bool, err error) {
|
||||||
|
return
|
||||||
|
}, V: map[unique.Handle[Ident]]any{
|
||||||
|
unique.Make(Ident("binutils")): "binutils",
|
||||||
|
unique.Make(Ident("mpc")): "mpc",
|
||||||
|
unique.Make(Ident("zlib")): "zlib",
|
||||||
|
unique.Make(Ident("libucontext")): "libucontext",
|
||||||
|
unique.Make(Ident("kernel-headers")): "kernel-headers",
|
||||||
|
}},
|
||||||
|
|
||||||
unique.Make(Ident("remoteTar")): {F: func(
|
unique.Make(Ident("remoteTar")): {F: func(
|
||||||
|
bool,
|
||||||
FArgs,
|
FArgs,
|
||||||
) (v any, set bool, err error) {
|
) (v any, set bool, err error) {
|
||||||
return
|
return
|
||||||
@@ -374,18 +327,21 @@ func BenchmarkEvaluate(b *testing.B) {
|
|||||||
}},
|
}},
|
||||||
|
|
||||||
unique.Make(Ident("make")): {F: func(
|
unique.Make(Ident("make")): {F: func(
|
||||||
|
bool,
|
||||||
FArgs,
|
FArgs,
|
||||||
) (v any, set bool, err error) {
|
) (v any, set bool, err error) {
|
||||||
return
|
return
|
||||||
}},
|
}},
|
||||||
|
|
||||||
unique.Make(Ident("arch")): {F: func(
|
unique.Make(Ident("arch")): {F: func(
|
||||||
|
bool,
|
||||||
FArgs,
|
FArgs,
|
||||||
) (v any, set bool, err error) {
|
) (v any, set bool, err error) {
|
||||||
return
|
return
|
||||||
}},
|
}},
|
||||||
|
|
||||||
unique.Make(Ident("noop")): {F: func(
|
unique.Make(Ident("noop")): {F: func(
|
||||||
|
bool,
|
||||||
FArgs,
|
FArgs,
|
||||||
) (v any, set bool, err error) {
|
) (v any, set bool, err error) {
|
||||||
return
|
return
|
||||||
@@ -395,12 +351,7 @@ func BenchmarkEvaluate(b *testing.B) {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
for b.Loop() {
|
for b.Loop() {
|
||||||
if _, _, err := Evaluate[string](func(
|
if _, _, err := Evaluate[string](s, gcc); err != nil {
|
||||||
Ident,
|
|
||||||
FArgs,
|
|
||||||
) (v any, set bool, err error) {
|
|
||||||
return
|
|
||||||
}, s, gcc); err != nil {
|
|
||||||
b.Fatal(err)
|
b.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,106 +0,0 @@
|
|||||||
package rosa
|
|
||||||
|
|
||||||
import (
|
|
||||||
"path"
|
|
||||||
"slices"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"hakurei.app/internal/pkg"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
// jobsE is expression for preferred job count set by [pkg].
|
|
||||||
jobsE = `"$` + pkg.EnvJobs + `"`
|
|
||||||
// jobsFlagE is expression for flag with preferred job count.
|
|
||||||
jobsFlagE = `"-j$` + pkg.EnvJobs + `"`
|
|
||||||
// jobsLE is expression for twice of preferred job count set by [pkg].
|
|
||||||
jobsLE = `"$(expr ` + jobsE + ` '*' 2)"`
|
|
||||||
// jobsLFlagE is expression for flag with double of preferred job count.
|
|
||||||
jobsLFlagE = `"-j$(expr ` + jobsE + ` '*' 2)"`
|
|
||||||
)
|
|
||||||
|
|
||||||
// newTar wraps [pkg.NewHTTPGetTar] with a simpler function signature.
|
|
||||||
func newTar(url, checksum string, compression uint32) pkg.Artifact {
|
|
||||||
return pkg.NewHTTPGetTar(nil, url, mustDecode(checksum), compression)
|
|
||||||
}
|
|
||||||
|
|
||||||
// newFromCPAN is a helper for downloading release from CPAN.
|
|
||||||
func newFromCPAN(author, name, version, checksum string) pkg.Artifact {
|
|
||||||
return newTar(
|
|
||||||
"https://cpan.metacpan.org/authors/id/"+
|
|
||||||
author[:1]+"/"+author[:2]+"/"+author+"/"+
|
|
||||||
name+"-"+version+".tar.gz",
|
|
||||||
checksum,
|
|
||||||
pkg.TarGzip,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// newFromGitLab is a helper for downloading source from GitLab.
|
|
||||||
func newFromGitLab(domain, suffix, ref, checksum string) pkg.Artifact {
|
|
||||||
return newTar(
|
|
||||||
"https://"+domain+"/"+suffix+"/-/archive/"+
|
|
||||||
ref+"/"+path.Base(suffix)+"-"+
|
|
||||||
strings.ReplaceAll(ref, "/", "-")+".tar.bz2",
|
|
||||||
checksum,
|
|
||||||
pkg.TarBzip2,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// newFromGitHub is a helper for downloading source from Microsoft Github.
|
|
||||||
func newFromGitHub(suffix, tag, checksum string) pkg.Artifact {
|
|
||||||
return newTar(
|
|
||||||
"https://github.com/"+suffix+
|
|
||||||
"/archive/refs/tags/"+tag+".tar.gz",
|
|
||||||
checksum,
|
|
||||||
pkg.TarGzip,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// newFromGitHubRelease is a helper for downloading release tarball from
|
|
||||||
// Microsoft Github.
|
|
||||||
func newFromGitHubRelease(
|
|
||||||
suffix, tag, name, checksum string,
|
|
||||||
compression uint32,
|
|
||||||
) pkg.Artifact {
|
|
||||||
return newTar(
|
|
||||||
"https://github.com/"+suffix+
|
|
||||||
"/releases/download/"+tag+"/"+name,
|
|
||||||
checksum,
|
|
||||||
compression,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// skipGNUTests generates a string for skipping specific tests by number in a
|
|
||||||
// GNU test suite. This is nontrivial because the test suite does not support
|
|
||||||
// excluding tests in any way, so ranges for all but the skipped tests have to
|
|
||||||
// be specified instead.
|
|
||||||
//
|
|
||||||
// For example, to skip test 764, ranges around the skipped test must be
|
|
||||||
// specified:
|
|
||||||
//
|
|
||||||
// 1-763 765-
|
|
||||||
//
|
|
||||||
// Tests are numbered starting from 1. The resulting string is unquoted.
|
|
||||||
func skipGNUTests(tests ...int64) string {
|
|
||||||
tests = slices.Clone(tests)
|
|
||||||
slices.Sort(tests)
|
|
||||||
|
|
||||||
var buf strings.Builder
|
|
||||||
|
|
||||||
if tests[0] != 1 {
|
|
||||||
buf.WriteString("1-")
|
|
||||||
}
|
|
||||||
|
|
||||||
for i, n := range tests {
|
|
||||||
if n != 1 && (i == 0 || tests[i-1] != n-1) {
|
|
||||||
buf.WriteString(strconv.Itoa(int(n - 1)))
|
|
||||||
buf.WriteString(" ")
|
|
||||||
}
|
|
||||||
if i == len(tests)-1 || tests[i+1] != n+1 {
|
|
||||||
buf.WriteString(strconv.Itoa(int(n + 1)))
|
|
||||||
buf.WriteString("-")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return buf.String()
|
|
||||||
}
|
|
||||||
38
internal/rosa/bzip2.go
Normal file
38
internal/rosa/bzip2.go
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newBzip2() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "1.0.8"
|
||||||
|
checksum = "cTLykcco7boom-s05H1JVsQi1AtChYL84nXkg_92Dm1Xt94Ob_qlMg_-NSguIK-c"
|
||||||
|
)
|
||||||
|
return t.NewPackage("bzip2", version, newTar(
|
||||||
|
"https://sourceware.org/pub/bzip2/bzip2-"+version+".tar.gz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
), &PackageAttr{
|
||||||
|
Writable: true,
|
||||||
|
EnterSource: true,
|
||||||
|
}, &MakeHelper{
|
||||||
|
// uses source tree as scratch space
|
||||||
|
SkipConfigure: true,
|
||||||
|
SkipCheck: true,
|
||||||
|
InPlace: true,
|
||||||
|
Make: []string{
|
||||||
|
"CC=cc",
|
||||||
|
},
|
||||||
|
Install: "make PREFIX=/work/system install",
|
||||||
|
}), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newBzip2,
|
||||||
|
|
||||||
|
Name: "bzip2",
|
||||||
|
Description: "a freely available, patent free, high-quality data compressor",
|
||||||
|
Website: "https://sourceware.org/bzip2/",
|
||||||
|
|
||||||
|
ID: 237,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -4,12 +4,118 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"hakurei.app/internal/pkg"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
func (t Toolchain) newCMake() (pkg.Artifact, string) {
|
||||||
_cmake = H("cmake")
|
const (
|
||||||
_ninja = H("ninja")
|
version = "4.3.2"
|
||||||
)
|
checksum = "6QylwRVKletndTSkZTV2YBRwgd_9rUVgav_QW23HpjUgV21AVYZOUOal8tdBDmO7"
|
||||||
|
)
|
||||||
|
return t.NewPackage("cmake", version, newFromGitHubRelease(
|
||||||
|
"Kitware/CMake",
|
||||||
|
"v"+version,
|
||||||
|
"cmake-"+version+".tar.gz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
), &PackageAttr{
|
||||||
|
// test suite expects writable source tree
|
||||||
|
Writable: true,
|
||||||
|
|
||||||
|
// expected to be writable in the copy made during bootstrap
|
||||||
|
Chmod: true,
|
||||||
|
|
||||||
|
Patches: []KV{
|
||||||
|
{"bootstrap-test-no-openssl", `diff --git a/Tests/BootstrapTest.cmake b/Tests/BootstrapTest.cmake
|
||||||
|
index 137de78bc1..b4da52e664 100644
|
||||||
|
--- a/Tests/BootstrapTest.cmake
|
||||||
|
+++ b/Tests/BootstrapTest.cmake
|
||||||
|
@@ -9,7 +9,7 @@ if(NOT nproc EQUAL 0)
|
||||||
|
endif()
|
||||||
|
message(STATUS "running bootstrap: ${bootstrap} ${ninja_arg} ${parallel_arg}")
|
||||||
|
execute_process(
|
||||||
|
- COMMAND ${bootstrap} ${ninja_arg} ${parallel_arg}
|
||||||
|
+ COMMAND ${bootstrap} ${ninja_arg} ${parallel_arg} -- -DCMAKE_USE_OPENSSL=OFF
|
||||||
|
WORKING_DIRECTORY "${bin_dir}"
|
||||||
|
RESULT_VARIABLE result
|
||||||
|
)
|
||||||
|
`},
|
||||||
|
|
||||||
|
{"disable-broken-tests-musl", `diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
|
||||||
|
index 2ead810437..f85cbb8b1c 100644
|
||||||
|
--- a/Tests/CMakeLists.txt
|
||||||
|
+++ b/Tests/CMakeLists.txt
|
||||||
|
@@ -384,7 +384,6 @@ if(BUILD_TESTING)
|
||||||
|
add_subdirectory(CMakeLib)
|
||||||
|
endif()
|
||||||
|
add_subdirectory(CMakeOnly)
|
||||||
|
- add_subdirectory(RunCMake)
|
||||||
|
|
||||||
|
add_subdirectory(FindPackageModeMakefileTest)
|
||||||
|
|
||||||
|
@@ -528,9 +527,6 @@ if(BUILD_TESTING)
|
||||||
|
-DCMake_TEST_CUDA:BOOL=${CMake_TEST_CUDA}
|
||||||
|
-DCMake_INSTALL_NAME_TOOL_BUG:BOOL=${CMake_INSTALL_NAME_TOOL_BUG}
|
||||||
|
)
|
||||||
|
- ADD_TEST_MACRO(ExportImport ExportImport)
|
||||||
|
- set_property(TEST ExportImport APPEND
|
||||||
|
- PROPERTY LABELS "CUDA")
|
||||||
|
ADD_TEST_MACRO(Unset Unset)
|
||||||
|
ADD_TEST_MACRO(PolicyScope PolicyScope)
|
||||||
|
ADD_TEST_MACRO(EmptyLibrary EmptyLibrary)
|
||||||
|
@@ -624,7 +620,6 @@ if(BUILD_TESTING)
|
||||||
|
# run test for BundleUtilities on supported platforms/compilers
|
||||||
|
if((MSVC OR
|
||||||
|
MINGW OR
|
||||||
|
- CMAKE_SYSTEM_NAME MATCHES "Linux" OR
|
||||||
|
CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||||
|
AND NOT CMAKE_GENERATOR STREQUAL "Watcom WMake")
|
||||||
|
|
||||||
|
@@ -3095,10 +3090,6 @@ if(BUILD_TESTING)
|
||||||
|
"${CMake_SOURCE_DIR}/Tests/CTestTestFdSetSize/test.cmake.in"
|
||||||
|
"${CMake_BINARY_DIR}/Tests/CTestTestFdSetSize/test.cmake"
|
||||||
|
@ONLY ESCAPE_QUOTES)
|
||||||
|
- add_test(CTestTestFdSetSize ${CMAKE_CTEST_COMMAND}
|
||||||
|
- -S "${CMake_BINARY_DIR}/Tests/CTestTestFdSetSize/test.cmake" -j20 -V --timeout 120
|
||||||
|
- --output-log "${CMake_BINARY_DIR}/Tests/CTestTestFdSetSize/testOutput.log"
|
||||||
|
- )
|
||||||
|
|
||||||
|
if(CMAKE_TESTS_CDASH_SERVER)
|
||||||
|
set(regex "^([^:]+)://([^/]+)(.*)$")
|
||||||
|
`},
|
||||||
|
},
|
||||||
|
}, &MakeHelper{
|
||||||
|
OmitDefaults: true,
|
||||||
|
|
||||||
|
ConfigureName: "/usr/src/cmake/bootstrap",
|
||||||
|
Configure: []KV{
|
||||||
|
{"prefix", "/system"},
|
||||||
|
{"parallel", jobsE},
|
||||||
|
{"--"},
|
||||||
|
{"-DCMAKE_USE_OPENSSL", "OFF"},
|
||||||
|
{"-DCMake_TEST_NO_NETWORK", "ON"},
|
||||||
|
},
|
||||||
|
Check: []string{
|
||||||
|
"CTEST_OUTPUT_ON_FAILURE=1",
|
||||||
|
"CTEST_PARALLEL_LEVEL=128",
|
||||||
|
"test",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
KernelHeaders,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newCMake,
|
||||||
|
|
||||||
|
Name: "cmake",
|
||||||
|
Description: "cross-platform, open-source build system",
|
||||||
|
Website: "https://cmake.org/",
|
||||||
|
|
||||||
|
ID: 306,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// CMakeHelper is the [CMake] build system helper.
|
// CMakeHelper is the [CMake] build system helper.
|
||||||
type CMakeHelper struct {
|
type CMakeHelper struct {
|
||||||
@@ -37,9 +143,9 @@ var _ Helper = new(CMakeHelper)
|
|||||||
// extra returns a hardcoded slice of [CMake] and [Ninja].
|
// extra returns a hardcoded slice of [CMake] and [Ninja].
|
||||||
func (attr *CMakeHelper) extra(int) P {
|
func (attr *CMakeHelper) extra(int) P {
|
||||||
if attr != nil && attr.Make {
|
if attr != nil && attr.Make {
|
||||||
return P{_cmake, _make}
|
return P{CMake, Make}
|
||||||
}
|
}
|
||||||
return P{_cmake, _ninja}
|
return P{CMake, Ninja}
|
||||||
}
|
}
|
||||||
|
|
||||||
// wantsChmod returns false.
|
// wantsChmod returns false.
|
||||||
@@ -51,11 +157,14 @@ func (*CMakeHelper) wantsWrite() bool { return false }
|
|||||||
// scriptEarly returns the zero value.
|
// scriptEarly returns the zero value.
|
||||||
func (*CMakeHelper) scriptEarly() string { return "" }
|
func (*CMakeHelper) scriptEarly() string { return "" }
|
||||||
|
|
||||||
|
// createDir returns true.
|
||||||
|
func (*CMakeHelper) createDir() bool { return true }
|
||||||
|
|
||||||
// wantsDir returns a hardcoded, deterministic pathname.
|
// wantsDir returns a hardcoded, deterministic pathname.
|
||||||
func (*CMakeHelper) wantsDir() (string, bool) { return "/cure/", true }
|
func (*CMakeHelper) wantsDir() string { return "/cure/" }
|
||||||
|
|
||||||
// script generates the cure script.
|
// script generates the cure script.
|
||||||
func (attr *CMakeHelper) script(t Toolchain, name string) string {
|
func (attr *CMakeHelper) script(s *S, name string) string {
|
||||||
if attr == nil {
|
if attr == nil {
|
||||||
attr = new(CMakeHelper)
|
attr = new(CMakeHelper)
|
||||||
}
|
}
|
||||||
@@ -71,7 +180,7 @@ func (attr *CMakeHelper) script(t Toolchain, name string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
script := attr.Script
|
script := attr.Script
|
||||||
if !attr.SkipTest && t.opts&OptSkipCheck == 0 {
|
if !attr.SkipTest && s.opts&OptSkipCheck == 0 {
|
||||||
script += "\n" + test
|
script += "\n" + test
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,20 @@
|
|||||||
musl does not implement res_ninit
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newConnman() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "2.0"
|
||||||
|
checksum = "MhVTdJOhndnZn2SWd8URKo_Pj7Zvc14tntEbrVOf9L3yVWJvpb3v3Q6104tWJgtW"
|
||||||
|
)
|
||||||
|
return t.NewPackage("connman", version, newTar(
|
||||||
|
"https://git.kernel.org/pub/scm/network/connman/connman.git/"+
|
||||||
|
"snapshot/connman-"+version+".tar.gz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
), &PackageAttr{
|
||||||
|
Patches: []KV{
|
||||||
|
{"alpine-musl-res", `musl does not implement res_ninit
|
||||||
|
|
||||||
--- a/gweb/gresolv.c
|
--- a/gweb/gresolv.c
|
||||||
+++ b/gweb/gresolv.c
|
+++ b/gweb/gresolv.c
|
||||||
@@ -57,3 +73,37 @@ musl does not implement res_ninit
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!resolv->nameserver_list)
|
if (!resolv->nameserver_list)
|
||||||
|
`},
|
||||||
|
},
|
||||||
|
}, &MakeHelper{
|
||||||
|
Generate: "./bootstrap",
|
||||||
|
},
|
||||||
|
Automake,
|
||||||
|
Libtool,
|
||||||
|
PkgConfig,
|
||||||
|
|
||||||
|
DBus,
|
||||||
|
IPTables,
|
||||||
|
GnuTLS,
|
||||||
|
Readline,
|
||||||
|
KernelHeaders,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newConnman,
|
||||||
|
|
||||||
|
Name: "connman",
|
||||||
|
Description: "a daemon for managing Internet connections",
|
||||||
|
Website: "https://git.kernel.org/pub/scm/network/connman/connman.git/",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
DBus,
|
||||||
|
IPTables,
|
||||||
|
GnuTLS,
|
||||||
|
Readline,
|
||||||
|
},
|
||||||
|
|
||||||
|
ID: 337,
|
||||||
|
})
|
||||||
|
}
|
||||||
56
internal/rosa/curl.go
Normal file
56
internal/rosa/curl.go
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newCurl() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "8.20.0"
|
||||||
|
checksum = "xyHXwrngIRGMasuzhn-I5MSCOhktwINbsWt1f_LuR-5jRVvyx_g6U1EQfDLEbr9r"
|
||||||
|
)
|
||||||
|
return t.NewPackage("curl", version, newTar(
|
||||||
|
"https://curl.se/download/curl-"+version+".tar.bz2",
|
||||||
|
checksum,
|
||||||
|
pkg.TarBzip2,
|
||||||
|
), &PackageAttr{
|
||||||
|
// remove broken test
|
||||||
|
Writable: true,
|
||||||
|
ScriptEarly: `
|
||||||
|
chmod +w tests/data && rm -f tests/data/test459
|
||||||
|
`,
|
||||||
|
}, &MakeHelper{
|
||||||
|
Configure: []KV{
|
||||||
|
{"with-openssl"},
|
||||||
|
{"with-ca-bundle", "/system/etc/ssl/certs/ca-bundle.crt"},
|
||||||
|
|
||||||
|
{"disable-smb"},
|
||||||
|
},
|
||||||
|
Check: []string{
|
||||||
|
"TFLAGS=" + jobsLFlagE,
|
||||||
|
"test-nonflaky",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Perl,
|
||||||
|
Python,
|
||||||
|
PkgConfig,
|
||||||
|
Diffutils,
|
||||||
|
|
||||||
|
Libpsl,
|
||||||
|
OpenSSL,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newCurl,
|
||||||
|
|
||||||
|
Name: "curl",
|
||||||
|
Description: "command line tool and library for transferring data with URLs",
|
||||||
|
Website: "https://curl.se/",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
Libpsl,
|
||||||
|
OpenSSL,
|
||||||
|
},
|
||||||
|
|
||||||
|
ID: 381,
|
||||||
|
})
|
||||||
|
}
|
||||||
81
internal/rosa/dbus.go
Normal file
81
internal/rosa/dbus.go
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newDBus() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "1.16.2"
|
||||||
|
checksum = "INwOuNdrDG7XW5ilW_vn8JSxEa444rRNc5ho97i84I1CNF09OmcFcV-gzbF4uCyg"
|
||||||
|
)
|
||||||
|
return t.NewPackage("dbus", version, newFromGitLab(
|
||||||
|
"gitlab.freedesktop.org",
|
||||||
|
"dbus/dbus",
|
||||||
|
"dbus-"+version,
|
||||||
|
checksum,
|
||||||
|
), &PackageAttr{
|
||||||
|
// OSError: [Errno 30] Read-only file system: '/usr/src/dbus/subprojects/packagecache'
|
||||||
|
Writable: true,
|
||||||
|
// PermissionError: [Errno 13] Permission denied: '/usr/src/dbus/subprojects/packagecache'
|
||||||
|
Chmod: true,
|
||||||
|
}, &MesonHelper{
|
||||||
|
Setup: []KV{
|
||||||
|
{"Depoll", "enabled"},
|
||||||
|
{"Dinotify", "enabled"},
|
||||||
|
{"Dx11_autolaunch", "disabled"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
GLib,
|
||||||
|
Libexpat,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newDBus,
|
||||||
|
|
||||||
|
Name: "dbus",
|
||||||
|
Description: "a message bus system",
|
||||||
|
Website: "https://www.freedesktop.org/wiki/Software/dbus/",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
GLib,
|
||||||
|
Libexpat,
|
||||||
|
},
|
||||||
|
|
||||||
|
ID: 5356,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t Toolchain) newXDGDBusProxy() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "0.1.7"
|
||||||
|
checksum = "UW5Pe-TP-XAaN-kTbxrkOQ7eYdmlAQlr2pdreLtPT0uwdAz-7rzDP8V_8PWuZBup"
|
||||||
|
)
|
||||||
|
return t.NewPackage("xdg-dbus-proxy", version, newFromGitHub(
|
||||||
|
"flatpak/xdg-dbus-proxy",
|
||||||
|
version,
|
||||||
|
checksum,
|
||||||
|
), nil, &MesonHelper{
|
||||||
|
Setup: []KV{
|
||||||
|
{"Dman", "disabled"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
DBus,
|
||||||
|
|
||||||
|
GLib,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newXDGDBusProxy,
|
||||||
|
|
||||||
|
Name: "xdg-dbus-proxy",
|
||||||
|
Description: "a filtering proxy for D-Bus connections",
|
||||||
|
Website: "https://github.com/flatpak/xdg-dbus-proxy",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
GLib,
|
||||||
|
},
|
||||||
|
|
||||||
|
ID: 58434,
|
||||||
|
})
|
||||||
|
}
|
||||||
43
internal/rosa/dtc.go
Normal file
43
internal/rosa/dtc.go
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newDTC() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "1.7.2"
|
||||||
|
checksum = "vUoiRynPyYRexTpS6USweT5p4SVHvvVJs8uqFkkVD-YnFjwf6v3elQ0-Etrh00Dt"
|
||||||
|
)
|
||||||
|
return t.NewPackage("dtc", version, newTar(
|
||||||
|
"https://git.kernel.org/pub/scm/utils/dtc/dtc.git/snapshot/"+
|
||||||
|
"dtc-v"+version+".tar.gz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
), &PackageAttr{
|
||||||
|
// works around buggy test:
|
||||||
|
// fdtdump-runtest.sh /usr/src/dtc/tests/fdtdump.dts
|
||||||
|
Writable: true,
|
||||||
|
Chmod: true,
|
||||||
|
}, &MesonHelper{
|
||||||
|
Setup: []KV{
|
||||||
|
{"Dyaml", "disabled"},
|
||||||
|
{"Dstatic-build", "true"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Flex,
|
||||||
|
Bison,
|
||||||
|
M4,
|
||||||
|
Coreutils,
|
||||||
|
Diffutils,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newDTC,
|
||||||
|
|
||||||
|
Name: "dtc",
|
||||||
|
Description: "The Device Tree Compiler",
|
||||||
|
Website: "https://git.kernel.org/pub/scm/utils/dtc/dtc.git/",
|
||||||
|
|
||||||
|
ID: 16911,
|
||||||
|
})
|
||||||
|
}
|
||||||
59
internal/rosa/elfutils.go
Normal file
59
internal/rosa/elfutils.go
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newElfutils() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "0.195"
|
||||||
|
checksum = "JrGnBD38w8Mj0ZxDw3fKlRBFcLvRKu8rcYnX35R9yTlUSYnzTazyLboG-a2CsJlu"
|
||||||
|
)
|
||||||
|
return t.NewPackage("elfutils", version, newTar(
|
||||||
|
"https://sourceware.org/elfutils/ftp/"+
|
||||||
|
version+"/elfutils-"+version+".tar.bz2",
|
||||||
|
checksum,
|
||||||
|
pkg.TarBzip2,
|
||||||
|
), &PackageAttr{
|
||||||
|
Env: []string{
|
||||||
|
"CC=cc" +
|
||||||
|
// nonstandard glibc extension
|
||||||
|
" -DFNM_EXTMATCH=0",
|
||||||
|
},
|
||||||
|
}, &MakeHelper{
|
||||||
|
// nonstandard glibc extension
|
||||||
|
SkipCheck: true,
|
||||||
|
|
||||||
|
Configure: []KV{
|
||||||
|
{"enable-deterministic-archives"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
M4,
|
||||||
|
PkgConfig,
|
||||||
|
|
||||||
|
Zlib,
|
||||||
|
Bzip2,
|
||||||
|
Zstd,
|
||||||
|
ArgpStandalone,
|
||||||
|
MuslFts,
|
||||||
|
MuslObstack,
|
||||||
|
KernelHeaders,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newElfutils,
|
||||||
|
|
||||||
|
Name: "elfutils",
|
||||||
|
Description: "utilities and libraries to handle ELF files and DWARF data",
|
||||||
|
Website: "https://sourceware.org/elfutils/",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
Zlib,
|
||||||
|
Bzip2,
|
||||||
|
Zstd,
|
||||||
|
MuslFts,
|
||||||
|
MuslObstack,
|
||||||
|
},
|
||||||
|
|
||||||
|
ID: 5679,
|
||||||
|
})
|
||||||
|
}
|
||||||
58
internal/rosa/fakeroot.go
Normal file
58
internal/rosa/fakeroot.go
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newFakeroot() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "1.37.2"
|
||||||
|
checksum = "4ve-eDqVspzQ6VWDhPS0NjW3aSenBJcPAJq_BFT7OOFgUdrQzoTBxZWipDAGWxF8"
|
||||||
|
)
|
||||||
|
return t.NewPackage("fakeroot", version, newFromGitLab(
|
||||||
|
"salsa.debian.org",
|
||||||
|
"clint/fakeroot",
|
||||||
|
"upstream/"+version,
|
||||||
|
checksum,
|
||||||
|
), &PackageAttr{
|
||||||
|
Patches: []KV{
|
||||||
|
{"remove-broken-docs", `diff --git a/doc/Makefile.am b/doc/Makefile.am
|
||||||
|
index f135ad9..85c784c 100644
|
||||||
|
--- a/doc/Makefile.am
|
||||||
|
+++ b/doc/Makefile.am
|
||||||
|
@@ -1,5 +1,4 @@
|
||||||
|
AUTOMAKE_OPTIONS=foreign
|
||||||
|
-SUBDIRS = de es fr nl pt ro sv
|
||||||
|
|
||||||
|
man_MANS = faked.1 fakeroot.1
|
||||||
|
|
||||||
|
`},
|
||||||
|
},
|
||||||
|
|
||||||
|
Env: []string{
|
||||||
|
"CONFIG_SHELL=/bin/sh",
|
||||||
|
},
|
||||||
|
}, &MakeHelper{
|
||||||
|
Generate: "./bootstrap",
|
||||||
|
|
||||||
|
// makes assumptions about /etc/passwd
|
||||||
|
SkipCheck: true,
|
||||||
|
},
|
||||||
|
Automake,
|
||||||
|
Libtool,
|
||||||
|
PkgConfig,
|
||||||
|
|
||||||
|
Attr,
|
||||||
|
Libcap,
|
||||||
|
KernelHeaders,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newFakeroot,
|
||||||
|
|
||||||
|
Name: "fakeroot",
|
||||||
|
Description: "tool for simulating superuser privileges",
|
||||||
|
Website: "https://salsa.debian.org/clint/fakeroot",
|
||||||
|
|
||||||
|
ID: 12048,
|
||||||
|
})
|
||||||
|
}
|
||||||
32
internal/rosa/flex.go
Normal file
32
internal/rosa/flex.go
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import (
|
||||||
|
"hakurei.app/internal/pkg"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (t Toolchain) newFlex() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "2.6.4"
|
||||||
|
checksum = "p9POjQU7VhgOf3x5iFro8fjhy0NOanvA7CTeuWS_veSNgCixIJshTrWVkc5XLZkB"
|
||||||
|
)
|
||||||
|
return t.NewPackage("flex", version, newFromGitHubRelease(
|
||||||
|
"westes/flex",
|
||||||
|
"v"+version,
|
||||||
|
"flex-"+version+".tar.gz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
), nil, (*MakeHelper)(nil),
|
||||||
|
M4,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newFlex,
|
||||||
|
|
||||||
|
Name: "flex",
|
||||||
|
Description: "scanner generator for lexing in C and C++",
|
||||||
|
Website: "https://github.com/westes/flex/",
|
||||||
|
|
||||||
|
ID: 819,
|
||||||
|
})
|
||||||
|
}
|
||||||
27
internal/rosa/freetype.go
Normal file
27
internal/rosa/freetype.go
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newFreetype() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "2.14.3"
|
||||||
|
checksum = "-WfLv8fVJNyCHpP_lriiDzOcVbBL9ajdQ3tl8AzIIUa9-8sVpU9irxOmSMgRHWYz"
|
||||||
|
)
|
||||||
|
return t.NewPackage("freetype", version, newTar(
|
||||||
|
"https://download.savannah.gnu.org/releases/freetype/"+
|
||||||
|
"freetype-"+version+".tar.gz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
), nil, (*MakeHelper)(nil)), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newFreetype,
|
||||||
|
|
||||||
|
Name: "freetype",
|
||||||
|
Description: "a freely available software library to render fonts",
|
||||||
|
Website: "http://www.freetype.org/",
|
||||||
|
|
||||||
|
ID: 854,
|
||||||
|
})
|
||||||
|
}
|
||||||
43
internal/rosa/fuse.go
Normal file
43
internal/rosa/fuse.go
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newFuse() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "3.18.2"
|
||||||
|
checksum = "iL-7b7eUtmlVSf5cSq0dzow3UiqSjBmzV3cI_ENPs1tXcHdktkG45j1V12h-4jZe"
|
||||||
|
)
|
||||||
|
return t.NewPackage("fuse", version, newFromGitHubRelease(
|
||||||
|
"libfuse/libfuse",
|
||||||
|
"fuse-"+version,
|
||||||
|
"fuse-"+version+".tar.gz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
), nil, &MesonHelper{
|
||||||
|
Setup: []KV{
|
||||||
|
{"Ddefault_library", "both"},
|
||||||
|
{"Dtests", "true"},
|
||||||
|
{"Duseroot", "false"},
|
||||||
|
{"Dinitscriptdir", "/system/etc"},
|
||||||
|
},
|
||||||
|
|
||||||
|
ScriptCompiled: "python3 -m pytest test/",
|
||||||
|
// this project uses pytest
|
||||||
|
SkipTest: true,
|
||||||
|
},
|
||||||
|
PythonPyTest,
|
||||||
|
|
||||||
|
KernelHeaders,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newFuse,
|
||||||
|
|
||||||
|
Name: "fuse",
|
||||||
|
Description: "the reference implementation of the Linux FUSE interface",
|
||||||
|
Website: "https://github.com/libfuse/libfuse/",
|
||||||
|
|
||||||
|
ID: 861,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -7,10 +7,103 @@ import (
|
|||||||
"hakurei.app/internal/pkg"
|
"hakurei.app/internal/pkg"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
func (t Toolchain) newGit() (pkg.Artifact, string) {
|
||||||
_git = H("git")
|
const (
|
||||||
_nssCACert = H("nss-cacert")
|
version = "2.54.0"
|
||||||
)
|
checksum = "7vGKtFOJGqY8DO4e8UMRax7dLgImXKQz5MMalec6MlgYrsarffSJjgOughwRFpSH"
|
||||||
|
)
|
||||||
|
return t.NewPackage("git", version, newTar(
|
||||||
|
"https://www.kernel.org/pub/software/scm/git/"+
|
||||||
|
"git-"+version+".tar.gz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
), &PackageAttr{
|
||||||
|
ScriptEarly: `
|
||||||
|
ln -s ../../system/bin/perl /usr/bin/ || true
|
||||||
|
|
||||||
|
# test suite assumes apache
|
||||||
|
rm -f /system/bin/httpd
|
||||||
|
`,
|
||||||
|
|
||||||
|
// uses source tree as scratch space
|
||||||
|
EnterSource: true,
|
||||||
|
}, &MakeHelper{
|
||||||
|
InPlace: true,
|
||||||
|
Generate: "make configure",
|
||||||
|
ScriptMakeEarly: `
|
||||||
|
function disable_test {
|
||||||
|
local test=$1 pattern=${2:-''}
|
||||||
|
if [ $# -eq 1 ]; then
|
||||||
|
rm "t/${test}.sh"
|
||||||
|
else
|
||||||
|
sed -i "t/${test}.sh" \
|
||||||
|
-e "/^\s*test_expect_.*$pattern/,/^\s*' *\$/{s/^/: #/}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
disable_test t1800-hook
|
||||||
|
disable_test t5319-multi-pack-index
|
||||||
|
disable_test t1305-config-include
|
||||||
|
disable_test t3900-i18n-commit
|
||||||
|
disable_test t3507-cherry-pick-conflict
|
||||||
|
disable_test t4201-shortlog
|
||||||
|
disable_test t5303-pack-corruption-resilience
|
||||||
|
disable_test t4301-merge-tree-write-tree
|
||||||
|
disable_test t8005-blame-i18n
|
||||||
|
disable_test t9350-fast-export
|
||||||
|
disable_test t9300-fast-import
|
||||||
|
disable_test t0211-trace2-perf
|
||||||
|
disable_test t1517-outside-repo
|
||||||
|
disable_test t2200-add-update
|
||||||
|
disable_test t0027-auto-crlf
|
||||||
|
disable_test t7513-interpret-trailers
|
||||||
|
disable_test t7703-repack-geometric
|
||||||
|
disable_test t7002-mv-sparse-checkout
|
||||||
|
disable_test t1451-fsck-buffer
|
||||||
|
disable_test t4104-apply-boundary
|
||||||
|
disable_test t4200-rerere
|
||||||
|
disable_test t5515-fetch-merge-logic
|
||||||
|
`,
|
||||||
|
Check: []string{
|
||||||
|
"-C t",
|
||||||
|
`GIT_PROVE_OPTS="--jobs 32 --failures"`,
|
||||||
|
"prove",
|
||||||
|
},
|
||||||
|
Install: `make \
|
||||||
|
` + jobsFlagE + ` \
|
||||||
|
DESTDIR=/work \
|
||||||
|
NO_INSTALL_HARDLINKS=1 \
|
||||||
|
install`,
|
||||||
|
},
|
||||||
|
// test suite hangs on mksh
|
||||||
|
Bash,
|
||||||
|
|
||||||
|
Diffutils,
|
||||||
|
Autoconf,
|
||||||
|
Gettext,
|
||||||
|
|
||||||
|
Zlib,
|
||||||
|
Curl,
|
||||||
|
Libexpat,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newGit,
|
||||||
|
|
||||||
|
Name: "git",
|
||||||
|
Description: "distributed version control system",
|
||||||
|
Website: "https://www.git-scm.com/",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
Zlib,
|
||||||
|
Curl,
|
||||||
|
Libexpat,
|
||||||
|
},
|
||||||
|
|
||||||
|
ID: 5350,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// NewViaGit returns a [pkg.Artifact] for cloning a git repository.
|
// NewViaGit returns a [pkg.Artifact] for cloning a git repository.
|
||||||
func (t Toolchain) NewViaGit(
|
func (t Toolchain) NewViaGit(
|
||||||
@@ -21,8 +114,8 @@ func (t Toolchain) NewViaGit(
|
|||||||
path.Base(url),
|
path.Base(url),
|
||||||
".git",
|
".git",
|
||||||
)+"-src-"+path.Base(rev), THostNet, t.Append(nil,
|
)+"-src-"+path.Base(rev), THostNet, t.Append(nil,
|
||||||
_nssCACert,
|
NSSCACert,
|
||||||
_git,
|
Git,
|
||||||
), &checksum, nil, `
|
), &checksum, nil, `
|
||||||
git \
|
git \
|
||||||
-c advice.detachedHead=false \
|
-c advice.detachedHead=false \
|
||||||
|
|||||||
248
internal/rosa/glslang.go
Normal file
248
internal/rosa/glslang.go
Normal file
@@ -0,0 +1,248 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import (
|
||||||
|
"slices"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"hakurei.app/internal/pkg"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (t Toolchain) newSPIRVHeaders() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "1.4.341.0"
|
||||||
|
checksum = "0PL43-19Iaw4k7_D8J8BvoJ-iLgCVSYZ2ThgDPGfAJwIJFtre7l0cnQtLjcY-JvD"
|
||||||
|
)
|
||||||
|
return t.NewPackage("spirv-headers", version, newFromGitHub(
|
||||||
|
"KhronosGroup/SPIRV-Headers",
|
||||||
|
"vulkan-sdk-"+version,
|
||||||
|
checksum,
|
||||||
|
), nil, &CMakeHelper{
|
||||||
|
// upstream has no tests
|
||||||
|
SkipTest: true,
|
||||||
|
}), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newSPIRVHeaders,
|
||||||
|
|
||||||
|
Name: "spirv-headers",
|
||||||
|
Description: "machine-readable files for the SPIR-V Registry",
|
||||||
|
Website: "https://github.com/KhronosGroup/SPIRV-Headers",
|
||||||
|
|
||||||
|
ID: 230542,
|
||||||
|
|
||||||
|
// upstream changed version scheme, anitya incapable of filtering them
|
||||||
|
latest: func(v *Versions) string {
|
||||||
|
for _, s := range v.Stable {
|
||||||
|
fields := strings.SplitN(s, ".", 4)
|
||||||
|
if len(fields) != 4 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if slices.ContainsFunc(fields, func(f string) bool {
|
||||||
|
return slices.ContainsFunc([]byte(f), func(d byte) bool {
|
||||||
|
return d < '0' || d > '9'
|
||||||
|
})
|
||||||
|
}) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
return v.Latest
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t Toolchain) newSPIRVTools() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "2026.1"
|
||||||
|
checksum = "ZSQPQx8NltCDzQLk4qlaVxyWRWeI_JtsjEpeFt3kezTanl9DTHfLixSUCezMFBjv"
|
||||||
|
)
|
||||||
|
return t.NewPackage("spirv-tools", version, newFromGitHub(
|
||||||
|
"KhronosGroup/SPIRV-Tools",
|
||||||
|
"v"+version,
|
||||||
|
checksum,
|
||||||
|
), nil, &CMakeHelper{
|
||||||
|
Cache: []KV{
|
||||||
|
{"SPIRV-Headers_SOURCE_DIR", "/system"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Python,
|
||||||
|
|
||||||
|
SPIRVHeaders,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newSPIRVTools,
|
||||||
|
|
||||||
|
Name: "spirv-tools",
|
||||||
|
Description: "an API and commands for processing SPIR-V modules",
|
||||||
|
Website: "https://github.com/KhronosGroup/SPIRV-Tools",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
SPIRVHeaders,
|
||||||
|
},
|
||||||
|
|
||||||
|
ID: 14894,
|
||||||
|
|
||||||
|
latest: (*Versions).getStable,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t Toolchain) newGlslang() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "16.3.0"
|
||||||
|
checksum = "xyqDf8k3-D0_BXHGi0uLgMglnJ05Rf3j73QgbDs3sGtKNdBIQhY8JfqX1NcNoJQN"
|
||||||
|
)
|
||||||
|
return t.NewPackage("glslang", version, newFromGitHub(
|
||||||
|
"KhronosGroup/glslang",
|
||||||
|
version,
|
||||||
|
checksum,
|
||||||
|
), &PackageAttr{
|
||||||
|
// test suite writes to source
|
||||||
|
Writable: true,
|
||||||
|
Chmod: true,
|
||||||
|
}, &CMakeHelper{
|
||||||
|
Cache: []KV{
|
||||||
|
{"BUILD_SHARED_LIBS", "ON"},
|
||||||
|
{"ALLOW_EXTERNAL_SPIRV_TOOLS", "ON"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Python,
|
||||||
|
Bash,
|
||||||
|
Diffutils,
|
||||||
|
|
||||||
|
SPIRVTools,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newGlslang,
|
||||||
|
|
||||||
|
Name: "glslang",
|
||||||
|
Description: "reference front end for GLSL/ESSL",
|
||||||
|
Website: "https://github.com/KhronosGroup/glslang",
|
||||||
|
|
||||||
|
ID: 205796,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t Toolchain) newSPIRVLLVMTranslator() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "22.1.2"
|
||||||
|
checksum = "JZAaV5ewYcm-35YA_U2BM2IcsQouZtX1BLZR0zh2vSlfEXMsT5OCtY4Gh5RJkcGy"
|
||||||
|
)
|
||||||
|
skipChecks := []string{
|
||||||
|
// error: line 13: OpTypeCooperativeMatrixKHR Scope is limited to Workgroup and Subgroup
|
||||||
|
"cooperative_matrix_constant_null.spvasm",
|
||||||
|
}
|
||||||
|
|
||||||
|
switch t.arch {
|
||||||
|
case "arm64":
|
||||||
|
skipChecks = append(skipChecks,
|
||||||
|
// LLVM ERROR: unsupported calling convention
|
||||||
|
"DebugInfo/COFF/no-cus.ll",
|
||||||
|
"DebugInfo/Generic/2009-11-05-DeadGlobalVariable.ll",
|
||||||
|
"DebugInfo/Generic/2009-11-10-CurrentFn.ll",
|
||||||
|
"DebugInfo/Generic/2010-01-05-DbgScope.ll",
|
||||||
|
"DebugInfo/Generic/2010-03-12-llc-crash.ll",
|
||||||
|
"DebugInfo/Generic/2010-03-24-MemberFn.ll",
|
||||||
|
"DebugInfo/Generic/2010-04-19-FramePtr.ll",
|
||||||
|
"DebugInfo/Generic/2010-06-29-InlinedFnLocalVar.ll",
|
||||||
|
"DebugInfo/Generic/2010-10-01-crash.ll",
|
||||||
|
"DebugInfo/Generic/PR20038.ll",
|
||||||
|
"DebugInfo/Generic/constant-pointers.ll",
|
||||||
|
"DebugInfo/Generic/dead-argument-order.ll",
|
||||||
|
"DebugInfo/Generic/debug-info-eis-option.ll",
|
||||||
|
"DebugInfo/Generic/def-line.ll",
|
||||||
|
"DebugInfo/Generic/discriminator.ll",
|
||||||
|
"DebugInfo/Generic/dwarf-public-names.ll",
|
||||||
|
"DebugInfo/Generic/enum.ll",
|
||||||
|
"DebugInfo/Generic/func-using-decl.ll",
|
||||||
|
"DebugInfo/Generic/global.ll",
|
||||||
|
"DebugInfo/Generic/imported-name-inlined.ll",
|
||||||
|
"DebugInfo/Generic/incorrect-variable-debugloc1.ll",
|
||||||
|
"DebugInfo/Generic/inline-scopes.ll",
|
||||||
|
"DebugInfo/Generic/inlined-arguments.ll",
|
||||||
|
"DebugInfo/Generic/inlined-vars.ll",
|
||||||
|
"DebugInfo/Generic/linear-dbg-value.ll",
|
||||||
|
"DebugInfo/Generic/linkage-name-abstract.ll",
|
||||||
|
"DebugInfo/Generic/member-order.ll",
|
||||||
|
"DebugInfo/Generic/missing-abstract-variable.ll",
|
||||||
|
"DebugInfo/Generic/multiline.ll",
|
||||||
|
"DebugInfo/Generic/namespace_function_definition.ll",
|
||||||
|
"DebugInfo/Generic/namespace_inline_function_definition.ll",
|
||||||
|
"DebugInfo/Generic/noscopes.ll",
|
||||||
|
"DebugInfo/Generic/ptrsize.ll",
|
||||||
|
"DebugInfo/Generic/restrict.ll",
|
||||||
|
"DebugInfo/Generic/two-cus-from-same-file.ll",
|
||||||
|
"DebugInfo/Generic/version.ll",
|
||||||
|
"DebugInfo/LocalAddressSpace.ll",
|
||||||
|
"DebugInfo/UnknownBaseType.ll",
|
||||||
|
"DebugInfo/expr-opcode.ll",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return t.NewPackage("spirv-llvm-translator", version, newFromGitHub(
|
||||||
|
"KhronosGroup/SPIRV-LLVM-Translator",
|
||||||
|
"v"+version, checksum,
|
||||||
|
), &PackageAttr{
|
||||||
|
Patches: []KV{
|
||||||
|
{"remove-early-prefix", `diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
|
index c000a77e..f18f3fde 100644
|
||||||
|
--- a/CMakeLists.txt
|
||||||
|
+++ b/CMakeLists.txt
|
||||||
|
@@ -164,7 +164,7 @@ install(
|
||||||
|
${LLVM_SPIRV_INCLUDE_DIRS}/LLVMSPIRVOpts.h
|
||||||
|
${LLVM_SPIRV_INCLUDE_DIRS}/LLVMSPIRVExtensions.inc
|
||||||
|
DESTINATION
|
||||||
|
- ${CMAKE_INSTALL_PREFIX}/include/LLVMSPIRVLib
|
||||||
|
+ include/LLVMSPIRVLib
|
||||||
|
)
|
||||||
|
|
||||||
|
configure_file(LLVMSPIRVLib.pc.in ${CMAKE_BINARY_DIR}/LLVMSPIRVLib.pc @ONLY)
|
||||||
|
@@ -172,5 +172,5 @@ install(
|
||||||
|
FILES
|
||||||
|
${CMAKE_BINARY_DIR}/LLVMSPIRVLib.pc
|
||||||
|
DESTINATION
|
||||||
|
- ${CMAKE_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}/pkgconfig
|
||||||
|
+ lib${LLVM_LIBDIR_SUFFIX}/pkgconfig
|
||||||
|
)
|
||||||
|
;`},
|
||||||
|
},
|
||||||
|
|
||||||
|
// litArgs emits shell syntax
|
||||||
|
ScriptEarly: `
|
||||||
|
export LIT_OPTS=` + litArgs(true, skipChecks...) + `
|
||||||
|
`,
|
||||||
|
}, &CMakeHelper{
|
||||||
|
Cache: []KV{
|
||||||
|
{"CMAKE_SKIP_BUILD_RPATH", "ON"},
|
||||||
|
{"BUILD_SHARED_LIBS", "ON"},
|
||||||
|
{"LLVM_SPIRV_ENABLE_LIBSPIRV_DIS", "ON"},
|
||||||
|
{"LLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR", "/system"},
|
||||||
|
{"LLVM_EXTERNAL_LIT", "/system/bin/lit"},
|
||||||
|
{"LLVM_INCLUDE_TESTS", "ON"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Bash,
|
||||||
|
LIT,
|
||||||
|
|
||||||
|
SPIRVTools,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newSPIRVLLVMTranslator,
|
||||||
|
|
||||||
|
Name: "spirv-llvm-translator",
|
||||||
|
Description: "bi-directional translation between SPIR-V and LLVM IR",
|
||||||
|
Website: "https://github.com/KhronosGroup/SPIRV-LLVM-Translator",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
SPIRVTools,
|
||||||
|
},
|
||||||
|
|
||||||
|
ID: 227273,
|
||||||
|
})
|
||||||
|
}
|
||||||
1366
internal/rosa/gnu.go
Normal file
1366
internal/rosa/gnu.go
Normal file
File diff suppressed because it is too large
Load Diff
@@ -11,18 +11,18 @@ func TestSkipGNUTests(t *testing.T) {
|
|||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
tests []int64
|
tests []int
|
||||||
want string
|
want string
|
||||||
}{
|
}{
|
||||||
{[]int64{764}, "1-763 765-"},
|
{[]int{764}, "1-763 765-"},
|
||||||
{[]int64{764, 0xcafe, 37, 9}, "1-8 10-36 38-763 765-51965 51967-"},
|
{[]int{764, 0xcafe, 37, 9}, "1-8 10-36 38-763 765-51965 51967-"},
|
||||||
{[]int64{1, 2, 0xbed}, "3-3052 3054-"},
|
{[]int{1, 2, 0xbed}, "3-3052 3054-"},
|
||||||
{[]int64{3, 4}, "1-2 5-"},
|
{[]int{3, 4}, "1-2 5-"},
|
||||||
}
|
}
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
t.Run(strings.Join(slices.Collect(func(yield func(string) bool) {
|
t.Run(strings.Join(slices.Collect(func(yield func(string) bool) {
|
||||||
for _, n := range tc.tests {
|
for _, n := range tc.tests {
|
||||||
yield(strconv.Itoa(int(n)))
|
yield(strconv.Itoa(n))
|
||||||
}
|
}
|
||||||
}), ","), func(t *testing.T) {
|
}), ","), func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
@@ -6,113 +6,89 @@ import (
|
|||||||
"hakurei.app/internal/pkg"
|
"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,
|
||||||
|
), nil, []string{
|
||||||
|
"CGO_ENABLED=0",
|
||||||
|
}, `
|
||||||
|
mkdir -p /var/tmp/ /work/system/
|
||||||
|
cp -r /usr/src/go /work/system/
|
||||||
|
cd /work/system/go/src
|
||||||
|
chmod -R +w ..
|
||||||
|
|
||||||
|
./make.bash
|
||||||
|
`, pkg.Path(AbsUsrSrc.Append("go"), false, newTar(
|
||||||
|
"https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
)))
|
||||||
|
}
|
||||||
|
|
||||||
// newGo returns a specific version of the Go toolchain.
|
// newGo returns a specific version of the Go toolchain.
|
||||||
func (t Toolchain) newGo(
|
func (t Toolchain) newGo(
|
||||||
version, checksum string,
|
version, checksum string,
|
||||||
env []string,
|
env []string,
|
||||||
script string,
|
script string,
|
||||||
boot pkg.Artifact,
|
extra ...pkg.Artifact,
|
||||||
) pkg.Artifact {
|
) pkg.Artifact {
|
||||||
return t.NewPackage("go", version, newTar(
|
name := "all"
|
||||||
"https://go.dev/dl/go"+version+".src.tar.gz",
|
if t.opts&OptSkipCheck != 0 {
|
||||||
checksum,
|
name = "make"
|
||||||
pkg.TarGzip,
|
}
|
||||||
), &PackageAttr{
|
return t.New("go"+version, 0, t.Append(extra,
|
||||||
EnterSource: true,
|
Bash,
|
||||||
Env: slices.Concat([]string{
|
), nil, slices.Concat([]string{
|
||||||
"CC=cc",
|
"CC=cc",
|
||||||
"GOCACHE=/tmp/gocache",
|
"GOCACHE=/tmp/gocache",
|
||||||
"GOROOT_BOOTSTRAP=/system/go",
|
"GOROOT_BOOTSTRAP=/system/go",
|
||||||
"TMPDIR=/dev/shm/go",
|
"TMPDIR=/dev/shm/go",
|
||||||
}, env),
|
}, env), `
|
||||||
|
mkdir /work/system "${TMPDIR}"
|
||||||
Extra: []pkg.Artifact{boot},
|
cp -r /usr/src/go /work/system
|
||||||
}, &GenericHelper{
|
cd /work/system/go/src
|
||||||
InPlace: true,
|
|
||||||
Build: `
|
|
||||||
mkdir /work/system/ "${TMPDIR}"
|
|
||||||
cp -r . /work/system/go
|
|
||||||
cd /work/system/go/src/
|
|
||||||
chmod -R +w ..
|
chmod -R +w ..
|
||||||
` + script + `
|
`+script+`
|
||||||
set +u
|
./`+name+`.bash
|
||||||
. ./make.bash "$@" --no-banner
|
|
||||||
set -u
|
|
||||||
`,
|
|
||||||
Check: "bash run.bash --no-rebuild\n",
|
|
||||||
Install: `
|
|
||||||
../bin/go tool dist banner # print build info
|
|
||||||
|
|
||||||
mkdir /work/system/bin
|
mkdir /work/system/bin
|
||||||
ln -s \
|
ln -s \
|
||||||
../go/bin/go \
|
../go/bin/go \
|
||||||
../go/bin/gofmt \
|
../go/bin/gofmt \
|
||||||
/work/system/bin
|
/work/system/bin
|
||||||
`,
|
`, pkg.Path(AbsUsrSrc.Append("go"), false, newTar(
|
||||||
},
|
"https://go.dev/dl/go"+version+".src.tar.gz",
|
||||||
_bash,
|
checksum,
|
||||||
)
|
pkg.TarGzip,
|
||||||
|
)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func (t Toolchain) newGoLatest() (pkg.Artifact, string) {
|
||||||
const (
|
var (
|
||||||
version = "1.26.3"
|
bootstrapEnv []string
|
||||||
checksum = "lEiFocZFnN5fKvZzmwVdqc9pYUjAuhzqZGbuiOqxUP4XdcY8yECisKcqsQ_eNn1N"
|
bootstrapExtra []pkg.Artifact
|
||||||
|
|
||||||
|
finalEnv []string
|
||||||
)
|
)
|
||||||
meta := Metadata{
|
switch t.arch {
|
||||||
Name: "go",
|
case "amd64":
|
||||||
Description: "the Go programming language toolchain",
|
bootstrapExtra = append(bootstrapExtra, t.newGoBootstrap())
|
||||||
Website: "https://go.dev",
|
|
||||||
Version: version,
|
|
||||||
|
|
||||||
ID: 1227,
|
case "arm64", "riscv64":
|
||||||
|
bootstrapEnv = append(bootstrapEnv, "GOROOT_BOOTSTRAP=/system")
|
||||||
|
bootstrapExtra = t.Append(bootstrapExtra, gcc)
|
||||||
|
finalEnv = append(finalEnv, "CGO_ENABLED=0")
|
||||||
|
|
||||||
|
default:
|
||||||
|
panic("unsupported target " + t.arch)
|
||||||
}
|
}
|
||||||
native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) {
|
|
||||||
var (
|
|
||||||
bootstrapEnv []string
|
|
||||||
bootstrapEarly pkg.Artifact
|
|
||||||
|
|
||||||
finalEnv []string
|
go119 := t.newGo(
|
||||||
)
|
"1.19",
|
||||||
switch t.arch {
|
"9_e0aFHsIkVxWVGsp9T2RvvjOc3p4n9o9S8tkNe9Cvgzk_zI2FhRQB7ioQkeAAro",
|
||||||
case "amd64":
|
append(bootstrapEnv, "CGO_ENABLED=0"), `
|
||||||
bootstrapEarly = t.NewPackage("go", "1.4-bootstrap", newTar(
|
|
||||||
"https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz",
|
|
||||||
"8o9JL_ToiQKadCTb04nvBDkp8O1xiWOolAxVEqaTGodieNe4lOFEjlOxN3bwwe23",
|
|
||||||
pkg.TarGzip,
|
|
||||||
), &PackageAttr{
|
|
||||||
EnterSource: true,
|
|
||||||
Env: []string{
|
|
||||||
"CGO_ENABLED=0",
|
|
||||||
},
|
|
||||||
}, &GenericHelper{
|
|
||||||
InPlace: true,
|
|
||||||
Build: `
|
|
||||||
mkdir /work/system/
|
|
||||||
cp -r . /work/system/go
|
|
||||||
cd /work/system/go/src/
|
|
||||||
mkdir -p /var/tmp/
|
|
||||||
./make.bash
|
|
||||||
`,
|
|
||||||
},
|
|
||||||
_bash,
|
|
||||||
)
|
|
||||||
|
|
||||||
case "arm64", "riscv64":
|
|
||||||
bootstrapEnv = append(bootstrapEnv, "GOROOT_BOOTSTRAP=/system")
|
|
||||||
_, bootstrapEarly = t.MustLoad(H("gcc"))
|
|
||||||
finalEnv = append(finalEnv, "CGO_ENABLED=0")
|
|
||||||
|
|
||||||
default:
|
|
||||||
panic("unsupported target " + t.arch)
|
|
||||||
}
|
|
||||||
|
|
||||||
go119 := t.newGo(
|
|
||||||
"1.19",
|
|
||||||
"9_e0aFHsIkVxWVGsp9T2RvvjOc3p4n9o9S8tkNe9Cvgzk_zI2FhRQB7ioQkeAAro",
|
|
||||||
append(bootstrapEnv, "CGO_ENABLED=0"), `
|
|
||||||
rm \
|
rm \
|
||||||
crypto/tls/handshake_client_test.go \
|
crypto/tls/handshake_client_test.go \
|
||||||
cmd/pprof/pprof_test.go \
|
cmd/pprof/pprof_test.go \
|
||||||
@@ -123,12 +99,12 @@ sed -i \
|
|||||||
echo \
|
echo \
|
||||||
'type syscallDescriptor = int' >> \
|
'type syscallDescriptor = int' >> \
|
||||||
os/rawconn_test.go
|
os/rawconn_test.go
|
||||||
`, bootstrapEarly)
|
`, bootstrapExtra...)
|
||||||
|
|
||||||
go121 := t.newGo(
|
go121 := t.newGo(
|
||||||
"1.21.13",
|
"1.21.13",
|
||||||
"YtrDka402BOAEwywx03Vz4QlVwoBiguJHzG7PuythMCPHXS8CVMLvzmvgEbu4Tzu",
|
"YtrDka402BOAEwywx03Vz4QlVwoBiguJHzG7PuythMCPHXS8CVMLvzmvgEbu4Tzu",
|
||||||
[]string{"CGO_ENABLED=0"}, `
|
[]string{"CGO_ENABLED=0"}, `
|
||||||
sed -i \
|
sed -i \
|
||||||
's,/lib/ld-musl-`+t.linuxArch()+`.so.1,/system/bin/linker,' \
|
's,/lib/ld-musl-`+t.linuxArch()+`.so.1,/system/bin/linker,' \
|
||||||
cmd/link/internal/`+t.arch+`/obj.go
|
cmd/link/internal/`+t.arch+`/obj.go
|
||||||
@@ -141,22 +117,22 @@ echo \
|
|||||||
'type syscallDescriptor = int' >> \
|
'type syscallDescriptor = int' >> \
|
||||||
os/rawconn_test.go
|
os/rawconn_test.go
|
||||||
`, go119,
|
`, go119,
|
||||||
)
|
)
|
||||||
|
|
||||||
go123 := t.newGo(
|
go123 := t.newGo(
|
||||||
"1.23.12",
|
"1.23.12",
|
||||||
"wcI32bl1tkqbgcelGtGWPI4RtlEddd-PTd76Eb-k7nXA5LbE9yTNdIL9QSOOxMOs",
|
"wcI32bl1tkqbgcelGtGWPI4RtlEddd-PTd76Eb-k7nXA5LbE9yTNdIL9QSOOxMOs",
|
||||||
[]string{"CGO_ENABLED=0"}, `
|
[]string{"CGO_ENABLED=0"}, `
|
||||||
sed -i \
|
sed -i \
|
||||||
's,/lib/ld-musl-`+t.linuxArch()+`.so.1,/system/bin/linker,' \
|
's,/lib/ld-musl-`+t.linuxArch()+`.so.1,/system/bin/linker,' \
|
||||||
cmd/link/internal/`+t.arch+`/obj.go
|
cmd/link/internal/`+t.arch+`/obj.go
|
||||||
`, go121,
|
`, go121,
|
||||||
)
|
)
|
||||||
|
|
||||||
go125 := t.newGo(
|
go125 := t.newGo(
|
||||||
"1.25.10",
|
"1.25.10",
|
||||||
"TwKwatkpwal-j9U2sDSRPEdM3YesI4Gm88YgGV59wtU-L85K9gA7UPy9SCxn6PMb",
|
"TwKwatkpwal-j9U2sDSRPEdM3YesI4Gm88YgGV59wtU-L85K9gA7UPy9SCxn6PMb",
|
||||||
[]string{"CGO_ENABLED=0"}, `
|
[]string{"CGO_ENABLED=0"}, `
|
||||||
sed -i \
|
sed -i \
|
||||||
's,/lib/ld-musl-`+t.linuxArch()+`.so.1,/system/bin/linker,' \
|
's,/lib/ld-musl-`+t.linuxArch()+`.so.1,/system/bin/linker,' \
|
||||||
cmd/link/internal/`+t.arch+`/obj.go
|
cmd/link/internal/`+t.arch+`/obj.go
|
||||||
@@ -165,12 +141,16 @@ rm \
|
|||||||
os/root_unix_test.go \
|
os/root_unix_test.go \
|
||||||
net/smtp/smtp_test.go
|
net/smtp/smtp_test.go
|
||||||
`, go123,
|
`, go123,
|
||||||
)
|
)
|
||||||
|
|
||||||
return &meta, t.newGo(
|
const (
|
||||||
version,
|
version = "1.26.3"
|
||||||
checksum,
|
checksum = "lEiFocZFnN5fKvZzmwVdqc9pYUjAuhzqZGbuiOqxUP4XdcY8yECisKcqsQ_eNn1N"
|
||||||
finalEnv, `
|
)
|
||||||
|
return t.newGo(
|
||||||
|
version,
|
||||||
|
checksum,
|
||||||
|
finalEnv, `
|
||||||
sed -i \
|
sed -i \
|
||||||
's,/lib/ld-musl-`+t.linuxArch()+`.so.1,/system/bin/linker,' \
|
's,/lib/ld-musl-`+t.linuxArch()+`.so.1,/system/bin/linker,' \
|
||||||
cmd/link/internal/`+t.arch+`/obj.go
|
cmd/link/internal/`+t.arch+`/obj.go
|
||||||
@@ -183,7 +163,16 @@ rm \
|
|||||||
cmd/cgo/internal/testsanitizers/tsan_test.go \
|
cmd/cgo/internal/testsanitizers/tsan_test.go \
|
||||||
cmd/cgo/internal/testsanitizers/cshared_test.go
|
cmd/cgo/internal/testsanitizers/cshared_test.go
|
||||||
`, go125,
|
`, go125,
|
||||||
)
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newGoLatest,
|
||||||
|
|
||||||
|
Name: "go",
|
||||||
|
Description: "the Go programming language toolchain",
|
||||||
|
Website: "https://go.dev/",
|
||||||
|
|
||||||
|
ID: 1227,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
60
internal/rosa/gtk.go
Normal file
60
internal/rosa/gtk.go
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import (
|
||||||
|
"hakurei.app/fhs"
|
||||||
|
"hakurei.app/internal/pkg"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (t Toolchain) newGLib() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "2.88.1"
|
||||||
|
checksum = "Rkszn6W4RHjyspyqfXdVAVawdwDJCuS0Zu0f7qot7tbJhnw2fUDoUUJB40m-1MCX"
|
||||||
|
)
|
||||||
|
return t.NewPackage("glib", version, t.newTagRemote(
|
||||||
|
"https://gitlab.gnome.org/GNOME/glib.git",
|
||||||
|
version, checksum,
|
||||||
|
), &PackageAttr{
|
||||||
|
Paths: []pkg.ExecPath{
|
||||||
|
pkg.Path(fhs.AbsEtc.Append(
|
||||||
|
"machine-id",
|
||||||
|
), false, pkg.NewFile(
|
||||||
|
"glib-machine-id",
|
||||||
|
[]byte("ffffffffffffffffffffffffffffffff\n"),
|
||||||
|
)),
|
||||||
|
pkg.Path(AbsSystem.Append(
|
||||||
|
"var/lib/dbus/machine-id",
|
||||||
|
), false, pkg.NewFile(
|
||||||
|
"glib-machine-id",
|
||||||
|
[]byte("fefefefefefefefefefefefefefefefe\n"),
|
||||||
|
)),
|
||||||
|
},
|
||||||
|
}, &MesonHelper{
|
||||||
|
Setup: []KV{
|
||||||
|
{"Ddefault_library", "both"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
PythonPackaging,
|
||||||
|
Bash,
|
||||||
|
|
||||||
|
PCRE2,
|
||||||
|
Libffi,
|
||||||
|
Zlib,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newGLib,
|
||||||
|
|
||||||
|
Name: "glib",
|
||||||
|
Description: "the GNU library of miscellaneous stuff",
|
||||||
|
Website: "https://developer.gnome.org/glib/",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
PCRE2,
|
||||||
|
Libffi,
|
||||||
|
Zlib,
|
||||||
|
},
|
||||||
|
|
||||||
|
ID: 10024,
|
||||||
|
})
|
||||||
|
}
|
||||||
113
internal/rosa/hakurei.go
Normal file
113
internal/rosa/hakurei.go
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newHakurei(
|
||||||
|
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 t.New("hakurei"+suffix+"-"+hakureiVersion, 0, t.Append(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, t.NewPatchedSource(
|
||||||
|
"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) (pkg.Artifact, string) {
|
||||||
|
return t.newHakurei("", `
|
||||||
|
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) (pkg.Artifact, string) {
|
||||||
|
name := "all"
|
||||||
|
if t.opts&OptSkipCheck != 0 {
|
||||||
|
name = "make"
|
||||||
|
}
|
||||||
|
return t.newHakurei("-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/",
|
||||||
|
})
|
||||||
|
}
|
||||||
26
internal/rosa/hakurei_current.go
Normal file
26
internal/rosa/hakurei_current.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
//go:build current
|
||||||
|
|
||||||
|
package rosa
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "embed"
|
||||||
|
|
||||||
|
"hakurei.app/internal/pkg"
|
||||||
|
)
|
||||||
|
|
||||||
|
const hakureiVersion = "1.0-current"
|
||||||
|
|
||||||
|
// hakureiSourceTarball is a compressed tarball of the hakurei source code.
|
||||||
|
//
|
||||||
|
//go:generate tar -zc -C ../.. --exclude .git --exclude *.tar.gz -f hakurei_current.tar.gz .
|
||||||
|
//go:embed hakurei_current.tar.gz
|
||||||
|
var hakureiSourceTarball []byte
|
||||||
|
|
||||||
|
// hakureiSource is the source code at the time this package is compiled.
|
||||||
|
var hakureiSource = pkg.NewTar(pkg.NewFile(
|
||||||
|
"hakurei-current.tar.gz",
|
||||||
|
hakureiSourceTarball,
|
||||||
|
), pkg.TarGzip)
|
||||||
|
|
||||||
|
// hakureiPatches are patches applied against the compile-time source tree.
|
||||||
|
var hakureiPatches []KV
|
||||||
18
internal/rosa/hakurei_release.go
Normal file
18
internal/rosa/hakurei_release.go
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
//go:build !current
|
||||||
|
|
||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
const hakureiVersion = "0.4.2"
|
||||||
|
|
||||||
|
// hakureiSource is the source code of a hakurei release.
|
||||||
|
var hakureiSource = newTar(
|
||||||
|
"https://git.gensokyo.uk/rosa/hakurei/archive/"+
|
||||||
|
"v"+hakureiVersion+".tar.gz",
|
||||||
|
"jadgaOrxv5ABGvzQ_Rk0aPGz7U8K-427TbMhQNQ32scSizEnlR44Pu7NoWYWVZWq",
|
||||||
|
pkg.TarGzip,
|
||||||
|
)
|
||||||
|
|
||||||
|
// hakureiPatches are patches applied against a hakurei release.
|
||||||
|
var hakureiPatches []KV
|
||||||
34
internal/rosa/hwdata.go
Normal file
34
internal/rosa/hwdata.go
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newHwdata() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "0.407"
|
||||||
|
checksum = "6p1XD0CRuzt6hLfjv4ShKBW934BexmoPkRrmwxD4J63fBVCzVBRHyF8pVJdW_Xjm"
|
||||||
|
)
|
||||||
|
return t.NewPackage("hwdata", version, newFromGitHub(
|
||||||
|
"vcrhonek/hwdata",
|
||||||
|
"v"+version, checksum,
|
||||||
|
), &PackageAttr{
|
||||||
|
Writable: true,
|
||||||
|
EnterSource: true,
|
||||||
|
}, &MakeHelper{
|
||||||
|
// awk: fatal: cannot open file `hwdata.spec' for reading: No such file or directory
|
||||||
|
InPlace: true,
|
||||||
|
|
||||||
|
// lspci: Unknown option 'A' (see "lspci --help")
|
||||||
|
SkipCheck: true,
|
||||||
|
}), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newHwdata,
|
||||||
|
|
||||||
|
Name: "hwdata",
|
||||||
|
Description: "contains various hardware identification and configuration data",
|
||||||
|
Website: "https://github.com/vcrhonek/hwdata",
|
||||||
|
|
||||||
|
ID: 5387,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -6,46 +6,68 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
meta := Metadata{
|
native.MustRegister(&Artifact{
|
||||||
Name: "system-image",
|
Name: "earlyinit",
|
||||||
Description: "Rosa OS system image",
|
Description: "Rosa OS initramfs init program",
|
||||||
Version: Unversioned,
|
|
||||||
}
|
|
||||||
native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) {
|
|
||||||
return &meta, t.New("system.img", TNoToolchain, t.Append(nil,
|
|
||||||
H("squashfs-tools"),
|
|
||||||
), nil, nil, `
|
|
||||||
mksquashfs /mnt/system /work/system.img
|
|
||||||
`, pkg.Path(fhs.AbsRoot.Append("mnt"), false, t.Append(nil,
|
|
||||||
_musl,
|
|
||||||
_mksh,
|
|
||||||
_toybox,
|
|
||||||
|
|
||||||
H("kmod"),
|
f: func(t Toolchain) (pkg.Artifact, string) {
|
||||||
H("kernel"),
|
return t.newHakurei("-early-init", `
|
||||||
H("firmware"),
|
mkdir -p /work/system/libexec/hakurei/
|
||||||
)...))
|
|
||||||
|
echo '# Building earlyinit.'
|
||||||
|
go build -trimpath -v -o /work/system/libexec/hakurei -ldflags="-s -w
|
||||||
|
-buildid=
|
||||||
|
-linkmode external
|
||||||
|
-extldflags=-static
|
||||||
|
-X hakurei.app/internal/info.buildVersion=${HAKUREI_VERSION}
|
||||||
|
" ./cmd/earlyinit
|
||||||
|
echo
|
||||||
|
`, false), Unversioned
|
||||||
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
func (t Toolchain) newImageSystem() (pkg.Artifact, string) {
|
||||||
|
return t.New("system.img", TNoToolchain, t.Append(nil,
|
||||||
|
SquashfsTools,
|
||||||
|
), nil, nil, `
|
||||||
|
mksquashfs /mnt/system /work/system.img
|
||||||
|
`, pkg.Path(fhs.AbsRoot.Append("mnt"), false, t.Append(nil,
|
||||||
|
Musl,
|
||||||
|
Mksh,
|
||||||
|
Toybox,
|
||||||
|
|
||||||
|
Kmod,
|
||||||
|
Kernel,
|
||||||
|
Firmware,
|
||||||
|
)...)), Unversioned
|
||||||
|
}
|
||||||
func init() {
|
func init() {
|
||||||
meta := Metadata{
|
native.MustRegister(&Artifact{
|
||||||
Name: "initramfs-image",
|
Name: "system-image",
|
||||||
Description: "Rosa OS initramfs image",
|
Description: "Rosa OS system image",
|
||||||
Version: Unversioned,
|
|
||||||
}
|
f: Toolchain.newImageSystem,
|
||||||
native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) {
|
})
|
||||||
return &meta, t.New("initramfs", TNoToolchain, t.Append(nil,
|
}
|
||||||
_zstd,
|
func (t Toolchain) newImageInitramfs() (pkg.Artifact, string) {
|
||||||
H("earlyinit"),
|
return t.New("initramfs", TNoToolchain, t.Append(nil,
|
||||||
H("gen_init_cpio"),
|
Zstd,
|
||||||
), nil, nil, `
|
EarlyInit,
|
||||||
|
GenInitCPIO,
|
||||||
|
), nil, nil, `
|
||||||
gen_init_cpio -t 4294967295 -c /usr/src/initramfs | zstd > /work/initramfs.zst
|
gen_init_cpio -t 4294967295 -c /usr/src/initramfs | zstd > /work/initramfs.zst
|
||||||
`, pkg.Path(AbsUsrSrc.Append("initramfs"), false, pkg.NewFile("initramfs", []byte(`
|
`, pkg.Path(AbsUsrSrc.Append("initramfs"), false, pkg.NewFile("initramfs", []byte(`
|
||||||
dir /dev 0755 0 0
|
dir /dev 0755 0 0
|
||||||
nod /dev/null 0666 0 0 c 1 3
|
nod /dev/null 0666 0 0 c 1 3
|
||||||
nod /dev/console 0600 0 0 c 5 1
|
nod /dev/console 0600 0 0 c 5 1
|
||||||
file /init /system/libexec/hakurei/earlyinit 0555 0 0
|
file /init /system/libexec/hakurei/earlyinit 0555 0 0
|
||||||
`))))
|
`)))), Unversioned
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
Name: "initramfs-image",
|
||||||
|
Description: "Rosa OS initramfs image",
|
||||||
|
|
||||||
|
f: Toolchain.newImageInitramfs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,118 @@
|
|||||||
From f54a91f5337cd918eb86cf600320d25b6cfd8209 Mon Sep 17 00:00:00 2001
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
const kernelVersion = "6.12.87"
|
||||||
|
|
||||||
|
var kernelSource = newTar(
|
||||||
|
"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/"+
|
||||||
|
"snapshot/linux-"+kernelVersion+".tar.gz",
|
||||||
|
"QTl5teIy0K5KsOLYGHQ3FbnPCZNRH2bySXVzghiOoHDdM3zAcSPUkmdly85lMzHx",
|
||||||
|
pkg.TarGzip,
|
||||||
|
)
|
||||||
|
|
||||||
|
func (t Toolchain) newKernelSource() (pkg.Artifact, string) {
|
||||||
|
return t.New("kernel-"+kernelVersion+"-src", 0, nil, nil, nil, `
|
||||||
|
mkdir -p /work/usr/src/
|
||||||
|
cp -r /usr/src/linux /work/usr/src/
|
||||||
|
chmod -R +w /work/usr/src/linux/
|
||||||
|
`, pkg.Path(AbsUsrSrc.Append("linux"), false, kernelSource)), kernelVersion
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newKernelSource,
|
||||||
|
|
||||||
|
Name: "kernel-source",
|
||||||
|
Description: "a writable kernel source tree installed to /usr/src/linux",
|
||||||
|
Website: "https://kernel.org/",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t Toolchain) newKernelHeaders() (pkg.Artifact, string) {
|
||||||
|
checksum := perArch[string]{
|
||||||
|
"amd64": "lCmBNcMeUmXifg0vecKOPy3GAaFcJSmOPnf3wit9xYTDSTsFADPt1xxUFfmTn1fD",
|
||||||
|
"arm64": "PlRxp4JzZeMGx7CScRlT1NBzc2NVyJlb8Gm8sa3ofFght9ZT101ZJhcIXiCkHSHM",
|
||||||
|
}
|
||||||
|
return t.NewPackage("kernel-headers", kernelVersion, kernelSource, &PackageAttr{
|
||||||
|
Flag: TEarly,
|
||||||
|
KnownChecksum: new(mustDecode(checksum.unwrap(t.S))),
|
||||||
|
|
||||||
|
Paths: []pkg.ExecPath{
|
||||||
|
// updated manually for API changes
|
||||||
|
pkg.Path(AbsUsrSrc.Append("version.h"), false, pkg.NewFile(
|
||||||
|
"version.h", []byte(`#define LINUX_VERSION_CODE 396372
|
||||||
|
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))
|
||||||
|
#define LINUX_VERSION_MAJOR 6
|
||||||
|
#define LINUX_VERSION_PATCHLEVEL 12
|
||||||
|
#define LINUX_VERSION_SUBLEVEL 84
|
||||||
|
`),
|
||||||
|
)),
|
||||||
|
},
|
||||||
|
}, &MakeHelper{
|
||||||
|
SkipConfigure: true,
|
||||||
|
|
||||||
|
SkipCheck: true,
|
||||||
|
Make: []string{
|
||||||
|
"-f /usr/src/kernel-headers/Makefile",
|
||||||
|
"O=/tmp/kbuild",
|
||||||
|
"LLVM=1",
|
||||||
|
`HOSTLDFLAGS="${LDFLAGS:-''}"`,
|
||||||
|
"INSTALL_HDR_PATH=/work/system",
|
||||||
|
"headers_install",
|
||||||
|
},
|
||||||
|
Install: `
|
||||||
|
cat \
|
||||||
|
/usr/src/version.h > \
|
||||||
|
/work/system/include/linux/version.h
|
||||||
|
`,
|
||||||
|
},
|
||||||
|
Rsync,
|
||||||
|
), kernelVersion
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newKernelHeaders,
|
||||||
|
|
||||||
|
Name: "kernel-headers",
|
||||||
|
Description: "an installation of kernel headers",
|
||||||
|
Website: "https://kernel.org/",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t Toolchain) newKernel() (pkg.Artifact, string) {
|
||||||
|
return t.NewPackage("kernel", kernelVersion, kernelSource, &PackageAttr{
|
||||||
|
Env: []string{
|
||||||
|
"PATH=/system/sbin",
|
||||||
|
},
|
||||||
|
ScriptEarly: `
|
||||||
|
install -Dm0400 \
|
||||||
|
/usr/src/.config \
|
||||||
|
/tmp/kbuild/.config
|
||||||
|
install -Dm0500 \
|
||||||
|
/usr/src/.installkernel \
|
||||||
|
/sbin/installkernel
|
||||||
|
`,
|
||||||
|
|
||||||
|
Paths: []pkg.ExecPath{
|
||||||
|
pkg.Path(AbsUsrSrc.Append(
|
||||||
|
".config",
|
||||||
|
), false, pkg.NewFile(".config", kernelConfig)),
|
||||||
|
pkg.Path(AbsUsrSrc.Append(
|
||||||
|
".installkernel",
|
||||||
|
), false, pkg.NewFile("installkernel", []byte(`#!/bin/sh -e
|
||||||
|
echo "Installing linux $1..."
|
||||||
|
cp -av "$2" "$4"
|
||||||
|
cp -av "$3" "$4"
|
||||||
|
`))),
|
||||||
|
pkg.Path(AbsUsrSrc.Append(
|
||||||
|
".depmod",
|
||||||
|
), false, pkg.NewFile("depmod", []byte(`#!/bin/sh
|
||||||
|
exec /system/sbin/depmod -m /lib/modules "$@"
|
||||||
|
`))),
|
||||||
|
},
|
||||||
|
|
||||||
|
Patches: []KV{
|
||||||
|
{"f54a91f5337cd918eb86cf600320d25b6cfd8209", `From f54a91f5337cd918eb86cf600320d25b6cfd8209 Mon Sep 17 00:00:00 2001
|
||||||
From: Nathan Chancellor <nathan@kernel.org>
|
From: Nathan Chancellor <nathan@kernel.org>
|
||||||
Date: Sat, 13 Dec 2025 19:58:10 +0900
|
Date: Sat, 13 Dec 2025 19:58:10 +0900
|
||||||
Subject: drm/amd/display: Reduce number of arguments of dcn30's
|
Subject: drm/amd/display: Reduce number of arguments of dcn30's
|
||||||
@@ -604,3 +718,635 @@ index abe51cf3aab2..a244504cc1f2 100644
|
|||||||
for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
|
for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
|
||||||
--
|
--
|
||||||
cgit 1.2.3-korg
|
cgit 1.2.3-korg
|
||||||
|
`},
|
||||||
|
|
||||||
|
{"6ce6fbfddc5b127e4f57c3b5bfdcf40239a4fc2f", `From 6ce6fbfddc5b127e4f57c3b5bfdcf40239a4fc2f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Nathan Chancellor <nathan@kernel.org>
|
||||||
|
Date: Sat, 13 Dec 2025 19:58:11 +0900
|
||||||
|
Subject: drm/amd/display: Reduce number of arguments of dcn30's
|
||||||
|
CalculateWatermarksAndDRAMSpeedChangeSupport()
|
||||||
|
|
||||||
|
CalculateWatermarksAndDRAMSpeedChangeSupport() has a large number of
|
||||||
|
parameters, which must be passed on the stack. Most of the parameters
|
||||||
|
between the two callsites are the same, so they can be accessed through
|
||||||
|
the existing mode_lib pointer, instead of being passed as explicit
|
||||||
|
arguments. Doing this reduces the stack size of
|
||||||
|
dml30_ModeSupportAndSystemConfigurationFull() from 1912 bytes to 1840
|
||||||
|
bytes building for x86_64 with clang-22, helping stay under the 2048
|
||||||
|
byte limit for display_mode_vba_30.c.
|
||||||
|
|
||||||
|
Additionally, now that there is a pointer to mode_lib->vba available,
|
||||||
|
use 'v' consistently throughout the entire function.
|
||||||
|
|
||||||
|
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
|
||||||
|
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
|
||||||
|
(cherry picked from commit 563dfbefdf633c8d958398ddfa3955f9f40e47d9)
|
||||||
|
---
|
||||||
|
.../amd/display/dc/dml/dcn30/display_mode_vba_30.c | 287 +++++----------------
|
||||||
|
1 file changed, 66 insertions(+), 221 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
|
||||||
|
index 2d19bb8de59c84..1df3412be3465d 100644
|
||||||
|
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
|
||||||
|
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
|
||||||
|
@@ -265,62 +265,23 @@ static void CalculateDynamicMetadataParameters(
|
||||||
|
static void CalculateWatermarksAndDRAMSpeedChangeSupport(
|
||||||
|
struct display_mode_lib *mode_lib,
|
||||||
|
unsigned int PrefetchMode,
|
||||||
|
- unsigned int NumberOfActivePlanes,
|
||||||
|
- unsigned int MaxLineBufferLines,
|
||||||
|
- unsigned int LineBufferSize,
|
||||||
|
- unsigned int DPPOutputBufferPixels,
|
||||||
|
- unsigned int DETBufferSizeInKByte,
|
||||||
|
- unsigned int WritebackInterfaceBufferSize,
|
||||||
|
double DCFCLK,
|
||||||
|
double ReturnBW,
|
||||||
|
- bool GPUVMEnable,
|
||||||
|
- unsigned int dpte_group_bytes[],
|
||||||
|
- unsigned int MetaChunkSize,
|
||||||
|
double UrgentLatency,
|
||||||
|
double ExtraLatency,
|
||||||
|
- double WritebackLatency,
|
||||||
|
- double WritebackChunkSize,
|
||||||
|
double SOCCLK,
|
||||||
|
- double DRAMClockChangeLatency,
|
||||||
|
- double SRExitTime,
|
||||||
|
- double SREnterPlusExitTime,
|
||||||
|
double DCFCLKDeepSleep,
|
||||||
|
unsigned int DPPPerPlane[],
|
||||||
|
- bool DCCEnable[],
|
||||||
|
double DPPCLK[],
|
||||||
|
unsigned int DETBufferSizeY[],
|
||||||
|
unsigned int DETBufferSizeC[],
|
||||||
|
unsigned int SwathHeightY[],
|
||||||
|
unsigned int SwathHeightC[],
|
||||||
|
- unsigned int LBBitPerPixel[],
|
||||||
|
double SwathWidthY[],
|
||||||
|
double SwathWidthC[],
|
||||||
|
- double HRatio[],
|
||||||
|
- double HRatioChroma[],
|
||||||
|
- unsigned int vtaps[],
|
||||||
|
- unsigned int VTAPsChroma[],
|
||||||
|
- double VRatio[],
|
||||||
|
- double VRatioChroma[],
|
||||||
|
- unsigned int HTotal[],
|
||||||
|
- double PixelClock[],
|
||||||
|
- unsigned int BlendingAndTiming[],
|
||||||
|
double BytePerPixelDETY[],
|
||||||
|
double BytePerPixelDETC[],
|
||||||
|
- double DSTXAfterScaler[],
|
||||||
|
- double DSTYAfterScaler[],
|
||||||
|
- bool WritebackEnable[],
|
||||||
|
- enum source_format_class WritebackPixelFormat[],
|
||||||
|
- double WritebackDestinationWidth[],
|
||||||
|
- double WritebackDestinationHeight[],
|
||||||
|
- double WritebackSourceHeight[],
|
||||||
|
- enum clock_change_support *DRAMClockChangeSupport,
|
||||||
|
- double *UrgentWatermark,
|
||||||
|
- double *WritebackUrgentWatermark,
|
||||||
|
- double *DRAMClockChangeWatermark,
|
||||||
|
- double *WritebackDRAMClockChangeWatermark,
|
||||||
|
- double *StutterExitWatermark,
|
||||||
|
- double *StutterEnterPlusExitWatermark,
|
||||||
|
- double *MinActiveDRAMClockChangeLatencySupported);
|
||||||
|
+ enum clock_change_support *DRAMClockChangeSupport);
|
||||||
|
static void CalculateDCFCLKDeepSleep(
|
||||||
|
struct display_mode_lib *mode_lib,
|
||||||
|
unsigned int NumberOfActivePlanes,
|
||||||
|
@@ -2646,62 +2607,23 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
|
||||||
|
CalculateWatermarksAndDRAMSpeedChangeSupport(
|
||||||
|
mode_lib,
|
||||||
|
PrefetchMode,
|
||||||
|
- v->NumberOfActivePlanes,
|
||||||
|
- v->MaxLineBufferLines,
|
||||||
|
- v->LineBufferSize,
|
||||||
|
- v->DPPOutputBufferPixels,
|
||||||
|
- v->DETBufferSizeInKByte[0],
|
||||||
|
- v->WritebackInterfaceBufferSize,
|
||||||
|
v->DCFCLK,
|
||||||
|
v->ReturnBW,
|
||||||
|
- v->GPUVMEnable,
|
||||||
|
- v->dpte_group_bytes,
|
||||||
|
- v->MetaChunkSize,
|
||||||
|
v->UrgentLatency,
|
||||||
|
v->UrgentExtraLatency,
|
||||||
|
- v->WritebackLatency,
|
||||||
|
- v->WritebackChunkSize,
|
||||||
|
v->SOCCLK,
|
||||||
|
- v->FinalDRAMClockChangeLatency,
|
||||||
|
- v->SRExitTime,
|
||||||
|
- v->SREnterPlusExitTime,
|
||||||
|
v->DCFCLKDeepSleep,
|
||||||
|
v->DPPPerPlane,
|
||||||
|
- v->DCCEnable,
|
||||||
|
v->DPPCLK,
|
||||||
|
v->DETBufferSizeY,
|
||||||
|
v->DETBufferSizeC,
|
||||||
|
v->SwathHeightY,
|
||||||
|
v->SwathHeightC,
|
||||||
|
- v->LBBitPerPixel,
|
||||||
|
v->SwathWidthY,
|
||||||
|
v->SwathWidthC,
|
||||||
|
- v->HRatio,
|
||||||
|
- v->HRatioChroma,
|
||||||
|
- v->vtaps,
|
||||||
|
- v->VTAPsChroma,
|
||||||
|
- v->VRatio,
|
||||||
|
- v->VRatioChroma,
|
||||||
|
- v->HTotal,
|
||||||
|
- v->PixelClock,
|
||||||
|
- v->BlendingAndTiming,
|
||||||
|
v->BytePerPixelDETY,
|
||||||
|
v->BytePerPixelDETC,
|
||||||
|
- v->DSTXAfterScaler,
|
||||||
|
- v->DSTYAfterScaler,
|
||||||
|
- v->WritebackEnable,
|
||||||
|
- v->WritebackPixelFormat,
|
||||||
|
- v->WritebackDestinationWidth,
|
||||||
|
- v->WritebackDestinationHeight,
|
||||||
|
- v->WritebackSourceHeight,
|
||||||
|
- &DRAMClockChangeSupport,
|
||||||
|
- &v->UrgentWatermark,
|
||||||
|
- &v->WritebackUrgentWatermark,
|
||||||
|
- &v->DRAMClockChangeWatermark,
|
||||||
|
- &v->WritebackDRAMClockChangeWatermark,
|
||||||
|
- &v->StutterExitWatermark,
|
||||||
|
- &v->StutterEnterPlusExitWatermark,
|
||||||
|
- &v->MinActiveDRAMClockChangeLatencySupported);
|
||||||
|
+ &DRAMClockChangeSupport);
|
||||||
|
|
||||||
|
for (k = 0; k < v->NumberOfActivePlanes; ++k) {
|
||||||
|
if (v->WritebackEnable[k] == true) {
|
||||||
|
@@ -4895,62 +4817,23 @@ void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
|
||||||
|
CalculateWatermarksAndDRAMSpeedChangeSupport(
|
||||||
|
mode_lib,
|
||||||
|
v->PrefetchModePerState[i][j],
|
||||||
|
- v->NumberOfActivePlanes,
|
||||||
|
- v->MaxLineBufferLines,
|
||||||
|
- v->LineBufferSize,
|
||||||
|
- v->DPPOutputBufferPixels,
|
||||||
|
- v->DETBufferSizeInKByte[0],
|
||||||
|
- v->WritebackInterfaceBufferSize,
|
||||||
|
v->DCFCLKState[i][j],
|
||||||
|
v->ReturnBWPerState[i][j],
|
||||||
|
- v->GPUVMEnable,
|
||||||
|
- v->dpte_group_bytes,
|
||||||
|
- v->MetaChunkSize,
|
||||||
|
v->UrgLatency[i],
|
||||||
|
v->ExtraLatency,
|
||||||
|
- v->WritebackLatency,
|
||||||
|
- v->WritebackChunkSize,
|
||||||
|
v->SOCCLKPerState[i],
|
||||||
|
- v->FinalDRAMClockChangeLatency,
|
||||||
|
- v->SRExitTime,
|
||||||
|
- v->SREnterPlusExitTime,
|
||||||
|
v->ProjectedDCFCLKDeepSleep[i][j],
|
||||||
|
v->NoOfDPPThisState,
|
||||||
|
- v->DCCEnable,
|
||||||
|
v->RequiredDPPCLKThisState,
|
||||||
|
v->DETBufferSizeYThisState,
|
||||||
|
v->DETBufferSizeCThisState,
|
||||||
|
v->SwathHeightYThisState,
|
||||||
|
v->SwathHeightCThisState,
|
||||||
|
- v->LBBitPerPixel,
|
||||||
|
v->SwathWidthYThisState,
|
||||||
|
v->SwathWidthCThisState,
|
||||||
|
- v->HRatio,
|
||||||
|
- v->HRatioChroma,
|
||||||
|
- v->vtaps,
|
||||||
|
- v->VTAPsChroma,
|
||||||
|
- v->VRatio,
|
||||||
|
- v->VRatioChroma,
|
||||||
|
- v->HTotal,
|
||||||
|
- v->PixelClock,
|
||||||
|
- v->BlendingAndTiming,
|
||||||
|
v->BytePerPixelInDETY,
|
||||||
|
v->BytePerPixelInDETC,
|
||||||
|
- v->DSTXAfterScaler,
|
||||||
|
- v->DSTYAfterScaler,
|
||||||
|
- v->WritebackEnable,
|
||||||
|
- v->WritebackPixelFormat,
|
||||||
|
- v->WritebackDestinationWidth,
|
||||||
|
- v->WritebackDestinationHeight,
|
||||||
|
- v->WritebackSourceHeight,
|
||||||
|
- &v->DRAMClockChangeSupport[i][j],
|
||||||
|
- &v->UrgentWatermark,
|
||||||
|
- &v->WritebackUrgentWatermark,
|
||||||
|
- &v->DRAMClockChangeWatermark,
|
||||||
|
- &v->WritebackDRAMClockChangeWatermark,
|
||||||
|
- &v->StutterExitWatermark,
|
||||||
|
- &v->StutterEnterPlusExitWatermark,
|
||||||
|
- &v->MinActiveDRAMClockChangeLatencySupported);
|
||||||
|
+ &v->DRAMClockChangeSupport[i][j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -5067,63 +4950,25 @@ void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
|
||||||
|
static void CalculateWatermarksAndDRAMSpeedChangeSupport(
|
||||||
|
struct display_mode_lib *mode_lib,
|
||||||
|
unsigned int PrefetchMode,
|
||||||
|
- unsigned int NumberOfActivePlanes,
|
||||||
|
- unsigned int MaxLineBufferLines,
|
||||||
|
- unsigned int LineBufferSize,
|
||||||
|
- unsigned int DPPOutputBufferPixels,
|
||||||
|
- unsigned int DETBufferSizeInKByte,
|
||||||
|
- unsigned int WritebackInterfaceBufferSize,
|
||||||
|
double DCFCLK,
|
||||||
|
double ReturnBW,
|
||||||
|
- bool GPUVMEnable,
|
||||||
|
- unsigned int dpte_group_bytes[],
|
||||||
|
- unsigned int MetaChunkSize,
|
||||||
|
double UrgentLatency,
|
||||||
|
double ExtraLatency,
|
||||||
|
- double WritebackLatency,
|
||||||
|
- double WritebackChunkSize,
|
||||||
|
double SOCCLK,
|
||||||
|
- double DRAMClockChangeLatency,
|
||||||
|
- double SRExitTime,
|
||||||
|
- double SREnterPlusExitTime,
|
||||||
|
double DCFCLKDeepSleep,
|
||||||
|
unsigned int DPPPerPlane[],
|
||||||
|
- bool DCCEnable[],
|
||||||
|
double DPPCLK[],
|
||||||
|
unsigned int DETBufferSizeY[],
|
||||||
|
unsigned int DETBufferSizeC[],
|
||||||
|
unsigned int SwathHeightY[],
|
||||||
|
unsigned int SwathHeightC[],
|
||||||
|
- unsigned int LBBitPerPixel[],
|
||||||
|
double SwathWidthY[],
|
||||||
|
double SwathWidthC[],
|
||||||
|
- double HRatio[],
|
||||||
|
- double HRatioChroma[],
|
||||||
|
- unsigned int vtaps[],
|
||||||
|
- unsigned int VTAPsChroma[],
|
||||||
|
- double VRatio[],
|
||||||
|
- double VRatioChroma[],
|
||||||
|
- unsigned int HTotal[],
|
||||||
|
- double PixelClock[],
|
||||||
|
- unsigned int BlendingAndTiming[],
|
||||||
|
double BytePerPixelDETY[],
|
||||||
|
double BytePerPixelDETC[],
|
||||||
|
- double DSTXAfterScaler[],
|
||||||
|
- double DSTYAfterScaler[],
|
||||||
|
- bool WritebackEnable[],
|
||||||
|
- enum source_format_class WritebackPixelFormat[],
|
||||||
|
- double WritebackDestinationWidth[],
|
||||||
|
- double WritebackDestinationHeight[],
|
||||||
|
- double WritebackSourceHeight[],
|
||||||
|
- enum clock_change_support *DRAMClockChangeSupport,
|
||||||
|
- double *UrgentWatermark,
|
||||||
|
- double *WritebackUrgentWatermark,
|
||||||
|
- double *DRAMClockChangeWatermark,
|
||||||
|
- double *WritebackDRAMClockChangeWatermark,
|
||||||
|
- double *StutterExitWatermark,
|
||||||
|
- double *StutterEnterPlusExitWatermark,
|
||||||
|
- double *MinActiveDRAMClockChangeLatencySupported)
|
||||||
|
+ enum clock_change_support *DRAMClockChangeSupport)
|
||||||
|
{
|
||||||
|
+ struct vba_vars_st *v = &mode_lib->vba;
|
||||||
|
double EffectiveLBLatencyHidingY = 0;
|
||||||
|
double EffectiveLBLatencyHidingC = 0;
|
||||||
|
double LinesInDETY[DC__NUM_DPP__MAX] = { 0 };
|
||||||
|
@@ -5142,101 +4987,101 @@ static void CalculateWatermarksAndDRAMSpeedChangeSupport(
|
||||||
|
double WritebackDRAMClockChangeLatencyHiding = 0;
|
||||||
|
unsigned int k, j;
|
||||||
|
|
||||||
|
- mode_lib->vba.TotalActiveDPP = 0;
|
||||||
|
- mode_lib->vba.TotalDCCActiveDPP = 0;
|
||||||
|
- for (k = 0; k < NumberOfActivePlanes; ++k) {
|
||||||
|
- mode_lib->vba.TotalActiveDPP = mode_lib->vba.TotalActiveDPP + DPPPerPlane[k];
|
||||||
|
- if (DCCEnable[k] == true) {
|
||||||
|
- mode_lib->vba.TotalDCCActiveDPP = mode_lib->vba.TotalDCCActiveDPP + DPPPerPlane[k];
|
||||||
|
+ v->TotalActiveDPP = 0;
|
||||||
|
+ v->TotalDCCActiveDPP = 0;
|
||||||
|
+ for (k = 0; k < v->NumberOfActivePlanes; ++k) {
|
||||||
|
+ v->TotalActiveDPP = v->TotalActiveDPP + DPPPerPlane[k];
|
||||||
|
+ if (v->DCCEnable[k] == true) {
|
||||||
|
+ v->TotalDCCActiveDPP = v->TotalDCCActiveDPP + DPPPerPlane[k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- *UrgentWatermark = UrgentLatency + ExtraLatency;
|
||||||
|
+ v->UrgentWatermark = UrgentLatency + ExtraLatency;
|
||||||
|
|
||||||
|
- *DRAMClockChangeWatermark = DRAMClockChangeLatency + *UrgentWatermark;
|
||||||
|
+ v->DRAMClockChangeWatermark = v->FinalDRAMClockChangeLatency + v->UrgentWatermark;
|
||||||
|
|
||||||
|
- mode_lib->vba.TotalActiveWriteback = 0;
|
||||||
|
- for (k = 0; k < NumberOfActivePlanes; ++k) {
|
||||||
|
- if (WritebackEnable[k] == true) {
|
||||||
|
- mode_lib->vba.TotalActiveWriteback = mode_lib->vba.TotalActiveWriteback + 1;
|
||||||
|
+ v->TotalActiveWriteback = 0;
|
||||||
|
+ for (k = 0; k < v->NumberOfActivePlanes; ++k) {
|
||||||
|
+ if (v->WritebackEnable[k] == true) {
|
||||||
|
+ v->TotalActiveWriteback = v->TotalActiveWriteback + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (mode_lib->vba.TotalActiveWriteback <= 1) {
|
||||||
|
- *WritebackUrgentWatermark = WritebackLatency;
|
||||||
|
+ if (v->TotalActiveWriteback <= 1) {
|
||||||
|
+ v->WritebackUrgentWatermark = v->WritebackLatency;
|
||||||
|
} else {
|
||||||
|
- *WritebackUrgentWatermark = WritebackLatency + WritebackChunkSize * 1024.0 / 32.0 / SOCCLK;
|
||||||
|
+ v->WritebackUrgentWatermark = v->WritebackLatency + v->WritebackChunkSize * 1024.0 / 32.0 / SOCCLK;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (mode_lib->vba.TotalActiveWriteback <= 1) {
|
||||||
|
- *WritebackDRAMClockChangeWatermark = DRAMClockChangeLatency + WritebackLatency;
|
||||||
|
+ if (v->TotalActiveWriteback <= 1) {
|
||||||
|
+ v->WritebackDRAMClockChangeWatermark = v->FinalDRAMClockChangeLatency + v->WritebackLatency;
|
||||||
|
} else {
|
||||||
|
- *WritebackDRAMClockChangeWatermark = DRAMClockChangeLatency + WritebackLatency + WritebackChunkSize * 1024.0 / 32.0 / SOCCLK;
|
||||||
|
+ v->WritebackDRAMClockChangeWatermark = v->FinalDRAMClockChangeLatency + v->WritebackLatency + v->WritebackChunkSize * 1024.0 / 32.0 / SOCCLK;
|
||||||
|
}
|
||||||
|
|
||||||
|
- for (k = 0; k < NumberOfActivePlanes; ++k) {
|
||||||
|
+ for (k = 0; k < v->NumberOfActivePlanes; ++k) {
|
||||||
|
|
||||||
|
- mode_lib->vba.LBLatencyHidingSourceLinesY = dml_min((double) MaxLineBufferLines, dml_floor(LineBufferSize / LBBitPerPixel[k] / (SwathWidthY[k] / dml_max(HRatio[k], 1.0)), 1)) - (vtaps[k] - 1);
|
||||||
|
+ v->LBLatencyHidingSourceLinesY = dml_min((double) v->MaxLineBufferLines, dml_floor(v->LineBufferSize / v->LBBitPerPixel[k] / (SwathWidthY[k] / dml_max(v->HRatio[k], 1.0)), 1)) - (v->vtaps[k] - 1);
|
||||||
|
|
||||||
|
- mode_lib->vba.LBLatencyHidingSourceLinesC = dml_min((double) MaxLineBufferLines, dml_floor(LineBufferSize / LBBitPerPixel[k] / (SwathWidthC[k] / dml_max(HRatioChroma[k], 1.0)), 1)) - (VTAPsChroma[k] - 1);
|
||||||
|
+ v->LBLatencyHidingSourceLinesC = dml_min((double) v->MaxLineBufferLines, dml_floor(v->LineBufferSize / v->LBBitPerPixel[k] / (SwathWidthC[k] / dml_max(v->HRatioChroma[k], 1.0)), 1)) - (v->VTAPsChroma[k] - 1);
|
||||||
|
|
||||||
|
- EffectiveLBLatencyHidingY = mode_lib->vba.LBLatencyHidingSourceLinesY / VRatio[k] * (HTotal[k] / PixelClock[k]);
|
||||||
|
+ EffectiveLBLatencyHidingY = v->LBLatencyHidingSourceLinesY / v->VRatio[k] * (v->HTotal[k] / v->PixelClock[k]);
|
||||||
|
|
||||||
|
- EffectiveLBLatencyHidingC = mode_lib->vba.LBLatencyHidingSourceLinesC / VRatioChroma[k] * (HTotal[k] / PixelClock[k]);
|
||||||
|
+ EffectiveLBLatencyHidingC = v->LBLatencyHidingSourceLinesC / v->VRatioChroma[k] * (v->HTotal[k] / v->PixelClock[k]);
|
||||||
|
|
||||||
|
LinesInDETY[k] = (double) DETBufferSizeY[k] / BytePerPixelDETY[k] / SwathWidthY[k];
|
||||||
|
LinesInDETYRoundedDownToSwath[k] = dml_floor(LinesInDETY[k], SwathHeightY[k]);
|
||||||
|
- FullDETBufferingTimeY[k] = LinesInDETYRoundedDownToSwath[k] * (HTotal[k] / PixelClock[k]) / VRatio[k];
|
||||||
|
+ FullDETBufferingTimeY[k] = LinesInDETYRoundedDownToSwath[k] * (v->HTotal[k] / v->PixelClock[k]) / v->VRatio[k];
|
||||||
|
if (BytePerPixelDETC[k] > 0) {
|
||||||
|
- LinesInDETC = mode_lib->vba.DETBufferSizeC[k] / BytePerPixelDETC[k] / SwathWidthC[k];
|
||||||
|
+ LinesInDETC = v->DETBufferSizeC[k] / BytePerPixelDETC[k] / SwathWidthC[k];
|
||||||
|
LinesInDETCRoundedDownToSwath = dml_floor(LinesInDETC, SwathHeightC[k]);
|
||||||
|
- FullDETBufferingTimeC = LinesInDETCRoundedDownToSwath * (HTotal[k] / PixelClock[k]) / VRatioChroma[k];
|
||||||
|
+ FullDETBufferingTimeC = LinesInDETCRoundedDownToSwath * (v->HTotal[k] / v->PixelClock[k]) / v->VRatioChroma[k];
|
||||||
|
} else {
|
||||||
|
LinesInDETC = 0;
|
||||||
|
FullDETBufferingTimeC = 999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
- ActiveDRAMClockChangeLatencyMarginY = EffectiveLBLatencyHidingY + FullDETBufferingTimeY[k] - *UrgentWatermark - (HTotal[k] / PixelClock[k]) * (DSTXAfterScaler[k] / HTotal[k] + DSTYAfterScaler[k]) - *DRAMClockChangeWatermark;
|
||||||
|
+ ActiveDRAMClockChangeLatencyMarginY = EffectiveLBLatencyHidingY + FullDETBufferingTimeY[k] - v->UrgentWatermark - (v->HTotal[k] / v->PixelClock[k]) * (v->DSTXAfterScaler[k] / v->HTotal[k] + v->DSTYAfterScaler[k]) - v->DRAMClockChangeWatermark;
|
||||||
|
|
||||||
|
- if (NumberOfActivePlanes > 1) {
|
||||||
|
- ActiveDRAMClockChangeLatencyMarginY = ActiveDRAMClockChangeLatencyMarginY - (1 - 1.0 / NumberOfActivePlanes) * SwathHeightY[k] * HTotal[k] / PixelClock[k] / VRatio[k];
|
||||||
|
+ if (v->NumberOfActivePlanes > 1) {
|
||||||
|
+ ActiveDRAMClockChangeLatencyMarginY = ActiveDRAMClockChangeLatencyMarginY - (1 - 1.0 / v->NumberOfActivePlanes) * SwathHeightY[k] * v->HTotal[k] / v->PixelClock[k] / v->VRatio[k];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BytePerPixelDETC[k] > 0) {
|
||||||
|
- ActiveDRAMClockChangeLatencyMarginC = EffectiveLBLatencyHidingC + FullDETBufferingTimeC - *UrgentWatermark - (HTotal[k] / PixelClock[k]) * (DSTXAfterScaler[k] / HTotal[k] + DSTYAfterScaler[k]) - *DRAMClockChangeWatermark;
|
||||||
|
+ ActiveDRAMClockChangeLatencyMarginC = EffectiveLBLatencyHidingC + FullDETBufferingTimeC - v->UrgentWatermark - (v->HTotal[k] / v->PixelClock[k]) * (v->DSTXAfterScaler[k] / v->HTotal[k] + v->DSTYAfterScaler[k]) - v->DRAMClockChangeWatermark;
|
||||||
|
|
||||||
|
- if (NumberOfActivePlanes > 1) {
|
||||||
|
- ActiveDRAMClockChangeLatencyMarginC = ActiveDRAMClockChangeLatencyMarginC - (1 - 1.0 / NumberOfActivePlanes) * SwathHeightC[k] * HTotal[k] / PixelClock[k] / VRatioChroma[k];
|
||||||
|
+ if (v->NumberOfActivePlanes > 1) {
|
||||||
|
+ ActiveDRAMClockChangeLatencyMarginC = ActiveDRAMClockChangeLatencyMarginC - (1 - 1.0 / v->NumberOfActivePlanes) * SwathHeightC[k] * v->HTotal[k] / v->PixelClock[k] / v->VRatioChroma[k];
|
||||||
|
}
|
||||||
|
- mode_lib->vba.ActiveDRAMClockChangeLatencyMargin[k] = dml_min(ActiveDRAMClockChangeLatencyMarginY, ActiveDRAMClockChangeLatencyMarginC);
|
||||||
|
+ v->ActiveDRAMClockChangeLatencyMargin[k] = dml_min(ActiveDRAMClockChangeLatencyMarginY, ActiveDRAMClockChangeLatencyMarginC);
|
||||||
|
} else {
|
||||||
|
- mode_lib->vba.ActiveDRAMClockChangeLatencyMargin[k] = ActiveDRAMClockChangeLatencyMarginY;
|
||||||
|
+ v->ActiveDRAMClockChangeLatencyMargin[k] = ActiveDRAMClockChangeLatencyMarginY;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (WritebackEnable[k] == true) {
|
||||||
|
+ if (v->WritebackEnable[k] == true) {
|
||||||
|
|
||||||
|
- WritebackDRAMClockChangeLatencyHiding = WritebackInterfaceBufferSize * 1024 / (WritebackDestinationWidth[k] * WritebackDestinationHeight[k] / (WritebackSourceHeight[k] * HTotal[k] / PixelClock[k]) * 4);
|
||||||
|
- if (WritebackPixelFormat[k] == dm_444_64) {
|
||||||
|
+ WritebackDRAMClockChangeLatencyHiding = v->WritebackInterfaceBufferSize * 1024 / (v->WritebackDestinationWidth[k] * v->WritebackDestinationHeight[k] / (v->WritebackSourceHeight[k] * v->HTotal[k] / v->PixelClock[k]) * 4);
|
||||||
|
+ if (v->WritebackPixelFormat[k] == dm_444_64) {
|
||||||
|
WritebackDRAMClockChangeLatencyHiding = WritebackDRAMClockChangeLatencyHiding / 2;
|
||||||
|
}
|
||||||
|
- if (mode_lib->vba.WritebackConfiguration == dm_whole_buffer_for_single_stream_interleave) {
|
||||||
|
+ if (v->WritebackConfiguration == dm_whole_buffer_for_single_stream_interleave) {
|
||||||
|
WritebackDRAMClockChangeLatencyHiding = WritebackDRAMClockChangeLatencyHiding * 2;
|
||||||
|
}
|
||||||
|
- WritebackDRAMClockChangeLatencyMargin = WritebackDRAMClockChangeLatencyHiding - mode_lib->vba.WritebackDRAMClockChangeWatermark;
|
||||||
|
- mode_lib->vba.ActiveDRAMClockChangeLatencyMargin[k] = dml_min(mode_lib->vba.ActiveDRAMClockChangeLatencyMargin[k], WritebackDRAMClockChangeLatencyMargin);
|
||||||
|
+ WritebackDRAMClockChangeLatencyMargin = WritebackDRAMClockChangeLatencyHiding - v->WritebackDRAMClockChangeWatermark;
|
||||||
|
+ v->ActiveDRAMClockChangeLatencyMargin[k] = dml_min(v->ActiveDRAMClockChangeLatencyMargin[k], WritebackDRAMClockChangeLatencyMargin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- mode_lib->vba.MinActiveDRAMClockChangeMargin = 999999;
|
||||||
|
+ v->MinActiveDRAMClockChangeMargin = 999999;
|
||||||
|
PlaneWithMinActiveDRAMClockChangeMargin = 0;
|
||||||
|
- for (k = 0; k < NumberOfActivePlanes; ++k) {
|
||||||
|
- if (mode_lib->vba.ActiveDRAMClockChangeLatencyMargin[k] < mode_lib->vba.MinActiveDRAMClockChangeMargin) {
|
||||||
|
- mode_lib->vba.MinActiveDRAMClockChangeMargin = mode_lib->vba.ActiveDRAMClockChangeLatencyMargin[k];
|
||||||
|
- if (BlendingAndTiming[k] == k) {
|
||||||
|
+ for (k = 0; k < v->NumberOfActivePlanes; ++k) {
|
||||||
|
+ if (v->ActiveDRAMClockChangeLatencyMargin[k] < v->MinActiveDRAMClockChangeMargin) {
|
||||||
|
+ v->MinActiveDRAMClockChangeMargin = v->ActiveDRAMClockChangeLatencyMargin[k];
|
||||||
|
+ if (v->BlendingAndTiming[k] == k) {
|
||||||
|
PlaneWithMinActiveDRAMClockChangeMargin = k;
|
||||||
|
} else {
|
||||||
|
- for (j = 0; j < NumberOfActivePlanes; ++j) {
|
||||||
|
- if (BlendingAndTiming[k] == j) {
|
||||||
|
+ for (j = 0; j < v->NumberOfActivePlanes; ++j) {
|
||||||
|
+ if (v->BlendingAndTiming[k] == j) {
|
||||||
|
PlaneWithMinActiveDRAMClockChangeMargin = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -5244,40 +5089,40 @@ static void CalculateWatermarksAndDRAMSpeedChangeSupport(
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- *MinActiveDRAMClockChangeLatencySupported = mode_lib->vba.MinActiveDRAMClockChangeMargin + DRAMClockChangeLatency;
|
||||||
|
+ v->MinActiveDRAMClockChangeLatencySupported = v->MinActiveDRAMClockChangeMargin + v->FinalDRAMClockChangeLatency;
|
||||||
|
|
||||||
|
SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank = 999999;
|
||||||
|
- for (k = 0; k < NumberOfActivePlanes; ++k) {
|
||||||
|
- if (!((k == PlaneWithMinActiveDRAMClockChangeMargin) && (BlendingAndTiming[k] == k)) && !(BlendingAndTiming[k] == PlaneWithMinActiveDRAMClockChangeMargin) && mode_lib->vba.ActiveDRAMClockChangeLatencyMargin[k] < SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank) {
|
||||||
|
- SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank = mode_lib->vba.ActiveDRAMClockChangeLatencyMargin[k];
|
||||||
|
+ for (k = 0; k < v->NumberOfActivePlanes; ++k) {
|
||||||
|
+ if (!((k == PlaneWithMinActiveDRAMClockChangeMargin) && (v->BlendingAndTiming[k] == k)) && !(v->BlendingAndTiming[k] == PlaneWithMinActiveDRAMClockChangeMargin) && v->ActiveDRAMClockChangeLatencyMargin[k] < SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank) {
|
||||||
|
+ SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank = v->ActiveDRAMClockChangeLatencyMargin[k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- mode_lib->vba.TotalNumberOfActiveOTG = 0;
|
||||||
|
- for (k = 0; k < NumberOfActivePlanes; ++k) {
|
||||||
|
- if (BlendingAndTiming[k] == k) {
|
||||||
|
- mode_lib->vba.TotalNumberOfActiveOTG = mode_lib->vba.TotalNumberOfActiveOTG + 1;
|
||||||
|
+ v->TotalNumberOfActiveOTG = 0;
|
||||||
|
+ for (k = 0; k < v->NumberOfActivePlanes; ++k) {
|
||||||
|
+ if (v->BlendingAndTiming[k] == k) {
|
||||||
|
+ v->TotalNumberOfActiveOTG = v->TotalNumberOfActiveOTG + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (mode_lib->vba.MinActiveDRAMClockChangeMargin > 0) {
|
||||||
|
+ if (v->MinActiveDRAMClockChangeMargin > 0) {
|
||||||
|
*DRAMClockChangeSupport = dm_dram_clock_change_vactive;
|
||||||
|
- } else if (((mode_lib->vba.SynchronizedVBlank == true || mode_lib->vba.TotalNumberOfActiveOTG == 1 || SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank > 0) && PrefetchMode == 0)) {
|
||||||
|
+ } else if (((v->SynchronizedVBlank == true || v->TotalNumberOfActiveOTG == 1 || SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank > 0) && PrefetchMode == 0)) {
|
||||||
|
*DRAMClockChangeSupport = dm_dram_clock_change_vblank;
|
||||||
|
} else {
|
||||||
|
*DRAMClockChangeSupport = dm_dram_clock_change_unsupported;
|
||||||
|
}
|
||||||
|
|
||||||
|
FullDETBufferingTimeYStutterCriticalPlane = FullDETBufferingTimeY[0];
|
||||||
|
- for (k = 0; k < NumberOfActivePlanes; ++k) {
|
||||||
|
+ for (k = 0; k < v->NumberOfActivePlanes; ++k) {
|
||||||
|
if (FullDETBufferingTimeY[k] <= FullDETBufferingTimeYStutterCriticalPlane) {
|
||||||
|
FullDETBufferingTimeYStutterCriticalPlane = FullDETBufferingTimeY[k];
|
||||||
|
- TimeToFinishSwathTransferStutterCriticalPlane = (SwathHeightY[k] - (LinesInDETY[k] - LinesInDETYRoundedDownToSwath[k])) * (HTotal[k] / PixelClock[k]) / VRatio[k];
|
||||||
|
+ TimeToFinishSwathTransferStutterCriticalPlane = (SwathHeightY[k] - (LinesInDETY[k] - LinesInDETYRoundedDownToSwath[k])) * (v->HTotal[k] / v->PixelClock[k]) / v->VRatio[k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- *StutterExitWatermark = SRExitTime + ExtraLatency + 10 / DCFCLKDeepSleep;
|
||||||
|
- *StutterEnterPlusExitWatermark = dml_max(SREnterPlusExitTime + ExtraLatency + 10 / DCFCLKDeepSleep, TimeToFinishSwathTransferStutterCriticalPlane);
|
||||||
|
+ v->StutterExitWatermark = v->SRExitTime + ExtraLatency + 10 / DCFCLKDeepSleep;
|
||||||
|
+ v->StutterEnterPlusExitWatermark = dml_max(v->SREnterPlusExitTime + ExtraLatency + 10 / DCFCLKDeepSleep, TimeToFinishSwathTransferStutterCriticalPlane);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
cgit 1.2.3-korg
|
||||||
|
`},
|
||||||
|
},
|
||||||
|
|
||||||
|
Flag: TExclusive,
|
||||||
|
}, &MakeHelper{
|
||||||
|
OmitDefaults: true,
|
||||||
|
SkipConfigure: true,
|
||||||
|
|
||||||
|
// Build, install, and boot kernel before running kselftest on it.
|
||||||
|
SkipCheck: true,
|
||||||
|
|
||||||
|
Make: []string{
|
||||||
|
"-f /usr/src/kernel/Makefile",
|
||||||
|
"O=/tmp/kbuild",
|
||||||
|
|
||||||
|
"LLVM=1",
|
||||||
|
"KBUILD_BUILD_VERSION='1-Rosa'",
|
||||||
|
"KBUILD_BUILD_TIMESTAMP='2106-02-07 06:28:15 UTC'",
|
||||||
|
"KBUILD_BUILD_USER=kbuild",
|
||||||
|
"KBUILD_BUILD_HOST=localhost",
|
||||||
|
"all",
|
||||||
|
},
|
||||||
|
Install: `
|
||||||
|
# kernel is not aware of kmod moduledir
|
||||||
|
install -Dm0500 \
|
||||||
|
/usr/src/.depmod \
|
||||||
|
/sbin/depmod
|
||||||
|
|
||||||
|
make \
|
||||||
|
` + jobsFlagE + ` \
|
||||||
|
-f /usr/src/kernel/Makefile \
|
||||||
|
O=/tmp/kbuild \
|
||||||
|
LLVM=1 \
|
||||||
|
INSTALL_PATH=/work \
|
||||||
|
install \
|
||||||
|
INSTALL_MOD_PATH=/work/system \
|
||||||
|
DEPMOD=/sbin/depmod \
|
||||||
|
modules_install
|
||||||
|
rm -v /work/system/lib/modules/` + kernelVersion + `/build
|
||||||
|
`,
|
||||||
|
},
|
||||||
|
Flex,
|
||||||
|
Bison,
|
||||||
|
M4,
|
||||||
|
Tar,
|
||||||
|
Perl,
|
||||||
|
BC,
|
||||||
|
Sed,
|
||||||
|
Gawk,
|
||||||
|
Coreutils,
|
||||||
|
Diffutils,
|
||||||
|
Python,
|
||||||
|
|
||||||
|
XZ,
|
||||||
|
Gzip,
|
||||||
|
Kmod,
|
||||||
|
Elfutils,
|
||||||
|
UtilLinux,
|
||||||
|
KernelHeaders,
|
||||||
|
), kernelVersion
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newKernel,
|
||||||
|
|
||||||
|
Name: "kernel",
|
||||||
|
Description: "the generic Rosa OS linux kernel",
|
||||||
|
Website: "https://kernel.org/",
|
||||||
|
|
||||||
|
ID: 375621,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t Toolchain) newGenInitCPIO() (pkg.Artifact, string) {
|
||||||
|
return t.New("gen_init_cpio-"+kernelVersion, 0, nil, nil, nil, `
|
||||||
|
mkdir -p /work/system/bin/
|
||||||
|
cc -o /work/system/bin/gen_init_cpio /usr/src/linux/usr/gen_init_cpio.c
|
||||||
|
`, pkg.Path(AbsUsrSrc.Append("linux"), false, kernelSource)), kernelVersion
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newGenInitCPIO,
|
||||||
|
|
||||||
|
Name: "gen_init_cpio",
|
||||||
|
Description: "a program in the kernel source tree for creating initramfs archive",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t Toolchain) newFirmware() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "20260410"
|
||||||
|
checksum = "J8PdQlGqwrivpskPzbL6xacqR6mlKtXpe5RpzFfVzKPAgG81ZRXsc3qrxwdGJbil"
|
||||||
|
)
|
||||||
|
return t.NewPackage("firmware", version, newFromGitLab(
|
||||||
|
"gitlab.com",
|
||||||
|
"kernel-firmware/linux-firmware",
|
||||||
|
version,
|
||||||
|
checksum,
|
||||||
|
), &PackageAttr{
|
||||||
|
// dedup creates temporary file
|
||||||
|
Writable: true,
|
||||||
|
// does not use configure
|
||||||
|
EnterSource: true,
|
||||||
|
|
||||||
|
Env: []string{
|
||||||
|
"HOME=/proc/nonexistent",
|
||||||
|
},
|
||||||
|
}, &MakeHelper{
|
||||||
|
OmitDefaults: true,
|
||||||
|
SkipConfigure: true,
|
||||||
|
InPlace: true,
|
||||||
|
|
||||||
|
Make: []string{
|
||||||
|
"DESTDIR=/work/system",
|
||||||
|
"install-zst",
|
||||||
|
},
|
||||||
|
SkipCheck: true, // requires pre-commit
|
||||||
|
Install: "make " + jobsFlagE + " DESTDIR=/work/system dedup",
|
||||||
|
},
|
||||||
|
Parallel,
|
||||||
|
Rdfind,
|
||||||
|
Zstd,
|
||||||
|
Findutils,
|
||||||
|
Coreutils,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newFirmware,
|
||||||
|
|
||||||
|
Name: "firmware",
|
||||||
|
Description: "firmware blobs for use with the Linux kernel",
|
||||||
|
Website: "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/",
|
||||||
|
|
||||||
|
ID: 141464,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
#
|
#
|
||||||
# Automatically generated file; DO NOT EDIT.
|
# Automatically generated file; DO NOT EDIT.
|
||||||
# Linux/x86 6.12.87 Kernel Configuration
|
# Linux/x86 6.12.84 Kernel Configuration
|
||||||
#
|
#
|
||||||
CONFIG_CC_VERSION_TEXT="clang version 22.1.5"
|
CONFIG_CC_VERSION_TEXT="clang version 22.1.4"
|
||||||
CONFIG_GCC_VERSION=0
|
CONFIG_GCC_VERSION=0
|
||||||
CONFIG_CC_IS_CLANG=y
|
CONFIG_CC_IS_CLANG=y
|
||||||
CONFIG_CLANG_VERSION=220105
|
CONFIG_CLANG_VERSION=220104
|
||||||
CONFIG_AS_IS_LLVM=y
|
CONFIG_AS_IS_LLVM=y
|
||||||
CONFIG_AS_VERSION=220105
|
CONFIG_AS_VERSION=220104
|
||||||
CONFIG_LD_VERSION=0
|
CONFIG_LD_VERSION=0
|
||||||
CONFIG_LD_IS_LLD=y
|
CONFIG_LD_IS_LLD=y
|
||||||
CONFIG_LLD_VERSION=220105
|
CONFIG_LLD_VERSION=220104
|
||||||
CONFIG_RUSTC_VERSION=0
|
CONFIG_RUSTC_VERSION=0
|
||||||
CONFIG_RUSTC_LLVM_VERSION=0
|
CONFIG_RUSTC_LLVM_VERSION=0
|
||||||
CONFIG_CC_HAS_ASM_GOTO_OUTPUT=y
|
CONFIG_CC_HAS_ASM_GOTO_OUTPUT=y
|
||||||
@@ -12137,9 +12137,7 @@ CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
|
|||||||
# CONFIG_DEBUG_INFO_DWARF4 is not set
|
# CONFIG_DEBUG_INFO_DWARF4 is not set
|
||||||
# CONFIG_DEBUG_INFO_DWARF5 is not set
|
# CONFIG_DEBUG_INFO_DWARF5 is not set
|
||||||
# CONFIG_DEBUG_INFO_REDUCED is not set
|
# CONFIG_DEBUG_INFO_REDUCED is not set
|
||||||
# CONFIG_DEBUG_INFO_COMPRESSED_NONE is not set
|
CONFIG_DEBUG_INFO_COMPRESSED_NONE=y
|
||||||
# CONFIG_DEBUG_INFO_COMPRESSED_ZLIB is not set
|
|
||||||
CONFIG_DEBUG_INFO_COMPRESSED_ZSTD=y
|
|
||||||
# CONFIG_DEBUG_INFO_SPLIT is not set
|
# CONFIG_DEBUG_INFO_SPLIT is not set
|
||||||
# CONFIG_GDB_SCRIPTS is not set
|
# CONFIG_GDB_SCRIPTS is not set
|
||||||
CONFIG_FRAME_WARN=2048
|
CONFIG_FRAME_WARN=2048
|
||||||
8
internal/rosa/kernel_amd64.go
Normal file
8
internal/rosa/kernel_amd64.go
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import _ "embed"
|
||||||
|
|
||||||
|
//go:embed kernel_amd64.config
|
||||||
|
var kernelConfig []byte
|
||||||
|
|
||||||
|
const kernelName = "bzImage"
|
||||||
8
internal/rosa/kernel_arm64.go
Normal file
8
internal/rosa/kernel_arm64.go
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import _ "embed"
|
||||||
|
|
||||||
|
//go:embed kernel_arm64.config
|
||||||
|
var kernelConfig []byte
|
||||||
|
|
||||||
|
const kernelName = "vmlinuz.efi"
|
||||||
8
internal/rosa/kernel_riscv64.go
Normal file
8
internal/rosa/kernel_riscv64.go
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import _ "embed"
|
||||||
|
|
||||||
|
//go:embed kernel_riscv64.config
|
||||||
|
var kernelConfig []byte
|
||||||
|
|
||||||
|
const kernelName = "bzImage"
|
||||||
50
internal/rosa/kmod.go
Normal file
50
internal/rosa/kmod.go
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newKmod() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "34.2"
|
||||||
|
checksum = "0K7POeTKxMhExsaTsnKAC6LUNsRSfe6sSZxWONPbOu-GI_pXOw3toU_BIoqfBhJV"
|
||||||
|
)
|
||||||
|
return t.NewPackage("kmod", version, newTar(
|
||||||
|
"https://www.kernel.org/pub/linux/utils/kernel/"+
|
||||||
|
"kmod/kmod-"+version+".tar.gz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
), nil, &MesonHelper{
|
||||||
|
Setup: []KV{
|
||||||
|
{"Dmoduledir", "/system/lib/modules"},
|
||||||
|
{"Dsysconfdir", "/system/etc"},
|
||||||
|
{"Dbashcompletiondir", "no"},
|
||||||
|
{"Dfishcompletiondir", "no"},
|
||||||
|
{"Dxz", "disabled"},
|
||||||
|
{"Dmanpages", "false"},
|
||||||
|
},
|
||||||
|
|
||||||
|
// makes assumptions about the running kernel
|
||||||
|
SkipTest: true,
|
||||||
|
},
|
||||||
|
Zlib,
|
||||||
|
Zstd,
|
||||||
|
OpenSSL,
|
||||||
|
KernelHeaders,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newKmod,
|
||||||
|
|
||||||
|
Name: "kmod",
|
||||||
|
Description: "a set of tools to handle common tasks with Linux kernel modules",
|
||||||
|
Website: "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
Zlib,
|
||||||
|
Zstd,
|
||||||
|
OpenSSL,
|
||||||
|
},
|
||||||
|
|
||||||
|
ID: 1517,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -1,3 +1,20 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newLibarchive() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "3.8.7"
|
||||||
|
checksum = "CUJK4MDQmZmATClgQBH2Wt-7Ts4iiSUlg1J_TVb6-5IK3rVUgVLIMc5k-bnWB9w3"
|
||||||
|
)
|
||||||
|
return t.NewPackage("libarchive", version, newFromGitHub(
|
||||||
|
"libarchive/libarchive",
|
||||||
|
"v"+version, checksum,
|
||||||
|
), &PackageAttr{
|
||||||
|
Paths: []pkg.ExecPath{
|
||||||
|
pkg.Path(AbsUsrSrc.Append(
|
||||||
|
"CTestCustom.cmake",
|
||||||
|
), false, pkg.NewFile("CTestCustom.cmake", []byte(`
|
||||||
list(APPEND CTEST_CUSTOM_TESTS_IGNORE
|
list(APPEND CTEST_CUSTOM_TESTS_IGNORE
|
||||||
"libarchive_test_archive_string_conversion_fail_c"
|
"libarchive_test_archive_string_conversion_fail_c"
|
||||||
"libarchive_test_archive_string_conversion_fail_latin1"
|
"libarchive_test_archive_string_conversion_fail_latin1"
|
||||||
@@ -61,3 +78,23 @@ list(APPEND CTEST_CUSTOM_TESTS_IGNORE
|
|||||||
"libarchive_test_read_format_ustar_filename"
|
"libarchive_test_read_format_ustar_filename"
|
||||||
"libarchive_test_read_append_wrong_filter"
|
"libarchive_test_read_append_wrong_filter"
|
||||||
)
|
)
|
||||||
|
`))),
|
||||||
|
},
|
||||||
|
|
||||||
|
Writable: true,
|
||||||
|
ScriptEarly: `
|
||||||
|
install -Dv /usr/src/CTestCustom.cmake /cure/
|
||||||
|
`,
|
||||||
|
}, (*CMakeHelper)(nil)), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLibarchive,
|
||||||
|
|
||||||
|
Name: "libarchive",
|
||||||
|
Description: "multi-format archive and compression library",
|
||||||
|
Website: "https://www.libarchive.org/",
|
||||||
|
|
||||||
|
ID: 1558,
|
||||||
|
})
|
||||||
|
}
|
||||||
62
internal/rosa/libbsd.go
Normal file
62
internal/rosa/libbsd.go
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newLibmd() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "1.2.0"
|
||||||
|
checksum = "1rJ6joAO0wwMZvSfnRNkc1MOhywyAq7SM8VmF92NvDtv7Qdl1LRbjm5fg_DFFtGj"
|
||||||
|
)
|
||||||
|
return t.NewPackage("libmd", version, t.newTagRemote(
|
||||||
|
"https://git.hadrons.org/git/libmd.git",
|
||||||
|
version, checksum,
|
||||||
|
), nil, &MakeHelper{
|
||||||
|
Generate: "echo '" + version + "' > .dist-version && ./autogen",
|
||||||
|
ScriptMakeEarly: `
|
||||||
|
install -D /usr/src/libmd/src/helper.c src/helper.c
|
||||||
|
`,
|
||||||
|
},
|
||||||
|
Automake,
|
||||||
|
Libtool,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLibmd,
|
||||||
|
|
||||||
|
Name: "libmd",
|
||||||
|
Description: "Message Digest functions from BSD systems",
|
||||||
|
Website: "https://www.hadrons.org/software/libmd/",
|
||||||
|
|
||||||
|
ID: 15525,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t Toolchain) newLibbsd() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "0.12.2"
|
||||||
|
checksum = "NVS0xFLTwSP8JiElEftsZ-e1_C-IgJhHrHE77RwKt5178M7r087waO-zYx2_dfGX"
|
||||||
|
)
|
||||||
|
return t.NewPackage("libbsd", version, t.newTagRemote(
|
||||||
|
"https://gitlab.freedesktop.org/libbsd/libbsd.git",
|
||||||
|
version, checksum,
|
||||||
|
), nil, &MakeHelper{
|
||||||
|
Generate: "echo '" + version + "' > .dist-version && ./autogen",
|
||||||
|
},
|
||||||
|
Automake,
|
||||||
|
Libtool,
|
||||||
|
|
||||||
|
Libmd,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLibbsd,
|
||||||
|
|
||||||
|
Name: "libbsd",
|
||||||
|
Description: "provides useful functions commonly found on BSD systems",
|
||||||
|
Website: "https://libbsd.freedesktop.org/",
|
||||||
|
|
||||||
|
ID: 1567,
|
||||||
|
})
|
||||||
|
}
|
||||||
54
internal/rosa/libcap.go
Normal file
54
internal/rosa/libcap.go
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newLibcap() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "2.78"
|
||||||
|
checksum = "wFdUkBhFMD9InPnrBZyegWrlPSAg_9JiTBC-eSFyWWlmbzL2qjh2mKxr9Kx2a8ut"
|
||||||
|
)
|
||||||
|
return t.NewPackage("libcap", version, newTar(
|
||||||
|
"https://git.kernel.org/pub/scm/libs/libcap/libcap.git/"+
|
||||||
|
"snapshot/libcap-"+version+".tar.gz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
), &PackageAttr{
|
||||||
|
// uses source tree as scratch space
|
||||||
|
Writable: true,
|
||||||
|
Chmod: true,
|
||||||
|
|
||||||
|
Env: []string{
|
||||||
|
"prefix=/system",
|
||||||
|
"lib=lib",
|
||||||
|
},
|
||||||
|
ScriptEarly: `
|
||||||
|
ln -s ../system/bin/bash /bin/
|
||||||
|
`,
|
||||||
|
}, &MakeHelper{
|
||||||
|
SkipConfigure: true,
|
||||||
|
InPlace: true,
|
||||||
|
|
||||||
|
Make: []string{
|
||||||
|
"CC=cc",
|
||||||
|
"all",
|
||||||
|
},
|
||||||
|
Check: []string{
|
||||||
|
"CC=cc",
|
||||||
|
"test",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Bash,
|
||||||
|
Diffutils,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLibcap,
|
||||||
|
|
||||||
|
Name: "libcap",
|
||||||
|
Description: "a library for getting and setting POSIX.1e draft 15 capabilities",
|
||||||
|
Website: "https://sites.google.com/site/fullycapable/",
|
||||||
|
|
||||||
|
ID: 1569,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -1,4 +1,19 @@
|
|||||||
diff --git a/tests/tests.c b/tests/tests.c
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newLibconfig() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "1.8.2"
|
||||||
|
checksum = "fD32hjeAZuTz98g6WYHRwsxphrgrEFqxi5Z1jlJemPckPBfxpS3i5HgshAuA6vmT"
|
||||||
|
)
|
||||||
|
return t.NewPackage("libconfig", version, newFromGitHub(
|
||||||
|
"hyperrealm/libconfig",
|
||||||
|
"v"+version,
|
||||||
|
checksum,
|
||||||
|
), &PackageAttr{
|
||||||
|
Patches: []KV{
|
||||||
|
{"disable-broken-tests", `diff --git a/tests/tests.c b/tests/tests.c
|
||||||
index eba7eae..f916d2e 100644
|
index eba7eae..f916d2e 100644
|
||||||
--- a/tests/tests.c
|
--- a/tests/tests.c
|
||||||
+++ b/tests/tests.c
|
+++ b/tests/tests.c
|
||||||
@@ -18,3 +33,18 @@ index eba7eae..f916d2e 100644
|
|||||||
TT_SUITE_RUN(LibConfigTests);
|
TT_SUITE_RUN(LibConfigTests);
|
||||||
failures = TT_SUITE_NUM_FAILURES(LibConfigTests);
|
failures = TT_SUITE_NUM_FAILURES(LibConfigTests);
|
||||||
TT_SUITE_END(LibConfigTests);
|
TT_SUITE_END(LibConfigTests);
|
||||||
|
`},
|
||||||
|
},
|
||||||
|
}, (*CMakeHelper)(nil)), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLibconfig,
|
||||||
|
|
||||||
|
Name: "libconfig",
|
||||||
|
Description: "a simple library for processing structured configuration files",
|
||||||
|
Website: "https://hyperrealm.github.io/libconfig/",
|
||||||
|
|
||||||
|
ID: 1580,
|
||||||
|
})
|
||||||
|
}
|
||||||
30
internal/rosa/libdisplay-info.go
Normal file
30
internal/rosa/libdisplay-info.go
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newLibdisplayInfo() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "0.3.0"
|
||||||
|
checksum = "yjOqPUHHYgRtpqGw5RI1n2Q1_hO5j0LiFNMbjcRWV4Nf71XwwoC9fZMlKBDeLchT"
|
||||||
|
)
|
||||||
|
return t.NewPackage("libdisplay-info", version, newFromGitLab(
|
||||||
|
"gitlab.freedesktop.org",
|
||||||
|
"emersion/libdisplay-info",
|
||||||
|
version, checksum,
|
||||||
|
), nil, (*MesonHelper)(nil),
|
||||||
|
Diffutils,
|
||||||
|
|
||||||
|
Hwdata,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLibdisplayInfo,
|
||||||
|
|
||||||
|
Name: "libdisplay-info",
|
||||||
|
Description: "EDID and DisplayID library",
|
||||||
|
Website: "https://gitlab.freedesktop.org/emersion/libdisplay-info",
|
||||||
|
|
||||||
|
ID: 326668,
|
||||||
|
})
|
||||||
|
}
|
||||||
33
internal/rosa/libepoxy.go
Normal file
33
internal/rosa/libepoxy.go
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newLibepoxy() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "1.5.10"
|
||||||
|
checksum = "OHI8wshrlGw6BMGrmSyejJtwzM2gPhyFJrTsKxULyKMmYrfgcOe7Iw2ibVoUND_Q"
|
||||||
|
)
|
||||||
|
return t.NewPackage("libepoxy", version, newFromGitHub(
|
||||||
|
"anholt/libepoxy",
|
||||||
|
version,
|
||||||
|
checksum,
|
||||||
|
), nil, &MesonHelper{
|
||||||
|
Setup: []KV{
|
||||||
|
{"Dglx", "no"},
|
||||||
|
{"Degl", "no"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
LibX11,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLibepoxy,
|
||||||
|
|
||||||
|
Name: "libepoxy",
|
||||||
|
Description: "a library for handling OpenGL function pointer management",
|
||||||
|
Website: "https://github.com/anholt/libepoxy",
|
||||||
|
|
||||||
|
ID: 6090,
|
||||||
|
})
|
||||||
|
}
|
||||||
26
internal/rosa/libev.go
Normal file
26
internal/rosa/libev.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newLibev() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "4.33"
|
||||||
|
checksum = "774eSXV_4k8PySRprUDChbEwsw-kzjIFnJ3MpNOl5zDpamBRvC3BqPyRxvkwcL6_"
|
||||||
|
)
|
||||||
|
return t.NewPackage("libev", version, newTar(
|
||||||
|
"https://dist.schmorp.de/libev/Attic/libev-"+version+".tar.gz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
), nil, (*MakeHelper)(nil)), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLibev,
|
||||||
|
|
||||||
|
Name: "libev",
|
||||||
|
Description: "a full-featured and high-performance event loop",
|
||||||
|
Website: "http://libev.schmorp.de/",
|
||||||
|
|
||||||
|
ID: 1605,
|
||||||
|
})
|
||||||
|
}
|
||||||
34
internal/rosa/libexpat.go
Normal file
34
internal/rosa/libexpat.go
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"hakurei.app/internal/pkg"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (t Toolchain) newLibexpat() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "2.8.1"
|
||||||
|
checksum = "iMEtbOJhQfGof2GxSlxffQSI1va_NDDQ9VIuqcPbNZ0291Dr8wttD5QecYyjIQap"
|
||||||
|
)
|
||||||
|
return t.NewPackage("libexpat", version, newFromGitHubRelease(
|
||||||
|
"libexpat/libexpat",
|
||||||
|
"R_"+strings.ReplaceAll(version, ".", "_"),
|
||||||
|
"expat-"+version+".tar.bz2",
|
||||||
|
checksum,
|
||||||
|
pkg.TarBzip2,
|
||||||
|
), nil, (*MakeHelper)(nil),
|
||||||
|
Bash,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLibexpat,
|
||||||
|
|
||||||
|
Name: "libexpat",
|
||||||
|
Description: "a stream-oriented XML parser library",
|
||||||
|
Website: "https://libexpat.github.io/",
|
||||||
|
|
||||||
|
ID: 770,
|
||||||
|
})
|
||||||
|
}
|
||||||
30
internal/rosa/libffi.go
Normal file
30
internal/rosa/libffi.go
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newLibffi() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "3.5.2"
|
||||||
|
checksum = "2_Q-ZNBBbVhltfL5zEr0wljxPegUimTK4VeMSiwJEGksls3n4gj3lV0Ly3vviSFH"
|
||||||
|
)
|
||||||
|
return t.NewPackage("libffi", version, newFromGitHubRelease(
|
||||||
|
"libffi/libffi",
|
||||||
|
"v"+version,
|
||||||
|
"libffi-"+version+".tar.gz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
), nil, (*MakeHelper)(nil),
|
||||||
|
KernelHeaders,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLibffi,
|
||||||
|
|
||||||
|
Name: "libffi",
|
||||||
|
Description: "a portable, high level programming interface to various calling conventions",
|
||||||
|
Website: "https://sourceware.org/libffi/",
|
||||||
|
|
||||||
|
ID: 1611,
|
||||||
|
})
|
||||||
|
}
|
||||||
40
internal/rosa/libgd.go
Normal file
40
internal/rosa/libgd.go
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newLibgd() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "2.3.3"
|
||||||
|
checksum = "8T-sh1_FJT9K9aajgxzh8ot6vWIF-xxjcKAHvTak9MgGUcsFfzP8cAvvv44u2r36"
|
||||||
|
)
|
||||||
|
return t.NewPackage("libgd", version, newFromGitHubRelease(
|
||||||
|
"libgd/libgd",
|
||||||
|
"gd-"+version,
|
||||||
|
"libgd-"+version+".tar.gz", checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
), &PackageAttr{
|
||||||
|
Env: []string{
|
||||||
|
"TMPDIR=/dev/shm/gd",
|
||||||
|
},
|
||||||
|
ScriptEarly: `
|
||||||
|
mkdir /dev/shm/gd
|
||||||
|
`,
|
||||||
|
}, (*MakeHelper)(nil),
|
||||||
|
Zlib,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLibgd,
|
||||||
|
|
||||||
|
Name: "libgd",
|
||||||
|
Description: "an open source code library for the dynamic creation of images",
|
||||||
|
Website: "https://libgd.github.io/",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
Zlib,
|
||||||
|
},
|
||||||
|
|
||||||
|
ID: 880,
|
||||||
|
})
|
||||||
|
}
|
||||||
38
internal/rosa/libpng.go
Normal file
38
internal/rosa/libpng.go
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"hakurei.app/internal/pkg"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (t Toolchain) newLibpng() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "1.6.58"
|
||||||
|
checksum = "m_a5lROJH7vmF3cMjqwTUqURuQLhV1JQx2ySPzcN3VPdgDB9pG3UINsIx_mtkr-t"
|
||||||
|
)
|
||||||
|
return t.NewPackage("libpng", version, newTar(
|
||||||
|
"https://downloads.sourceforge.net/project/libpng/libpng"+
|
||||||
|
strings.Join(strings.SplitN(version, ".", 3)[:2], "")+
|
||||||
|
"/"+version+"/libpng-"+version+".tar.gz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
), nil, (*MakeHelper)(nil),
|
||||||
|
Zlib,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLibpng,
|
||||||
|
|
||||||
|
Name: "libpng",
|
||||||
|
Description: "the official PNG reference library",
|
||||||
|
Website: "https://www.libpng.org/pub/png/libpng.html",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
Zlib,
|
||||||
|
},
|
||||||
|
|
||||||
|
ID: 1705,
|
||||||
|
})
|
||||||
|
}
|
||||||
37
internal/rosa/libpsl.go
Normal file
37
internal/rosa/libpsl.go
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newLibpsl() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "0.21.5"
|
||||||
|
checksum = "XjfxSzh7peG2Vg4vJlL8z4JZJLcXqbuP6pLWkrGCmRxlnYUFTKNBqWGHCxEOlCad"
|
||||||
|
)
|
||||||
|
return t.NewPackage("libpsl", version, newFromGitHubRelease(
|
||||||
|
"rockdaboot/libpsl",
|
||||||
|
version,
|
||||||
|
"libpsl-"+version+".tar.gz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
), &PackageAttr{
|
||||||
|
Writable: true,
|
||||||
|
ScriptEarly: `
|
||||||
|
test_disable() { chmod +w "$2" && echo "$1" > "$2"; }
|
||||||
|
|
||||||
|
test_disable 'int main(){return 0;}' tests/test-is-public-builtin.c
|
||||||
|
`,
|
||||||
|
}, (*MakeHelper)(nil),
|
||||||
|
Python,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLibpsl,
|
||||||
|
|
||||||
|
Name: "libpsl",
|
||||||
|
Description: "provides functions to work with the Mozilla Public Suffix List",
|
||||||
|
Website: "https://rockdaboot.github.io/libpsl/",
|
||||||
|
|
||||||
|
ID: 7305,
|
||||||
|
})
|
||||||
|
}
|
||||||
55
internal/rosa/libseccomp.go
Normal file
55
internal/rosa/libseccomp.go
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newLibseccomp() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "2.6.0"
|
||||||
|
checksum = "mMu-iR71guPjFbb31u-YexBaanKE_nYPjPux-vuBiPfS_0kbwJdfCGlkofaUm-EY"
|
||||||
|
)
|
||||||
|
return t.NewPackage("libseccomp", version, newFromGitHubRelease(
|
||||||
|
"seccomp/libseccomp",
|
||||||
|
"v"+version,
|
||||||
|
"libseccomp-"+version+".tar.gz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
), &PackageAttr{
|
||||||
|
ScriptEarly: `
|
||||||
|
ln -s ../system/bin/bash /bin/
|
||||||
|
`,
|
||||||
|
|
||||||
|
Patches: []KV{
|
||||||
|
{"fix-export-oob-read", `diff --git a/src/api.c b/src/api.c
|
||||||
|
index adccef3..65a277a 100644
|
||||||
|
--- a/src/api.c
|
||||||
|
+++ b/src/api.c
|
||||||
|
@@ -786,7 +786,7 @@ API int seccomp_export_bpf_mem(const scmp_filter_ctx ctx, void *buf,
|
||||||
|
if (BPF_PGM_SIZE(program) > *len)
|
||||||
|
rc = _rc_filter(-ERANGE);
|
||||||
|
else
|
||||||
|
- memcpy(buf, program->blks, *len);
|
||||||
|
+ memcpy(buf, program->blks, BPF_PGM_SIZE(program));
|
||||||
|
}
|
||||||
|
*len = BPF_PGM_SIZE(program);
|
||||||
|
|
||||||
|
`},
|
||||||
|
},
|
||||||
|
}, (*MakeHelper)(nil),
|
||||||
|
Bash,
|
||||||
|
Diffutils,
|
||||||
|
Gperf,
|
||||||
|
|
||||||
|
KernelHeaders,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLibseccomp,
|
||||||
|
|
||||||
|
Name: "libseccomp",
|
||||||
|
Description: "an interface to the Linux Kernel's syscall filtering mechanism",
|
||||||
|
Website: "https://github.com/seccomp/libseccomp/",
|
||||||
|
|
||||||
|
ID: 13823,
|
||||||
|
})
|
||||||
|
}
|
||||||
44
internal/rosa/libtirpc.go
Normal file
44
internal/rosa/libtirpc.go
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"hakurei.app/internal/pkg"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (t Toolchain) newLibtirpc() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "1.3.7"
|
||||||
|
checksum = "nzFfu7LNvnSNiNAryD1vtnNWnU-Xqee8KqfXUKoBf5yjb5-dkeRkYuRijdCoYLof"
|
||||||
|
)
|
||||||
|
return t.NewPackage("libtirpc", version, t.newTagRemote(
|
||||||
|
"git://linux-nfs.org/~steved/libtirpc",
|
||||||
|
"libtirpc-"+
|
||||||
|
strings.Join(strings.SplitN(version, ".", 3), "-"),
|
||||||
|
checksum,
|
||||||
|
), nil, &MakeHelper{
|
||||||
|
Generate: "sh -e ./bootstrap",
|
||||||
|
Configure: []KV{
|
||||||
|
{"CFLAGS", `"$(pkg-config --cflags libbsd-overlay) ${CFLAGS:-}"`},
|
||||||
|
{"disable-gssapi"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Automake,
|
||||||
|
Libtool,
|
||||||
|
PkgConfig,
|
||||||
|
|
||||||
|
Libbsd,
|
||||||
|
KernelHeaders,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLibtirpc,
|
||||||
|
|
||||||
|
Name: "libtirpc",
|
||||||
|
Description: "a port of Suns Transport-Independent RPC library to Linux",
|
||||||
|
Website: "https://sourceforge.net/projects/libtirpc/",
|
||||||
|
|
||||||
|
ID: 1740,
|
||||||
|
})
|
||||||
|
}
|
||||||
39
internal/rosa/libucontext.go
Normal file
39
internal/rosa/libucontext.go
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newLibucontext() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "1.5.1"
|
||||||
|
checksum = "mUgeyJknjMxT-5fORzz-rqhZfP3Y7EZGBhOwvhuX7MsF4Pk9wkuwtrLf5IML-jWu"
|
||||||
|
)
|
||||||
|
return t.NewPackage("libucontext", version, newFromGitHub(
|
||||||
|
"kaniini/libucontext",
|
||||||
|
"libucontext-"+version,
|
||||||
|
checksum,
|
||||||
|
), &PackageAttr{
|
||||||
|
// uses source tree as scratch space
|
||||||
|
Writable: true,
|
||||||
|
Chmod: true,
|
||||||
|
EnterSource: true,
|
||||||
|
}, &MakeHelper{
|
||||||
|
OmitDefaults: true,
|
||||||
|
SkipConfigure: true,
|
||||||
|
InPlace: true,
|
||||||
|
Make: []string{
|
||||||
|
"ARCH=" + t.linuxArch(),
|
||||||
|
},
|
||||||
|
Install: "make prefix=/system DESTDIR=/work install",
|
||||||
|
}), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLibucontext,
|
||||||
|
|
||||||
|
Name: "libucontext",
|
||||||
|
Description: "ucontext implementation featuring glibc-compatible ABI",
|
||||||
|
Website: "https://github.com/kaniini/libucontext/",
|
||||||
|
|
||||||
|
ID: 17085,
|
||||||
|
})
|
||||||
|
}
|
||||||
32
internal/rosa/libxml2.go
Normal file
32
internal/rosa/libxml2.go
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newLibxml2() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "2.15.3"
|
||||||
|
checksum = "oJy74htGlEpf70KPvpW18fYJo0RQQkCXZRwqUz6NoXborS3HCq3Nm4gsyaSeNmUH"
|
||||||
|
)
|
||||||
|
return t.NewPackage("libxml2", version, newFromGitLab(
|
||||||
|
"gitlab.gnome.org",
|
||||||
|
"GNOME/libxml2",
|
||||||
|
"v"+version, checksum,
|
||||||
|
), &PackageAttr{
|
||||||
|
// can't create shell.out: Read-only file system
|
||||||
|
Writable: true,
|
||||||
|
}, (*MesonHelper)(nil),
|
||||||
|
Git,
|
||||||
|
Diffutils,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLibxml2,
|
||||||
|
|
||||||
|
Name: "libxml2",
|
||||||
|
Description: "an XML toolkit implemented in C",
|
||||||
|
Website: "https://gitlab.gnome.org/GNOME/libxml2/",
|
||||||
|
|
||||||
|
ID: 1783,
|
||||||
|
})
|
||||||
|
}
|
||||||
42
internal/rosa/libxslt.go
Normal file
42
internal/rosa/libxslt.go
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newLibxslt() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "1.1.45"
|
||||||
|
checksum = "67ks7v8od2oWaEGf23Sst_Xbn_8brQyolQjqxPoO-lK35k_WJhi2Px5JJgbk-nfn"
|
||||||
|
)
|
||||||
|
return t.NewPackage("libxslt", version, newFromGitLab(
|
||||||
|
"gitlab.gnome.org",
|
||||||
|
"GNOME/libxslt",
|
||||||
|
"v"+version, checksum,
|
||||||
|
), nil, &MakeHelper{
|
||||||
|
Generate: "NOCONFIGURE=1 ./autogen.sh",
|
||||||
|
|
||||||
|
// python libxml2 cyclic dependency
|
||||||
|
SkipCheck: true,
|
||||||
|
},
|
||||||
|
Automake,
|
||||||
|
Libtool,
|
||||||
|
Python,
|
||||||
|
PkgConfig,
|
||||||
|
|
||||||
|
Libxml2,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLibxslt,
|
||||||
|
|
||||||
|
Name: "libxslt",
|
||||||
|
Description: "an XSLT processor based on libxml2",
|
||||||
|
Website: "https://gitlab.gnome.org/GNOME/libxslt/",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
Libxml2,
|
||||||
|
},
|
||||||
|
|
||||||
|
ID: 13301,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -1,34 +1,14 @@
|
|||||||
package rosa
|
package rosa
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/fs"
|
|
||||||
"regexp"
|
"regexp"
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
"unsafe"
|
|
||||||
|
|
||||||
"hakurei.app/internal/pkg"
|
"hakurei.app/internal/pkg"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
// litArgs returns [LIT] arguments for optional verbosity and check skipping.
|
||||||
_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 {
|
func litArgs(verbose bool, skipChecks ...string) string {
|
||||||
args := []string{"-sv"}
|
args := []string{"-sv"}
|
||||||
if verbose {
|
if verbose {
|
||||||
@@ -49,68 +29,42 @@ func litArgs(verbose bool, skipChecks ...string) string {
|
|||||||
return "'" + strings.Join(args, " ") + "'"
|
return "'" + strings.Join(args, " ") + "'"
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func (t Toolchain) newEarlyCompilerRT() (pkg.Artifact, string) {
|
||||||
var llvmPatches []KV
|
source, version := t.Load(llvmSource)
|
||||||
for _, name := range [...]string{
|
major, _, _ := strings.Cut(version, ".")
|
||||||
"increase-stack-size-unconditional",
|
return t.NewPackage("early-compiler-rt", version, source, &PackageAttr{
|
||||||
"add-rosa-vendor",
|
Flag: TExclusive,
|
||||||
"xfail-broken-tests",
|
}, &CMakeHelper{
|
||||||
"path-system-include",
|
Append: []string{"compiler-rt"},
|
||||||
"path-system-libraries",
|
|
||||||
} {
|
|
||||||
p, err := fs.ReadFile(nativeB, "package/llvm/"+name+".patch")
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
llvmPatches = append(llvmPatches, KV{
|
|
||||||
name,
|
|
||||||
unsafe.String(unsafe.SliceData(p), len(p)),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
native.MustRegister("early-compiler-rt", func(t Toolchain) (*Metadata, pkg.Artifact) {
|
Cache: []KV{
|
||||||
meta := Metadata{
|
{"ENABLE_LINKER_BUILD_ID", "ON"},
|
||||||
Name: "early-compiler-rt",
|
|
||||||
Description: "early LLVM runtime: compiler-rt",
|
|
||||||
|
|
||||||
Dependencies: P{_musl},
|
// libc++ not yet available
|
||||||
}
|
{"CMAKE_CXX_COMPILER_TARGET", ""},
|
||||||
_meta, source := t.MustLoad(_llvmSource)
|
|
||||||
meta.Version = _meta.Version
|
|
||||||
major, _, _ := strings.Cut(meta.Version, ".")
|
|
||||||
return &meta, t.NewPackage("early-compiler-rt", meta.Version, source, &PackageAttr{
|
|
||||||
Flag: TExclusive,
|
|
||||||
}, &CMakeHelper{
|
|
||||||
Append: []string{"compiler-rt"},
|
|
||||||
|
|
||||||
Cache: []KV{
|
{"LLVM_HOST_TRIPLE", `"${ROSA_TRIPLE}"`},
|
||||||
{"ENABLE_LINKER_BUILD_ID", "ON"},
|
{"LLVM_DEFAULT_TARGET_TRIPLE", `"${ROSA_TRIPLE}"`},
|
||||||
|
{"LLVM_ENABLE_RTTI", "ON"},
|
||||||
|
{"LLVM_BUILD_LLVM_DYLIB", "ON"},
|
||||||
|
{"LLVM_LINK_LLVM_DYLIB", "ON"},
|
||||||
|
{"LLVM_ENABLE_PER_TARGET_RUNTIME_DIR", "ON"},
|
||||||
|
|
||||||
// libc++ not yet available
|
{"COMPILER_RT_BUILD_BUILTINS", "ON"},
|
||||||
{"CMAKE_CXX_COMPILER_TARGET", ""},
|
{"COMPILER_RT_DEFAULT_TARGET_ONLY", "ON"},
|
||||||
|
{"COMPILER_RT_USE_BUILTINS_LIBRARY", "ON"},
|
||||||
|
{"COMPILER_RT_SANITIZERS_TO_BUILD", "asan"},
|
||||||
|
{"COMPILER_RT_BUILD_GWP_ASAN", "OFF"},
|
||||||
|
|
||||||
{"LLVM_HOST_TRIPLE", `"${ROSA_TRIPLE}"`},
|
// does not work without libunwind
|
||||||
{"LLVM_DEFAULT_TARGET_TRIPLE", `"${ROSA_TRIPLE}"`},
|
{"COMPILER_RT_BUILD_CTX_PROFILE", "OFF"},
|
||||||
{"LLVM_ENABLE_RTTI", "ON"},
|
{"COMPILER_RT_BUILD_LIBFUZZER", "OFF"},
|
||||||
{"LLVM_BUILD_LLVM_DYLIB", "ON"},
|
{"COMPILER_RT_BUILD_MEMPROF", "OFF"},
|
||||||
{"LLVM_LINK_LLVM_DYLIB", "ON"},
|
{"COMPILER_RT_BUILD_PROFILE", "OFF"},
|
||||||
{"LLVM_ENABLE_PER_TARGET_RUNTIME_DIR", "ON"},
|
{"COMPILER_RT_BUILD_XRAY", "OFF"},
|
||||||
|
},
|
||||||
{"COMPILER_RT_BUILD_BUILTINS", "ON"},
|
SkipTest: true,
|
||||||
{"COMPILER_RT_DEFAULT_TARGET_ONLY", "ON"},
|
Script: `
|
||||||
{"COMPILER_RT_USE_BUILTINS_LIBRARY", "ON"},
|
|
||||||
{"COMPILER_RT_SANITIZERS_TO_BUILD", "asan"},
|
|
||||||
{"COMPILER_RT_BUILD_GWP_ASAN", "OFF"},
|
|
||||||
|
|
||||||
// does not work without libunwind
|
|
||||||
{"COMPILER_RT_BUILD_CTX_PROFILE", "OFF"},
|
|
||||||
{"COMPILER_RT_BUILD_LIBFUZZER", "OFF"},
|
|
||||||
{"COMPILER_RT_BUILD_MEMPROF", "OFF"},
|
|
||||||
{"COMPILER_RT_BUILD_PROFILE", "OFF"},
|
|
||||||
{"COMPILER_RT_BUILD_XRAY", "OFF"},
|
|
||||||
},
|
|
||||||
SkipTest: true,
|
|
||||||
Script: `
|
|
||||||
mkdir -p "/work/system/lib/clang/` + major + `/lib/"
|
mkdir -p "/work/system/lib/clang/` + major + `/lib/"
|
||||||
ln -s \
|
ln -s \
|
||||||
"../../../${ROSA_TRIPLE}" \
|
"../../../${ROSA_TRIPLE}" \
|
||||||
@@ -123,242 +77,223 @@ ln -s \
|
|||||||
"clang_rt.crtend-` + t.linuxArch() + `.o" \
|
"clang_rt.crtend-` + t.linuxArch() + `.o" \
|
||||||
"/work/system/lib/${ROSA_TRIPLE}/crtendS.o"
|
"/work/system/lib/${ROSA_TRIPLE}/crtendS.o"
|
||||||
`,
|
`,
|
||||||
|
},
|
||||||
|
Python,
|
||||||
|
|
||||||
|
muslHeaders,
|
||||||
|
KernelHeaders,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newEarlyCompilerRT,
|
||||||
|
|
||||||
|
Name: "early-compiler-rt",
|
||||||
|
Description: "early LLVM runtime: compiler-rt",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
Musl,
|
||||||
},
|
},
|
||||||
_python,
|
|
||||||
|
|
||||||
_muslHeaders,
|
|
||||||
_kernelHeaders,
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
native.MustRegister("early-runtimes", func(t Toolchain) (*Metadata, pkg.Artifact) {
|
func (t Toolchain) newEarlyRuntimes() (pkg.Artifact, string) {
|
||||||
meta := Metadata{
|
source, version := t.Load(llvmSource)
|
||||||
Name: "early-runtimes",
|
return t.NewPackage("early-runtimes", version, source, &PackageAttr{
|
||||||
Description: "early LLVM runtimes: libunwind, libcxx, libcxxabi",
|
Flag: TExclusive,
|
||||||
|
}, &CMakeHelper{
|
||||||
|
Append: []string{"runtimes"},
|
||||||
|
|
||||||
Dependencies: P{
|
Cache: []KV{
|
||||||
_earlyCompilerRT,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
_meta, source := t.MustLoad(_llvmSource)
|
|
||||||
meta.Version = _meta.Version
|
|
||||||
|
|
||||||
return &meta, t.NewPackage("early-runtimes", meta.Version, source, &PackageAttr{
|
|
||||||
Flag: TExclusive,
|
|
||||||
}, &CMakeHelper{
|
|
||||||
Append: []string{"runtimes"},
|
|
||||||
|
|
||||||
Cache: []KV{
|
|
||||||
{"ENABLE_LINKER_BUILD_ID", "ON"},
|
|
||||||
|
|
||||||
// libc++ not yet available
|
|
||||||
{"CMAKE_CXX_COMPILER_WORKS", "ON"},
|
|
||||||
|
|
||||||
{"LLVM_HOST_TRIPLE", `"${ROSA_TRIPLE}"`},
|
|
||||||
{"LLVM_DEFAULT_TARGET_TRIPLE", `"${ROSA_TRIPLE}"`},
|
|
||||||
{"LLVM_ENABLE_RTTI", "ON"},
|
|
||||||
{"LLVM_BUILD_LLVM_DYLIB", "ON"},
|
|
||||||
{"LLVM_LINK_LLVM_DYLIB", "ON"},
|
|
||||||
{"LLVM_ENABLE_RUNTIMES", "'libunwind;libcxx;libcxxabi'"},
|
|
||||||
|
|
||||||
{"LIBUNWIND_ENABLE_ASSERTIONS", "OFF"},
|
|
||||||
{"LIBUNWIND_USE_COMPILER_RT", "ON"},
|
|
||||||
{"LIBCXX_HAS_MUSL_LIBC", "ON"},
|
|
||||||
{"LIBCXX_USE_COMPILER_RT", "ON"},
|
|
||||||
{"LIBCXX_CXX_ABI", "libcxxabi"},
|
|
||||||
{"LIBCXX_ENABLE_STATIC_ABI_LIBRARY", "OFF"},
|
|
||||||
{"LIBCXX_HARDENING_MODE", "fast"},
|
|
||||||
{"LIBCXX_HAS_ATOMIC_LIB", "OFF"},
|
|
||||||
{"LIBCXXABI_USE_COMPILER_RT", "ON"},
|
|
||||||
{"LIBCXXABI_USE_LLVM_UNWINDER", "ON"},
|
|
||||||
{"LIBCXXABI_ENABLE_STATIC_UNWINDER", "OFF"},
|
|
||||||
{"LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL", "OFF"},
|
|
||||||
|
|
||||||
{"LLVM_ENABLE_ZLIB", "FORCE_ON"},
|
|
||||||
{"LLVM_ENABLE_ZSTD", "FORCE_ON"},
|
|
||||||
{"LLVM_ENABLE_LIBXML2", "OFF"},
|
|
||||||
},
|
|
||||||
SkipTest: true,
|
|
||||||
},
|
|
||||||
_python,
|
|
||||||
|
|
||||||
_zlib,
|
|
||||||
_zstd,
|
|
||||||
_earlyCompilerRT,
|
|
||||||
_kernelHeaders,
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
const (
|
|
||||||
version = "22.1.6"
|
|
||||||
checksum = "vwMyqgc_09d__u49IlXGlxnp8eFlvpibhYQgVxQg-sGdoZlzyapMV4uX4UAjE7rA"
|
|
||||||
)
|
|
||||||
|
|
||||||
native.MustRegister("llvm-project", func(t Toolchain) (*Metadata, pkg.Artifact) {
|
|
||||||
meta := Metadata{
|
|
||||||
Name: "llvm-project",
|
|
||||||
Description: "LLVM monorepo with Rosa OS patches",
|
|
||||||
Version: version,
|
|
||||||
|
|
||||||
ID: 1830,
|
|
||||||
}
|
|
||||||
return &meta, t.NewPatchedSource("llvm-"+version, newFromGitHub(
|
|
||||||
"llvm/llvm-project",
|
|
||||||
"llvmorg-"+version,
|
|
||||||
checksum,
|
|
||||||
), true, llvmPatches...)
|
|
||||||
})
|
|
||||||
|
|
||||||
native.MustRegister("llvm", func(t Toolchain) (*Metadata, pkg.Artifact) {
|
|
||||||
meta := Metadata{
|
|
||||||
Name: "llvm",
|
|
||||||
Description: "a collection of modular and reusable compiler and toolchain technologies",
|
|
||||||
Website: "https://llvm.org",
|
|
||||||
|
|
||||||
Dependencies: P{
|
|
||||||
_zlib,
|
|
||||||
_zstd,
|
|
||||||
_musl,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
_meta, source := t.MustLoad(_llvmSource)
|
|
||||||
meta.Version = _meta.Version
|
|
||||||
|
|
||||||
early := _muslHeaders
|
|
||||||
if t.stage.isStage0() {
|
|
||||||
// The LLVM build system uses the system installation when building with
|
|
||||||
// LLVM_LINK_LLVM_DYLIB, since it builds runtimes after the fact, using
|
|
||||||
// the just-built toolchain. This is unacceptable in stage0 due to the
|
|
||||||
// potential version difference. Later stages bootstrap off of runtimes
|
|
||||||
// of its previous stage via 3-stage determinism.
|
|
||||||
early = _earlyRuntimes
|
|
||||||
}
|
|
||||||
|
|
||||||
cache := []KV{
|
|
||||||
{"ENABLE_LINKER_BUILD_ID", "ON"},
|
{"ENABLE_LINKER_BUILD_ID", "ON"},
|
||||||
{"COMPILER_RT_USE_BUILTINS_LIBRARY", "ON"},
|
|
||||||
{"COMPILER_RT_DEFAULT_TARGET_ONLY", "ON"},
|
// libc++ not yet available
|
||||||
{"COMPILER_RT_BUILD_GWP_ASAN", "OFF"},
|
{"CMAKE_CXX_COMPILER_WORKS", "ON"},
|
||||||
{"LIBCXX_CXX_ABI", "libcxxabi"},
|
|
||||||
{"LIBCXX_USE_COMPILER_RT", "ON"},
|
|
||||||
{"LIBCXX_ENABLE_STATIC_ABI_LIBRARY", "OFF"},
|
|
||||||
{"LIBCXX_HAS_MUSL_LIBC", "ON"},
|
|
||||||
{"LIBCXX_HARDENING_MODE", "fast"},
|
|
||||||
{"LIBCXXABI_USE_LLVM_UNWINDER", "ON"},
|
|
||||||
{"LIBCXXABI_ENABLE_STATIC_UNWINDER", "OFF"},
|
|
||||||
{"LIBCXXABI_USE_COMPILER_RT", "ON"},
|
|
||||||
{"LLVM_INSTALL_BINUTILS_SYMLINKS", "ON"},
|
|
||||||
{"LLVM_INSTALL_UTILS", "ON"},
|
|
||||||
{"LLVM_BUILD_LLVM_DYLIB", "ON"},
|
|
||||||
{"LLVM_LINK_LLVM_DYLIB", "ON"},
|
|
||||||
{"LLVM_APPEND_VC_REV", "OFF"},
|
|
||||||
{"LLVM_ENABLE_RTTI", "ON"},
|
|
||||||
{"LLVM_ENABLE_ZLIB", "FORCE_ON"},
|
|
||||||
{"LLVM_ENABLE_ZSTD", "FORCE_ON"},
|
|
||||||
{"LLVM_ENABLE_PER_TARGET_RUNTIME_DIR", "ON"},
|
|
||||||
{"LLVM_INCLUDE_BENCHMARKS", "OFF"},
|
|
||||||
{"CLANG_DEFAULT_RTLIB", "compiler-rt"},
|
|
||||||
{"CLANG_DEFAULT_UNWINDLIB", "libunwind"},
|
|
||||||
{"CLANG_DEFAULT_CXX_STDLIB", "libc++"},
|
|
||||||
{"CLANG_CONFIG_FILE_SYSTEM_DIR", "/system/etc/clang"},
|
|
||||||
{"LLVM_ENABLE_FFI", "OFF"},
|
|
||||||
{"LLVM_ENABLE_LIBXML2", "OFF"},
|
|
||||||
{"LLVM_ENABLE_LIBCXX", "ON"},
|
|
||||||
{"LLVM_ENABLE_LLD", "ON"},
|
|
||||||
{"LIBUNWIND_ENABLE_ASSERTIONS", "OFF"},
|
|
||||||
{"LIBUNWIND_USE_COMPILER_RT", "ON"},
|
|
||||||
|
|
||||||
{"LLVM_HOST_TRIPLE", `"${ROSA_TRIPLE}"`},
|
{"LLVM_HOST_TRIPLE", `"${ROSA_TRIPLE}"`},
|
||||||
{"LLVM_DEFAULT_TARGET_TRIPLE", `"${ROSA_TRIPLE}"`},
|
{"LLVM_DEFAULT_TARGET_TRIPLE", `"${ROSA_TRIPLE}"`},
|
||||||
{"LLVM_ENABLE_PROJECTS", "'" + strings.Join([]string{
|
{"LLVM_ENABLE_RTTI", "ON"},
|
||||||
"clang",
|
{"LLVM_BUILD_LLVM_DYLIB", "ON"},
|
||||||
"lld",
|
{"LLVM_LINK_LLVM_DYLIB", "ON"},
|
||||||
}, ";") + "'"},
|
{"LLVM_ENABLE_RUNTIMES", "'libunwind;libcxx;libcxxabi'"},
|
||||||
{"LLVM_ENABLE_RUNTIMES", "'" + strings.Join([]string{
|
|
||||||
"compiler-rt",
|
{"LIBUNWIND_ENABLE_ASSERTIONS", "OFF"},
|
||||||
"libcxx",
|
{"LIBUNWIND_USE_COMPILER_RT", "ON"},
|
||||||
"libcxxabi",
|
{"LIBCXX_HAS_MUSL_LIBC", "ON"},
|
||||||
"libunwind",
|
{"LIBCXX_USE_COMPILER_RT", "ON"},
|
||||||
"libclc",
|
{"LIBCXX_CXX_ABI", "libcxxabi"},
|
||||||
}, ";") + "'"},
|
{"LIBCXX_ENABLE_STATIC_ABI_LIBRARY", "OFF"},
|
||||||
|
{"LIBCXX_HARDENING_MODE", "fast"},
|
||||||
|
{"LIBCXX_HAS_ATOMIC_LIB", "OFF"},
|
||||||
|
{"LIBCXXABI_USE_COMPILER_RT", "ON"},
|
||||||
|
{"LIBCXXABI_USE_LLVM_UNWINDER", "ON"},
|
||||||
|
{"LIBCXXABI_ENABLE_STATIC_UNWINDER", "OFF"},
|
||||||
|
{"LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL", "OFF"},
|
||||||
|
|
||||||
|
{"LLVM_ENABLE_ZLIB", "FORCE_ON"},
|
||||||
|
{"LLVM_ENABLE_ZSTD", "FORCE_ON"},
|
||||||
|
{"LLVM_ENABLE_LIBXML2", "OFF"},
|
||||||
|
},
|
||||||
|
SkipTest: true,
|
||||||
|
},
|
||||||
|
Python,
|
||||||
|
|
||||||
|
Zlib,
|
||||||
|
Zstd,
|
||||||
|
earlyCompilerRT,
|
||||||
|
KernelHeaders,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newEarlyRuntimes,
|
||||||
|
|
||||||
|
Name: "early-runtimes",
|
||||||
|
Description: "early LLVM runtimes: libunwind, libcxx, libcxxabi",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
earlyCompilerRT,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t Toolchain) newLLVM() (pkg.Artifact, string) {
|
||||||
|
early := muslHeaders
|
||||||
|
if t.stage.isStage0() {
|
||||||
|
// The LLVM build system uses the system installation when building with
|
||||||
|
// LLVM_LINK_LLVM_DYLIB, since it builds runtimes after the fact, using
|
||||||
|
// the just-built toolchain. This is unacceptable in stage0 due to the
|
||||||
|
// potential version difference. Later stages bootstrap off of runtimes
|
||||||
|
// of its previous stage via 3-stage determinism.
|
||||||
|
early = earlyRuntimes
|
||||||
|
}
|
||||||
|
|
||||||
|
cache := []KV{
|
||||||
|
{"ENABLE_LINKER_BUILD_ID", "ON"},
|
||||||
|
{"COMPILER_RT_USE_BUILTINS_LIBRARY", "ON"},
|
||||||
|
{"COMPILER_RT_DEFAULT_TARGET_ONLY", "ON"},
|
||||||
|
{"COMPILER_RT_BUILD_GWP_ASAN", "OFF"},
|
||||||
|
{"LIBCXX_CXX_ABI", "libcxxabi"},
|
||||||
|
{"LIBCXX_USE_COMPILER_RT", "ON"},
|
||||||
|
{"LIBCXX_ENABLE_STATIC_ABI_LIBRARY", "OFF"},
|
||||||
|
{"LIBCXX_HAS_MUSL_LIBC", "ON"},
|
||||||
|
{"LIBCXX_HARDENING_MODE", "fast"},
|
||||||
|
{"LIBCXXABI_USE_LLVM_UNWINDER", "ON"},
|
||||||
|
{"LIBCXXABI_ENABLE_STATIC_UNWINDER", "OFF"},
|
||||||
|
{"LIBCXXABI_USE_COMPILER_RT", "ON"},
|
||||||
|
{"LLVM_INSTALL_BINUTILS_SYMLINKS", "ON"},
|
||||||
|
{"LLVM_INSTALL_UTILS", "ON"},
|
||||||
|
{"LLVM_BUILD_LLVM_DYLIB", "ON"},
|
||||||
|
{"LLVM_LINK_LLVM_DYLIB", "ON"},
|
||||||
|
{"LLVM_APPEND_VC_REV", "OFF"},
|
||||||
|
{"LLVM_ENABLE_RTTI", "ON"},
|
||||||
|
{"LLVM_ENABLE_ZLIB", "FORCE_ON"},
|
||||||
|
{"LLVM_ENABLE_ZSTD", "FORCE_ON"},
|
||||||
|
{"LLVM_ENABLE_PER_TARGET_RUNTIME_DIR", "ON"},
|
||||||
|
{"LLVM_INCLUDE_BENCHMARKS", "OFF"},
|
||||||
|
{"CLANG_DEFAULT_RTLIB", "compiler-rt"},
|
||||||
|
{"CLANG_DEFAULT_UNWINDLIB", "libunwind"},
|
||||||
|
{"CLANG_DEFAULT_CXX_STDLIB", "libc++"},
|
||||||
|
{"CLANG_CONFIG_FILE_SYSTEM_DIR", "/system/etc/clang"},
|
||||||
|
{"LLVM_ENABLE_FFI", "OFF"},
|
||||||
|
{"LLVM_ENABLE_LIBXML2", "OFF"},
|
||||||
|
{"LLVM_ENABLE_LIBCXX", "ON"},
|
||||||
|
{"LLVM_ENABLE_LLD", "ON"},
|
||||||
|
{"LIBUNWIND_ENABLE_ASSERTIONS", "OFF"},
|
||||||
|
{"LIBUNWIND_USE_COMPILER_RT", "ON"},
|
||||||
|
|
||||||
|
{"LLVM_HOST_TRIPLE", `"${ROSA_TRIPLE}"`},
|
||||||
|
{"LLVM_DEFAULT_TARGET_TRIPLE", `"${ROSA_TRIPLE}"`},
|
||||||
|
{"LLVM_ENABLE_PROJECTS", "'" + strings.Join([]string{
|
||||||
|
"clang",
|
||||||
|
"lld",
|
||||||
|
}, ";") + "'"},
|
||||||
|
{"LLVM_ENABLE_RUNTIMES", "'" + strings.Join([]string{
|
||||||
|
"compiler-rt",
|
||||||
|
"libcxx",
|
||||||
|
"libcxxabi",
|
||||||
|
"libunwind",
|
||||||
|
"libclc",
|
||||||
|
}, ";") + "'"},
|
||||||
|
}
|
||||||
|
|
||||||
|
if !t.stage.isStage0() {
|
||||||
|
skipChecks := []string{
|
||||||
|
// expensive, pointless to run here
|
||||||
|
"benchmarks",
|
||||||
|
// LLVM ERROR: Tried to execute an unknown external function: roundevenf
|
||||||
|
"ExecutionEngine/Interpreter/intrinsics.ll",
|
||||||
|
// clang: deadlocks with LLVM_BUILD_LLVM_DYLIB
|
||||||
|
"crash-recovery-modules",
|
||||||
|
// clang: fatal error: '__config_site' file not found
|
||||||
|
"CodeGen/PowerPC/ppc-xmmintrin.c",
|
||||||
|
"CodeGen/PowerPC/ppc-mmintrin.c",
|
||||||
|
"CodeGen/PowerPC/ppc-emmintrin.c",
|
||||||
|
"CodeGen/PowerPC/ppc-pmmintrin.c",
|
||||||
|
"CodeGen/PowerPC/ppc-tmmintrin.c",
|
||||||
|
"CodeGen/PowerPC/ppc-smmintrin.c",
|
||||||
|
"CodeGenCUDA/amdgpu-alias-undef-symbols.cu",
|
||||||
|
// cxx: fails on musl
|
||||||
|
"close.dont-get-rid-of-buffer",
|
||||||
|
"re/re.traits",
|
||||||
|
"std/time",
|
||||||
|
"localization/locales",
|
||||||
|
"localization/locale.categories",
|
||||||
|
"selftest/dsl/dsl.sh.py",
|
||||||
|
"input.output/iostream.format",
|
||||||
|
"locale-specific_form",
|
||||||
|
// cxx: deadlocks
|
||||||
|
"std/thread/thread.jthread",
|
||||||
|
// unwind: fails on musl
|
||||||
|
"eh_frame_fde_pc_range",
|
||||||
|
}
|
||||||
|
switch t.arch {
|
||||||
|
case "arm64":
|
||||||
|
skipChecks = append(skipChecks,
|
||||||
|
// LLVM: intermittently crashes
|
||||||
|
"ExecutionEngine/OrcLazy/multiple-compile-threads-basic.ll",
|
||||||
|
// unwind: unexpectedly passes
|
||||||
|
"unwind_leaffunction",
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !t.stage.isStage0() {
|
if t.opts&OptLLVMNoLTO == 0 {
|
||||||
skipChecks := []string{
|
|
||||||
// expensive, pointless to run here
|
|
||||||
"benchmarks",
|
|
||||||
// LLVM ERROR: Tried to execute an unknown external function: roundevenf
|
|
||||||
"ExecutionEngine/Interpreter/intrinsics.ll",
|
|
||||||
// clang: deadlocks with LLVM_BUILD_LLVM_DYLIB
|
|
||||||
"crash-recovery-modules",
|
|
||||||
// clang: fatal error: '__config_site' file not found
|
|
||||||
"CodeGen/PowerPC/ppc-xmmintrin.c",
|
|
||||||
"CodeGen/PowerPC/ppc-mmintrin.c",
|
|
||||||
"CodeGen/PowerPC/ppc-emmintrin.c",
|
|
||||||
"CodeGen/PowerPC/ppc-pmmintrin.c",
|
|
||||||
"CodeGen/PowerPC/ppc-tmmintrin.c",
|
|
||||||
"CodeGen/PowerPC/ppc-smmintrin.c",
|
|
||||||
"CodeGenCUDA/amdgpu-alias-undef-symbols.cu",
|
|
||||||
// cxx: fails on musl
|
|
||||||
"close.dont-get-rid-of-buffer",
|
|
||||||
"re/re.traits",
|
|
||||||
"std/time",
|
|
||||||
"localization/locales",
|
|
||||||
"localization/locale.categories",
|
|
||||||
"selftest/dsl/dsl.sh.py",
|
|
||||||
"input.output/iostream.format",
|
|
||||||
"locale-specific_form",
|
|
||||||
// cxx: deadlocks
|
|
||||||
"std/thread/thread.jthread",
|
|
||||||
// unwind: fails on musl
|
|
||||||
"eh_frame_fde_pc_range",
|
|
||||||
}
|
|
||||||
switch t.arch {
|
|
||||||
case "arm64":
|
|
||||||
skipChecks = append(skipChecks,
|
|
||||||
// LLVM: intermittently crashes
|
|
||||||
"ExecutionEngine/OrcLazy/multiple-compile-threads-basic.ll",
|
|
||||||
// unwind: unexpectedly passes
|
|
||||||
"unwind_leaffunction",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if t.opts&OptLLVMNoLTO == 0 {
|
|
||||||
cache = append(cache, []KV{
|
|
||||||
// very expensive
|
|
||||||
{"LLVM_ENABLE_LTO", "Thin"},
|
|
||||||
}...)
|
|
||||||
}
|
|
||||||
|
|
||||||
cache = append(cache, []KV{
|
cache = append(cache, []KV{
|
||||||
// symbols: clock_gettime, mallopt
|
// very expensive
|
||||||
{"COMPILER_RT_INCLUDE_TESTS", "OFF"},
|
{"LLVM_ENABLE_LTO", "Thin"},
|
||||||
|
|
||||||
{"LLVM_BUILD_TESTS", "ON"},
|
|
||||||
{"LLVM_LIT_ARGS", litArgs(true, skipChecks...)},
|
|
||||||
}...)
|
}...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &meta, t.NewPackage("llvm", meta.Version, source, &PackageAttr{
|
cache = append(cache, []KV{
|
||||||
Flag: TExclusive,
|
// symbols: clock_gettime, mallopt
|
||||||
}, &CMakeHelper{
|
{"COMPILER_RT_INCLUDE_TESTS", "OFF"},
|
||||||
Append: []string{"llvm"},
|
|
||||||
|
|
||||||
Cache: cache,
|
{"LLVM_BUILD_TESTS", "ON"},
|
||||||
Script: `
|
{"LLVM_LIT_ARGS", litArgs(true, skipChecks...)},
|
||||||
|
}...)
|
||||||
|
}
|
||||||
|
|
||||||
|
source, version := t.Load(llvmSource)
|
||||||
|
return t.NewPackage("llvm", version, source, &PackageAttr{
|
||||||
|
Flag: TExclusive,
|
||||||
|
}, &CMakeHelper{
|
||||||
|
Append: []string{"llvm"},
|
||||||
|
|
||||||
|
Cache: cache,
|
||||||
|
Script: `
|
||||||
ln -s ld.lld /work/system/bin/ld
|
ln -s ld.lld /work/system/bin/ld
|
||||||
ln -s clang /work/system/bin/cc
|
ln -s clang /work/system/bin/cc
|
||||||
ln -s clang /work/system/bin/cpp
|
ln -s clang /work/system/bin/cpp
|
||||||
ln -s clang++ /work/system/bin/c++
|
ln -s clang++ /work/system/bin/c++
|
||||||
`,
|
`,
|
||||||
|
|
||||||
// LLVM_LINK_LLVM_DYLIB causes llvm test suite to leak system
|
// LLVM_LINK_LLVM_DYLIB causes llvm test suite to leak system
|
||||||
// installation into test environment, and the tests end up testing the
|
// installation into test environment, and the tests end up testing the
|
||||||
// system installation instead. Tests are disabled on stage0 and relies
|
// system installation instead. Tests are disabled on stage0 and relies
|
||||||
// on 3-stage determinism to test later stages.
|
// on 3-stage determinism to test later stages.
|
||||||
SkipTest: t.stage.isStage0(),
|
SkipTest: t.stage.isStage0(),
|
||||||
|
|
||||||
Test: `
|
Test: `
|
||||||
chmod +w /bin && ln -s \
|
chmod +w /bin && ln -s \
|
||||||
../system/bin/chmod \
|
../system/bin/chmod \
|
||||||
../system/bin/mkdir \
|
../system/bin/mkdir \
|
||||||
@@ -368,20 +303,53 @@ chmod +w /bin && ln -s \
|
|||||||
/bin
|
/bin
|
||||||
ninja ` + jobsFlagE + ` check-all
|
ninja ` + jobsFlagE + ` check-all
|
||||||
`,
|
`,
|
||||||
|
},
|
||||||
|
Python,
|
||||||
|
Perl,
|
||||||
|
Diffutils,
|
||||||
|
Bash,
|
||||||
|
Gawk,
|
||||||
|
Coreutils,
|
||||||
|
Findutils,
|
||||||
|
|
||||||
|
Zlib,
|
||||||
|
Zstd,
|
||||||
|
early,
|
||||||
|
KernelHeaders,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
const (
|
||||||
|
version = "22.1.5"
|
||||||
|
checksum = "32gOaLPHcUlo3hkdk5RbFumTE01XKeCAYZcpvn8IDHF95egXVfDFSl6eZL3ChMen"
|
||||||
|
)
|
||||||
|
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: func(t Toolchain) (pkg.Artifact, string) {
|
||||||
|
return t.NewPatchedSource("llvm", version, newFromGitHub(
|
||||||
|
"llvm/llvm-project",
|
||||||
|
"llvmorg-"+version,
|
||||||
|
checksum,
|
||||||
|
), true, llvmPatches...), version
|
||||||
},
|
},
|
||||||
_python,
|
|
||||||
_perl,
|
|
||||||
_diffutils,
|
|
||||||
_bash,
|
|
||||||
_gawk,
|
|
||||||
_coreutils,
|
|
||||||
_findutils,
|
|
||||||
|
|
||||||
_zlib,
|
Name: "llvm-project",
|
||||||
_zstd,
|
Description: "LLVM monorepo with Rosa OS patches",
|
||||||
early,
|
|
||||||
_kernelHeaders,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
ID: 1830,
|
||||||
|
})
|
||||||
|
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLLVM,
|
||||||
|
|
||||||
|
Name: "llvm",
|
||||||
|
Description: "a collection of modular and reusable compiler and toolchain technologies",
|
||||||
|
Website: "https://llvm.org",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
Zlib,
|
||||||
|
Zstd,
|
||||||
|
Musl,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,96 @@
|
|||||||
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
|
package rosa
|
||||||
|
|
||||||
|
// llvmPatches are centralised patches against latest LLVM monorepo.
|
||||||
|
var llvmPatches = []KV{
|
||||||
|
{"increase-stack-size-unconditional", `diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp
|
||||||
|
index 9da357a7ebb9..b2931510c1ae 100644
|
||||||
|
--- a/llvm/lib/Support/Threading.cpp
|
||||||
|
+++ b/llvm/lib/Support/Threading.cpp
|
||||||
|
@@ -80,7 +80,7 @@ unsigned llvm::ThreadPoolStrategy::compute_thread_count() const {
|
||||||
|
// keyword.
|
||||||
|
#include "llvm/Support/thread.h"
|
||||||
|
|
||||||
|
-#if defined(__APPLE__)
|
||||||
|
+#if defined(__APPLE__) || 1
|
||||||
|
// Darwin's default stack size for threads except the main one is only 512KB,
|
||||||
|
// which is not enough for some/many normal LLVM compilations. This implements
|
||||||
|
// the same interface as std::thread but requests the same stack size as the
|
||||||
|
`},
|
||||||
|
|
||||||
|
{"add-rosa-vendor", `diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h
|
||||||
|
index 9c83abeeb3b1..5acfe5836a23 100644
|
||||||
|
--- a/llvm/include/llvm/TargetParser/Triple.h
|
||||||
|
+++ b/llvm/include/llvm/TargetParser/Triple.h
|
||||||
|
@@ -190,6 +190,7 @@ public:
|
||||||
|
|
||||||
|
Apple,
|
||||||
|
PC,
|
||||||
|
+ Rosa,
|
||||||
|
SCEI,
|
||||||
|
Freescale,
|
||||||
|
IBM,
|
||||||
|
diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp
|
||||||
|
index a4f9dd42c0fe..cb5a12387034 100644
|
||||||
|
--- a/llvm/lib/TargetParser/Triple.cpp
|
||||||
|
+++ b/llvm/lib/TargetParser/Triple.cpp
|
||||||
|
@@ -279,6 +279,7 @@ StringRef Triple::getVendorTypeName(VendorType Kind) {
|
||||||
|
case NVIDIA: return "nvidia";
|
||||||
|
case OpenEmbedded: return "oe";
|
||||||
|
case PC: return "pc";
|
||||||
|
+ case Rosa: return "rosa";
|
||||||
|
case SCEI: return "scei";
|
||||||
|
case SUSE: return "suse";
|
||||||
|
case Meta:
|
||||||
|
@@ -689,6 +690,7 @@ static Triple::VendorType parseVendor(StringRef VendorName) {
|
||||||
|
return StringSwitch<Triple::VendorType>(VendorName)
|
||||||
|
.Case("apple", Triple::Apple)
|
||||||
|
.Case("pc", Triple::PC)
|
||||||
|
+ .Case("rosa", Triple::Rosa)
|
||||||
|
.Case("scei", Triple::SCEI)
|
||||||
|
.Case("sie", Triple::SCEI)
|
||||||
|
.Case("fsl", Triple::Freescale)
|
||||||
|
`},
|
||||||
|
|
||||||
|
{"xfail-broken-tests", `diff --git a/clang/test/Modules/timestamps.c b/clang/test/Modules/timestamps.c
|
||||||
|
index 50fdce630255..4b4465a75617 100644
|
||||||
|
--- a/clang/test/Modules/timestamps.c
|
||||||
|
+++ b/clang/test/Modules/timestamps.c
|
||||||
|
@@ -1,3 +1,5 @@
|
||||||
|
+// XFAIL: target={{.*-rosa-linux-musl}}
|
||||||
|
+
|
||||||
|
/// Verify timestamps that gets embedded in the module
|
||||||
|
#include <c-header.h>
|
||||||
|
|
||||||
|
`},
|
||||||
|
|
||||||
|
{"path-system-include", `diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
|
||||||
|
index 8ac8d4eb9181..e46b04a898ca 100644
|
||||||
|
--- a/clang/lib/Driver/ToolChains/Linux.cpp
|
||||||
|
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
|
||||||
|
@@ -671,6 +671,12 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
|
||||||
|
addExternCSystemInclude(
|
||||||
|
DriverArgs, CC1Args,
|
||||||
|
concat(SysRoot, "/usr/include", MultiarchIncludeDir));
|
||||||
|
+ if (!MultiarchIncludeDir.empty() &&
|
||||||
|
+ D.getVFS().exists(concat(SysRoot, "/system/include", MultiarchIncludeDir)))
|
||||||
|
+ addExternCSystemInclude(
|
||||||
|
+ DriverArgs, CC1Args,
|
||||||
|
+ concat(SysRoot, "/system/include", MultiarchIncludeDir));
|
||||||
|
+
|
||||||
|
|
||||||
|
if (getTriple().getOS() == llvm::Triple::RTEMS)
|
||||||
|
return;
|
||||||
|
@@ -681,6 +687,7 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
|
||||||
|
addExternCSystemInclude(DriverArgs, CC1Args, concat(SysRoot, "/include"));
|
||||||
|
|
||||||
|
addExternCSystemInclude(DriverArgs, CC1Args, concat(SysRoot, "/usr/include"));
|
||||||
|
+ addExternCSystemInclude(DriverArgs, CC1Args, concat(SysRoot, "/system/include"));
|
||||||
|
|
||||||
|
if (!DriverArgs.hasArg(options::OPT_nobuiltininc) && getTriple().isMusl())
|
||||||
|
addSystemInclude(DriverArgs, CC1Args, ResourceDirInclude);
|
||||||
|
`},
|
||||||
|
|
||||||
|
{"path-system-libraries", `diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
|
||||||
index cb6a9b242421..b8d31690d1af 100644
|
index cb6a9b242421..b8d31690d1af 100644
|
||||||
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
|
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
|
||||||
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
|
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
|
||||||
@@ -86,3 +178,5 @@ index d525b417b4ea..2b93f401733e 100644
|
|||||||
std::string ArchName;
|
std::string ArchName;
|
||||||
bool IsArm = false;
|
bool IsArm = false;
|
||||||
|
|
||||||
|
`},
|
||||||
|
}
|
||||||
59
internal/rosa/lm-sensors.go
Normal file
59
internal/rosa/lm-sensors.go
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newLMSensors() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "3-6-2"
|
||||||
|
checksum = "7JYNutrihe-FP6r3ftf96uFZJJWPfxnBHL0ALSMA-vovaXVRr-sAjlLitw7WWpCI"
|
||||||
|
)
|
||||||
|
return t.NewPackage("lm_sensors", version, newFromGitHub(
|
||||||
|
"lm-sensors/lm-sensors",
|
||||||
|
"V"+version,
|
||||||
|
checksum,
|
||||||
|
), &PackageAttr{
|
||||||
|
Writable: true,
|
||||||
|
Chmod: true,
|
||||||
|
EnterSource: true,
|
||||||
|
|
||||||
|
ScriptEarly: `
|
||||||
|
ln -s \
|
||||||
|
../../system/bin/perl \
|
||||||
|
/usr/bin/
|
||||||
|
`,
|
||||||
|
}, &MakeHelper{
|
||||||
|
InPlace: true,
|
||||||
|
SkipConfigure: true,
|
||||||
|
|
||||||
|
Make: []string{
|
||||||
|
"CC=cc",
|
||||||
|
"ETCDIR=/system/etc",
|
||||||
|
"PREFIX=/system",
|
||||||
|
},
|
||||||
|
|
||||||
|
Check: []string{
|
||||||
|
"CC=cc",
|
||||||
|
"check",
|
||||||
|
},
|
||||||
|
|
||||||
|
Install: "make DESTDIR=/work PREFIX=/system install",
|
||||||
|
},
|
||||||
|
Perl,
|
||||||
|
PerlTestCmd,
|
||||||
|
|
||||||
|
M4,
|
||||||
|
Bison,
|
||||||
|
Flex,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLMSensors,
|
||||||
|
|
||||||
|
Name: "lm_sensors",
|
||||||
|
Description: "user-space support for hardware monitoring drivers",
|
||||||
|
Website: "https://hwmon.wiki.kernel.org/lm_sensors",
|
||||||
|
|
||||||
|
ID: 1831,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -3,9 +3,40 @@ package rosa
|
|||||||
import (
|
import (
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"hakurei.app/internal/pkg"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _make = H("make")
|
func (t Toolchain) newMake() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "4.4.1"
|
||||||
|
checksum = "YS_B07ZcAy9PbaK5_vKGj64SrxO2VMpnMKfc9I0Q9IC1rn0RwOH7802pJoj2Mq4a"
|
||||||
|
)
|
||||||
|
return t.New("make-"+version, TEarly, nil, nil, nil, `
|
||||||
|
cd "$(mktemp -d)"
|
||||||
|
/usr/src/make/configure \
|
||||||
|
--prefix=/system \
|
||||||
|
--build="${ROSA_TRIPLE}" \
|
||||||
|
--disable-dependency-tracking
|
||||||
|
./build.sh
|
||||||
|
./make DESTDIR=/work install
|
||||||
|
`, pkg.Path(AbsUsrSrc.Append("make"), false, newTar(
|
||||||
|
"https://ftpmirror.gnu.org/gnu/make/make-"+version+".tar.gz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
))), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newMake,
|
||||||
|
|
||||||
|
Name: "make",
|
||||||
|
Description: "a tool which controls the generation of executables and other non-source files",
|
||||||
|
Website: "https://www.gnu.org/software/make/",
|
||||||
|
|
||||||
|
ID: 1877,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// MakeHelper is the [Make] build system helper.
|
// MakeHelper is the [Make] build system helper.
|
||||||
type MakeHelper struct {
|
type MakeHelper struct {
|
||||||
@@ -39,8 +70,6 @@ type MakeHelper struct {
|
|||||||
Make []string
|
Make []string
|
||||||
// Whether to skip the check target.
|
// Whether to skip the check target.
|
||||||
SkipCheck bool
|
SkipCheck bool
|
||||||
// Whether to skip the check target during stage0.
|
|
||||||
SkipCheckEarly bool
|
|
||||||
// Name of the check target, zero value is equivalent to "check".
|
// Name of the check target, zero value is equivalent to "check".
|
||||||
Check []string
|
Check []string
|
||||||
// Replaces the default install command.
|
// Replaces the default install command.
|
||||||
@@ -51,11 +80,11 @@ var _ Helper = new(MakeHelper)
|
|||||||
|
|
||||||
// extra returns make and other optional dependencies.
|
// extra returns make and other optional dependencies.
|
||||||
func (attr *MakeHelper) extra(flag int) P {
|
func (attr *MakeHelper) extra(flag int) P {
|
||||||
extra := P{_make}
|
extra := P{Make}
|
||||||
if (attr == nil || !attr.OmitDefaults) && flag&TEarly == 0 {
|
if (attr == nil || !attr.OmitDefaults) && flag&TEarly == 0 {
|
||||||
extra = append(extra,
|
extra = append(extra,
|
||||||
_gawk,
|
Gawk,
|
||||||
_coreutils,
|
Coreutils,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return extra
|
return extra
|
||||||
@@ -82,16 +111,19 @@ func (attr *MakeHelper) scriptEarly() string {
|
|||||||
return generate
|
return generate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// createDir returns false.
|
||||||
|
func (*MakeHelper) createDir() bool { return false }
|
||||||
|
|
||||||
// wantsDir requests a new directory in TMPDIR, or omits the cd statement if InPlace.
|
// wantsDir requests a new directory in TMPDIR, or omits the cd statement if InPlace.
|
||||||
func (attr *MakeHelper) wantsDir() (string, bool) {
|
func (attr *MakeHelper) wantsDir() string {
|
||||||
if attr != nil && attr.InPlace {
|
if attr != nil && attr.InPlace {
|
||||||
return helperInPlace, false
|
return helperInPlace
|
||||||
}
|
}
|
||||||
return `"$(mktemp -d)"`, false
|
return `"$(mktemp -d)"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// script generates the cure script.
|
// script generates the cure script.
|
||||||
func (attr *MakeHelper) script(t Toolchain, name string) string {
|
func (attr *MakeHelper) script(s *S, name string) string {
|
||||||
if attr == nil {
|
if attr == nil {
|
||||||
attr = new(MakeHelper)
|
attr = new(MakeHelper)
|
||||||
}
|
}
|
||||||
@@ -162,8 +194,7 @@ make \
|
|||||||
}
|
}
|
||||||
scriptMake += "\n"
|
scriptMake += "\n"
|
||||||
|
|
||||||
if !attr.SkipCheck && t.opts&OptSkipCheck == 0 &&
|
if !attr.SkipCheck && s.opts&OptSkipCheck == 0 {
|
||||||
(!attr.SkipCheckEarly || !t.stage.isStage0()) {
|
|
||||||
scriptMake += attr.ScriptCheckEarly + `make \
|
scriptMake += attr.ScriptCheckEarly + `make \
|
||||||
` + jobsFlagE + ` \
|
` + jobsFlagE + ` \
|
||||||
`
|
`
|
||||||
|
|||||||
265
internal/rosa/mesa.go
Normal file
265
internal/rosa/mesa.go
Normal file
@@ -0,0 +1,265 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"hakurei.app/internal/pkg"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (t Toolchain) newLibglvnd() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "1.7.0"
|
||||||
|
checksum = "eIQJK2sgFQDHdeFkQO87TrSUaZRFG4y2DrwA8Ut-sGboI59uw1OOiIVqq2AIwnGY"
|
||||||
|
)
|
||||||
|
return t.NewPackage("libglvnd", version, newFromGitLab(
|
||||||
|
"gitlab.freedesktop.org",
|
||||||
|
"glvnd/libglvnd",
|
||||||
|
"v"+version,
|
||||||
|
checksum,
|
||||||
|
), nil, &MesonHelper{
|
||||||
|
Setup: []KV{
|
||||||
|
{"Dx11", "enabled"},
|
||||||
|
{"Dglx", "enabled"},
|
||||||
|
},
|
||||||
|
ScriptCompiled: `
|
||||||
|
export DISPLAY=':0'
|
||||||
|
Xvfb &
|
||||||
|
XVFB_PID="$!"
|
||||||
|
trap 'kill $XVFB_PID && wait $XVFB_PID' EXIT
|
||||||
|
`,
|
||||||
|
},
|
||||||
|
Binutils, // symbols check fail with llvm nm
|
||||||
|
Xserver, // test suite wants X server
|
||||||
|
|
||||||
|
LibXext,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLibglvnd,
|
||||||
|
|
||||||
|
Name: "libglvnd",
|
||||||
|
Description: "The GL Vendor-Neutral Dispatch library",
|
||||||
|
Website: "https://gitlab.freedesktop.org/glvnd/libglvnd",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
LibXext,
|
||||||
|
},
|
||||||
|
|
||||||
|
ID: 12098,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t Toolchain) newLibdrm() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "2.4.133"
|
||||||
|
checksum = "bfj296NcR9DndO11hqDbSRFPqaweSLMqRk3dlCPZpM6FONX1WZ9J4JdbTDMUd1rU"
|
||||||
|
)
|
||||||
|
return t.NewPackage("libdrm", version, newFromGitLab(
|
||||||
|
"gitlab.freedesktop.org",
|
||||||
|
"mesa/libdrm",
|
||||||
|
"libdrm-"+version,
|
||||||
|
checksum,
|
||||||
|
), nil, &MesonHelper{
|
||||||
|
Setup: []KV{
|
||||||
|
{"Dintel", "enabled"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Binutils, // symbols check fail with llvm nm
|
||||||
|
|
||||||
|
Libpciaccess,
|
||||||
|
KernelHeaders,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLibdrm,
|
||||||
|
|
||||||
|
Name: "libdrm",
|
||||||
|
Description: "a userspace library for accessing the DRM",
|
||||||
|
Website: "https://dri.freedesktop.org/",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
Libpciaccess,
|
||||||
|
},
|
||||||
|
|
||||||
|
ID: 1596,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t Toolchain) newLibva() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "2.23.0"
|
||||||
|
checksum = "UmF5tPyWIG_w5kiR3KFpoYbF7UUcaak5tyc-RhOheNTwQlLkPlifreFYCM9FQxbq"
|
||||||
|
)
|
||||||
|
return t.NewPackage("libva", version, newFromGitHub(
|
||||||
|
"intel/libva",
|
||||||
|
version,
|
||||||
|
checksum,
|
||||||
|
), nil, &MesonHelper{
|
||||||
|
Setup: []KV{
|
||||||
|
{"Dwith_x11", "yes"},
|
||||||
|
{"Dwith_glx", "yes"},
|
||||||
|
{"Dwith_wayland", "yes"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Libdrm,
|
||||||
|
LibXfixes,
|
||||||
|
Libglvnd,
|
||||||
|
Wayland,
|
||||||
|
KernelHeaders,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLibva,
|
||||||
|
|
||||||
|
Name: "libva",
|
||||||
|
Description: "an implementation for VA-API (Video Acceleration API)",
|
||||||
|
Website: "https://01.org/vaapi",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
Libdrm,
|
||||||
|
LibXfixes,
|
||||||
|
Libglvnd,
|
||||||
|
Wayland,
|
||||||
|
},
|
||||||
|
|
||||||
|
ID: 1752,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t Toolchain) newMesa() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "26.1.0"
|
||||||
|
checksum = "zU0fjqevySBaoi_5SLW3e2UffmGeBdxOuHmAHTH68n2hV-sjYoqg30koLqFXuk5y"
|
||||||
|
)
|
||||||
|
return t.NewPackage("mesa", version, newFromGitLab(
|
||||||
|
"gitlab.freedesktop.org",
|
||||||
|
"mesa/mesa",
|
||||||
|
"mesa-"+version,
|
||||||
|
checksum,
|
||||||
|
), nil, &MesonHelper{
|
||||||
|
Setup: []KV{
|
||||||
|
{"Dplatforms", "x11,wayland"},
|
||||||
|
{"Dvideo-codecs", "all"},
|
||||||
|
|
||||||
|
{"Dglvnd", "enabled"},
|
||||||
|
{"Dgbm", "enabled"},
|
||||||
|
|
||||||
|
{"Dgallium-drivers", strings.Join([]string{
|
||||||
|
"asahi", // Apple AGX
|
||||||
|
"crocus", // Intel legacy
|
||||||
|
"etnaviv", // Vivante GPU designs (mostly NXP/Marvell SoCs)
|
||||||
|
"freedreno", // Qualcomm Adreno (all Qualcomm SoCs)
|
||||||
|
"i915", // Intel extra legacy
|
||||||
|
"iris", // new Intel (Broadwell+)
|
||||||
|
"lima", // ARM Mali 4xx
|
||||||
|
"llvmpipe", // software renderer
|
||||||
|
"nouveau", // Nvidia
|
||||||
|
"panfrost", // ARM Mali Midgard and up (T/G series)
|
||||||
|
"r300", // very old AMD
|
||||||
|
"r600", // less old AMD
|
||||||
|
"radeonsi", // new AMD (GCN+)
|
||||||
|
"softpipe", // older software renderer
|
||||||
|
"svga", // VMWare virtualized GPU
|
||||||
|
"tegra", // Nvidia Tegra SoCs
|
||||||
|
"v3d", // Broadcom VC5 (Raspberry Pi 4)
|
||||||
|
"vc4", // Broadcom VC4 (Raspberry Pi 0-3)
|
||||||
|
"virgl", // QEMU virtualized GPU (aka VirGL)
|
||||||
|
"zink", // generic OpenGL over Vulkan, experimental
|
||||||
|
|
||||||
|
// d3d12: WSL emulated GPU (aka Dozen)
|
||||||
|
// ethosu: accelerator
|
||||||
|
// rocket: accelerator
|
||||||
|
}, ",")},
|
||||||
|
|
||||||
|
{"Dvulkan-drivers", strings.Join([]string{
|
||||||
|
"amd", // AMD (aka RADV)
|
||||||
|
"broadcom", // Broadcom VC5 (Raspberry Pi 4, aka V3D)
|
||||||
|
"freedreno", // Qualcomm Adreno (all Qualcomm SoCs)
|
||||||
|
"intel", // new Intel (aka ANV)
|
||||||
|
"intel_hasvk", // Intel Haswell/Broadwell, "legacy" Vulkan driver (https://www.phoronix.com/news/Intel-HasVK-Drop-Dead-Code)
|
||||||
|
"panfrost", // ARM Mali Midgard and up (T/G series)
|
||||||
|
"swrast", // software renderer (aka Lavapipe)
|
||||||
|
"virtio", // QEMU virtualized GPU (aka VirGL)
|
||||||
|
"imagination", // PowerVR Rogue
|
||||||
|
"asahi", // Apple AGX
|
||||||
|
"gfxstream", // Android virtualized GPU
|
||||||
|
|
||||||
|
// nouveau: Nouveau (aka NVK), requires rust
|
||||||
|
// microsoft-experimental: WSL virtualized GPU (aka DZN/Dozen)
|
||||||
|
// kosmickrisp: macOS-specific
|
||||||
|
}, ",")},
|
||||||
|
{"Dvulkan-layers", strings.Join([]string{
|
||||||
|
"device-select",
|
||||||
|
"intel-nullhw",
|
||||||
|
"overlay",
|
||||||
|
"screenshot",
|
||||||
|
"anti-lag",
|
||||||
|
"vram-report-limit",
|
||||||
|
}, ",")},
|
||||||
|
|
||||||
|
{"Dfreedreno-kmds", "msm,virtio"},
|
||||||
|
{"Damdgpu-virtio", "true"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
M4,
|
||||||
|
PythonPackaging,
|
||||||
|
PythonMako,
|
||||||
|
PythonPyYAML,
|
||||||
|
PythonPycparser,
|
||||||
|
Glslang,
|
||||||
|
SPIRVLLVMTranslator,
|
||||||
|
|
||||||
|
Zlib,
|
||||||
|
Zstd,
|
||||||
|
Gzip,
|
||||||
|
Ncurses,
|
||||||
|
Libglvnd,
|
||||||
|
Libexpat,
|
||||||
|
Libva,
|
||||||
|
Libdrm,
|
||||||
|
Elfutils,
|
||||||
|
Bison,
|
||||||
|
Flex,
|
||||||
|
LMSensors,
|
||||||
|
Libconfig,
|
||||||
|
LibdisplayInfo,
|
||||||
|
Wayland,
|
||||||
|
WaylandProtocols,
|
||||||
|
Libxshmfence,
|
||||||
|
LibXxf86vm,
|
||||||
|
LibXrandr,
|
||||||
|
LibxcbUtilKeysyms,
|
||||||
|
Libpng,
|
||||||
|
Libarchive,
|
||||||
|
KernelHeaders,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newMesa,
|
||||||
|
|
||||||
|
Name: "mesa",
|
||||||
|
Description: "open source implementations of OpenGL, OpenGL ES, Vulkan, OpenCL, and more",
|
||||||
|
Website: "https://mesa3d.org",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
Libdrm,
|
||||||
|
Elfutils,
|
||||||
|
LMSensors,
|
||||||
|
LibdisplayInfo,
|
||||||
|
Wayland,
|
||||||
|
Libxshmfence,
|
||||||
|
LibXxf86vm,
|
||||||
|
LibXrandr,
|
||||||
|
LibxcbUtilKeysyms,
|
||||||
|
Libpng,
|
||||||
|
},
|
||||||
|
|
||||||
|
ID: 1970,
|
||||||
|
|
||||||
|
latest: (*Versions).getStable,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -3,9 +3,72 @@ package rosa
|
|||||||
import (
|
import (
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"hakurei.app/internal/pkg"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _meson = H("meson")
|
func (t Toolchain) newMeson() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "1.11.1"
|
||||||
|
checksum = "uvILRxdopwc6Dy17UbIeClcQr0qHqyTaqyk1M9OqWKN9PwB9N6UVAiyN8kSSz3r2"
|
||||||
|
)
|
||||||
|
return t.NewPackage("meson", version, newFromGitHub(
|
||||||
|
"mesonbuild/meson",
|
||||||
|
version,
|
||||||
|
checksum,
|
||||||
|
), &PackageAttr{
|
||||||
|
Env: []string{
|
||||||
|
"CMAKE_MAKE_PROGRAM=ninja",
|
||||||
|
},
|
||||||
|
}, &PipHelper{
|
||||||
|
EnterSource: true,
|
||||||
|
Check: `
|
||||||
|
cd 'test cases'
|
||||||
|
rm -rf \
|
||||||
|
'common/32 has header' \
|
||||||
|
'common/66 vcstag' \
|
||||||
|
'common/153 wrap file should not failed' \
|
||||||
|
'common/184 openmp' \
|
||||||
|
'common/189 check header' \
|
||||||
|
'linuxlike/6 subdir include order' \
|
||||||
|
'linuxlike/9 compiler checks with dependencies' \
|
||||||
|
'linuxlike/13 cmake dependency' \
|
||||||
|
'frameworks/15 llvm' \
|
||||||
|
'frameworks/29 blocks'
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
python3 ./run_project_tests.py \
|
||||||
|
-v \
|
||||||
|
` + jobsFlagE + ` \
|
||||||
|
--failfast \
|
||||||
|
--backend=ninja
|
||||||
|
`,
|
||||||
|
},
|
||||||
|
PythonSetuptools,
|
||||||
|
PkgConfig,
|
||||||
|
CMake,
|
||||||
|
Ninja,
|
||||||
|
PythonPyTest,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newMeson,
|
||||||
|
|
||||||
|
Name: "meson",
|
||||||
|
Description: "an open source build system",
|
||||||
|
Website: "https://mesonbuild.com/",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
Python,
|
||||||
|
PkgConfig,
|
||||||
|
CMake,
|
||||||
|
Ninja,
|
||||||
|
},
|
||||||
|
|
||||||
|
ID: 6472,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// MesonHelper is the [Meson] build system helper.
|
// MesonHelper is the [Meson] build system helper.
|
||||||
type MesonHelper struct {
|
type MesonHelper struct {
|
||||||
@@ -25,7 +88,7 @@ type MesonHelper struct {
|
|||||||
var _ Helper = new(MesonHelper)
|
var _ Helper = new(MesonHelper)
|
||||||
|
|
||||||
// extra returns hardcoded meson runtime dependencies.
|
// extra returns hardcoded meson runtime dependencies.
|
||||||
func (*MesonHelper) extra(int) P { return P{_meson} }
|
func (*MesonHelper) extra(int) P { return P{Meson} }
|
||||||
|
|
||||||
// wantsChmod returns false.
|
// wantsChmod returns false.
|
||||||
func (*MesonHelper) wantsChmod() bool { return false }
|
func (*MesonHelper) wantsChmod() bool { return false }
|
||||||
@@ -36,11 +99,14 @@ func (*MesonHelper) wantsWrite() bool { return false }
|
|||||||
// scriptEarly returns the zero value.
|
// scriptEarly returns the zero value.
|
||||||
func (*MesonHelper) scriptEarly() string { return "" }
|
func (*MesonHelper) scriptEarly() string { return "" }
|
||||||
|
|
||||||
|
// createDir returns false.
|
||||||
|
func (*MesonHelper) createDir() bool { return false }
|
||||||
|
|
||||||
// wantsDir requests a new directory in TMPDIR.
|
// wantsDir requests a new directory in TMPDIR.
|
||||||
func (*MesonHelper) wantsDir() (string, bool) { return `"$(mktemp -d)"`, false }
|
func (*MesonHelper) wantsDir() string { return `"$(mktemp -d)"` }
|
||||||
|
|
||||||
// script generates the cure script.
|
// script generates the cure script.
|
||||||
func (attr *MesonHelper) script(t Toolchain, name string) string {
|
func (attr *MesonHelper) script(s *S, name string) string {
|
||||||
if attr == nil {
|
if attr == nil {
|
||||||
attr = new(MesonHelper)
|
attr = new(MesonHelper)
|
||||||
}
|
}
|
||||||
@@ -51,7 +117,7 @@ func (attr *MesonHelper) script(t Toolchain, name string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var scriptTest string
|
var scriptTest string
|
||||||
if !attr.SkipTest && t.opts&OptSkipCheck == 0 {
|
if !attr.SkipTest && s.opts&OptSkipCheck == 0 {
|
||||||
scriptTest = `
|
scriptTest = `
|
||||||
meson test \
|
meson test \
|
||||||
--print-errorlogs`
|
--print-errorlogs`
|
||||||
|
|||||||
48
internal/rosa/mksh.go
Normal file
48
internal/rosa/mksh.go
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newMksh() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "59c"
|
||||||
|
checksum = "0Zj-k4nXEu3IuJY4lvwD2OrC2t27GdZj8SPy4DoaeuBRH1padWb7oREpYgwY8JNq"
|
||||||
|
)
|
||||||
|
scriptTest := "./test.sh -C regress:no-ctty\n"
|
||||||
|
if t.opts&OptSkipCheck != 0 {
|
||||||
|
scriptTest = ""
|
||||||
|
}
|
||||||
|
return t.New("mksh-"+version, 0, t.Append(nil,
|
||||||
|
Perl,
|
||||||
|
Coreutils,
|
||||||
|
), nil, []string{
|
||||||
|
"LDSTATIC=-static",
|
||||||
|
"CPPFLAGS=-DMKSH_DEFAULT_PROFILEDIR=\\\"/system/etc\\\"",
|
||||||
|
}, `
|
||||||
|
cd "$(mktemp -d)"
|
||||||
|
sh /usr/src/mksh/Build.sh -r
|
||||||
|
CPPFLAGS="${CPPFLAGS} -DMKSH_BINSHPOSIX -DMKSH_BINSHREDUCED" \
|
||||||
|
sh /usr/src/mksh/Build.sh -r -L
|
||||||
|
`+scriptTest+`
|
||||||
|
mkdir -p /work/system/bin/
|
||||||
|
cp -v mksh /work/system/bin/
|
||||||
|
cp -v lksh /work/system/bin/sh
|
||||||
|
|
||||||
|
mkdir -p /work/bin/
|
||||||
|
ln -vs ../system/bin/sh /work/bin/
|
||||||
|
`, pkg.Path(AbsUsrSrc.Append("mksh"), false, newTar(
|
||||||
|
"https://mbsd.evolvis.org/MirOS/dist/mir/mksh/mksh-R"+version+".tgz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
))), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newMksh,
|
||||||
|
|
||||||
|
Name: "mksh",
|
||||||
|
Description: "MirBSD Korn Shell",
|
||||||
|
Website: "https://www.mirbsd.org/mksh",
|
||||||
|
|
||||||
|
ID: 5590,
|
||||||
|
})
|
||||||
|
}
|
||||||
36
internal/rosa/musl-fts.go
Normal file
36
internal/rosa/musl-fts.go
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newMuslFts() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "1.2.7"
|
||||||
|
checksum = "N_p_ZApX3eHt7xoDCw1hLf6XdJOw7ZSx7xPvpvAP0knG2zgU0zeN5w8tt5Pg60XJ"
|
||||||
|
)
|
||||||
|
return t.NewPackage("musl-fts", version, newFromGitHub(
|
||||||
|
"void-linux/musl-fts",
|
||||||
|
"v"+version,
|
||||||
|
checksum,
|
||||||
|
), &PackageAttr{
|
||||||
|
Env: []string{
|
||||||
|
"CC=cc -fPIC",
|
||||||
|
},
|
||||||
|
}, &MakeHelper{
|
||||||
|
Generate: "./bootstrap.sh",
|
||||||
|
},
|
||||||
|
Automake,
|
||||||
|
Libtool,
|
||||||
|
PkgConfig,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newMuslFts,
|
||||||
|
|
||||||
|
Name: "musl-fts",
|
||||||
|
Description: "implementation of fts(3) functions which are missing in musl libc",
|
||||||
|
Website: "https://github.com/void-linux/musl-fts",
|
||||||
|
|
||||||
|
ID: 26980,
|
||||||
|
})
|
||||||
|
}
|
||||||
36
internal/rosa/musl-obstack.go
Normal file
36
internal/rosa/musl-obstack.go
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newMuslObstack() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "1.2.3"
|
||||||
|
checksum = "tVRY_KjIlkkMszcaRlkKdBVQHIXTT_T_TiMxbwErlILXrOBosocg8KklppZhNdCG"
|
||||||
|
)
|
||||||
|
return t.NewPackage("musl-obstack", version, newFromGitHub(
|
||||||
|
"void-linux/musl-obstack",
|
||||||
|
"v"+version,
|
||||||
|
checksum,
|
||||||
|
), &PackageAttr{
|
||||||
|
Env: []string{
|
||||||
|
"CC=cc -fPIC",
|
||||||
|
},
|
||||||
|
}, &MakeHelper{
|
||||||
|
Generate: "./bootstrap.sh",
|
||||||
|
},
|
||||||
|
Automake,
|
||||||
|
Libtool,
|
||||||
|
PkgConfig,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newMuslObstack,
|
||||||
|
|
||||||
|
Name: "musl-obstack",
|
||||||
|
Description: "obstack functions and macros separated from glibc",
|
||||||
|
Website: "https://github.com/void-linux/musl-obstack",
|
||||||
|
|
||||||
|
ID: 146206,
|
||||||
|
})
|
||||||
|
}
|
||||||
98
internal/rosa/musl.go
Normal file
98
internal/rosa/musl.go
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newMusl(headers bool) (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "1.2.6"
|
||||||
|
checksum = "WtWb_OV_XxLDAB5NerOL9loLlHVadV00MmGk65PPBU1evaolagoMHfvpZp_vxEzS"
|
||||||
|
)
|
||||||
|
|
||||||
|
name := "musl"
|
||||||
|
helper := MakeHelper{
|
||||||
|
OmitDefaults: true,
|
||||||
|
SkipCheck: true,
|
||||||
|
Script: `
|
||||||
|
mkdir -p /work/system/bin
|
||||||
|
COMPAT_LINKER_NAME="ld-musl-` + t.linuxArch() + `.so.1"
|
||||||
|
ln -vs ../lib/libc.so /work/system/bin/linker
|
||||||
|
ln -vs ../lib/libc.so /work/system/bin/ldd
|
||||||
|
ln -vs libc.so "/work/system/lib/${COMPAT_LINKER_NAME}"
|
||||||
|
rm -v "/work/lib/${COMPAT_LINKER_NAME}"
|
||||||
|
rmdir -v /work/lib
|
||||||
|
`,
|
||||||
|
}
|
||||||
|
|
||||||
|
if headers {
|
||||||
|
name += "-headers"
|
||||||
|
helper.Make = []string{
|
||||||
|
"DESTDIR=/work",
|
||||||
|
"install-headers",
|
||||||
|
}
|
||||||
|
helper.Install = "# headers installed during make"
|
||||||
|
helper.Script = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
env := []string{
|
||||||
|
"LDFLAGS=" + t.earlyLDFLAGS(false),
|
||||||
|
}
|
||||||
|
if t.stage.isStage0() {
|
||||||
|
env = append(env,
|
||||||
|
"CC=clang",
|
||||||
|
"AR=ar",
|
||||||
|
"RANLIB=ranlib",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return t.NewPackage(name, version, newTar(
|
||||||
|
"https://musl.libc.org/releases/musl-"+version+".tar.gz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
), &PackageAttr{
|
||||||
|
// expected to be writable in copies
|
||||||
|
Chmod: true,
|
||||||
|
|
||||||
|
Env: env,
|
||||||
|
|
||||||
|
Patches: []KV{
|
||||||
|
{"ldso-rosa", `diff --git a/ldso/dynlink.c b/ldso/dynlink.c
|
||||||
|
index 715948f4..c2fece68 100644
|
||||||
|
--- a/ldso/dynlink.c
|
||||||
|
+++ b/ldso/dynlink.c
|
||||||
|
@@ -1157,7 +1157,7 @@ static struct dso *load_library(const char *name, struct dso *needed_by)
|
||||||
|
sys_path = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- if (!sys_path) sys_path = "/lib:/usr/local/lib:/usr/lib";
|
||||||
|
+ if (!sys_path) sys_path = "/system/lib:/system/lib/" LDSO_ARCH "-rosa-linux-musl:/lib:/usr/local/lib:/usr/lib";
|
||||||
|
fd = path_open(name, sys_path, buf, sizeof buf);
|
||||||
|
}
|
||||||
|
pathname = buf;
|
||||||
|
`},
|
||||||
|
},
|
||||||
|
}, &helper,
|
||||||
|
Coreutils,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: func(t Toolchain) (pkg.Artifact, string) {
|
||||||
|
return t.newMusl(false)
|
||||||
|
},
|
||||||
|
|
||||||
|
Name: "musl",
|
||||||
|
Description: "an implementation of the C standard library",
|
||||||
|
Website: "https://musl.libc.org/",
|
||||||
|
|
||||||
|
ID: 11688,
|
||||||
|
})
|
||||||
|
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: func(t Toolchain) (pkg.Artifact, string) {
|
||||||
|
return t.newMusl(true)
|
||||||
|
},
|
||||||
|
|
||||||
|
Name: "musl-headers",
|
||||||
|
Description: "system installation of musl headers",
|
||||||
|
})
|
||||||
|
}
|
||||||
38
internal/rosa/ncurses.go
Normal file
38
internal/rosa/ncurses.go
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newNcurses() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "6.6"
|
||||||
|
checksum = "XvWp4xi6hR_hH8XUoGY26L_pqBSDapJYulhzZqPuR0KNklqypqNc1yNXU-nOjf5w"
|
||||||
|
)
|
||||||
|
return t.NewPackage("ncurses", version, newTar(
|
||||||
|
"https://ftpmirror.gnu.org/gnu/ncurses/ncurses-"+version+".tar.gz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
), nil, &MakeHelper{
|
||||||
|
// "tests" are actual demo programs, not a test suite.
|
||||||
|
SkipCheck: true,
|
||||||
|
|
||||||
|
Configure: []KV{
|
||||||
|
{"with-pkg-config"},
|
||||||
|
{"enable-pc-files"},
|
||||||
|
{"with-shared"},
|
||||||
|
{"with-cxx-shared"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
PkgConfig,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newNcurses,
|
||||||
|
|
||||||
|
Name: "ncurses",
|
||||||
|
Description: "a free software emulation of curses in System V Release 4.0 (SVr4)",
|
||||||
|
Website: "https://invisible-island.net/ncurses/",
|
||||||
|
|
||||||
|
ID: 373226,
|
||||||
|
})
|
||||||
|
}
|
||||||
147
internal/rosa/netfilter.go
Normal file
147
internal/rosa/netfilter.go
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newLibmnl() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "1.0.5"
|
||||||
|
checksum = "DN-vbbvQDpxXJm0TJ6xlluILvfrB86avrCTX50XyE9SEFSAZ_o8nuKc5Gu0Am7-u"
|
||||||
|
)
|
||||||
|
return t.NewPackage("libmnl", version, newTar(
|
||||||
|
"https://www.netfilter.org/projects/libmnl/files/"+
|
||||||
|
"libmnl-"+version+".tar.bz2",
|
||||||
|
checksum,
|
||||||
|
pkg.TarBzip2,
|
||||||
|
), &PackageAttr{
|
||||||
|
Patches: []KV{
|
||||||
|
{"libbsd-sys-queue", `diff --git a/examples/netfilter/nfct-daemon.c b/examples/netfilter/nfct-daemon.c
|
||||||
|
index d223ac2..a7878d0 100644
|
||||||
|
--- a/examples/netfilter/nfct-daemon.c
|
||||||
|
+++ b/examples/netfilter/nfct-daemon.c
|
||||||
|
@@ -20,7 +20,7 @@
|
||||||
|
#include <linux/netfilter/nfnetlink.h>
|
||||||
|
#include <linux/netfilter/nfnetlink_conntrack.h>
|
||||||
|
|
||||||
|
-#include <sys/queue.h>
|
||||||
|
+#include <bsd/sys/queue.h>
|
||||||
|
|
||||||
|
struct nstats {
|
||||||
|
LIST_ENTRY(nstats) list;
|
||||||
|
`},
|
||||||
|
},
|
||||||
|
}, &MakeHelper{
|
||||||
|
Configure: []KV{
|
||||||
|
{"enable-static"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Libbsd,
|
||||||
|
KernelHeaders,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLibmnl,
|
||||||
|
|
||||||
|
Name: "libmnl",
|
||||||
|
Description: "a minimalistic user-space library oriented to Netlink developers",
|
||||||
|
Website: "https://www.netfilter.org/projects/libmnl/",
|
||||||
|
|
||||||
|
ID: 1663,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t Toolchain) newLibnftnl() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "1.3.1"
|
||||||
|
checksum = "91ou66K-I17iX6DB6hiQkhhC_v4DFW5iDGzwjVRNbJNEmKqowLZBlh3FY-ZDO0r9"
|
||||||
|
)
|
||||||
|
return t.NewPackage("libnftnl", version, t.newTagRemote(
|
||||||
|
"https://git.netfilter.org/libnftnl",
|
||||||
|
"libnftnl-"+version, checksum,
|
||||||
|
), &PackageAttr{
|
||||||
|
Env: []string{
|
||||||
|
"CFLAGS=-D_GNU_SOURCE",
|
||||||
|
},
|
||||||
|
}, &MakeHelper{
|
||||||
|
Generate: "./autogen.sh",
|
||||||
|
Configure: []KV{
|
||||||
|
{"enable-static"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Automake,
|
||||||
|
Libtool,
|
||||||
|
PkgConfig,
|
||||||
|
|
||||||
|
Libmnl,
|
||||||
|
KernelHeaders,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newLibnftnl,
|
||||||
|
|
||||||
|
Name: "libnftnl",
|
||||||
|
Description: "a userspace library providing a low-level netlink API to the in-kernel nf_tables subsystem",
|
||||||
|
Website: "https://www.netfilter.org/projects/libnftnl/",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
Libmnl,
|
||||||
|
},
|
||||||
|
|
||||||
|
ID: 1681,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t Toolchain) newIPTables() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "1.8.13"
|
||||||
|
checksum = "TUA-cFIAsiMvtRR-XzQvXzoIhJUOc9J2gQDJCbBRjmgmVfGfPTCf58wL7e-cUKVQ"
|
||||||
|
)
|
||||||
|
return t.NewPackage("iptables", version, t.newTagRemote(
|
||||||
|
"https://git.netfilter.org/iptables",
|
||||||
|
"v"+version, checksum,
|
||||||
|
), &PackageAttr{
|
||||||
|
ScriptEarly: `
|
||||||
|
rm \
|
||||||
|
extensions/libxt_connlabel.txlate \
|
||||||
|
extensions/libxt_conntrack.txlate
|
||||||
|
sed -i \
|
||||||
|
's/de:ad:0:be:ee:ff/DE:AD:00:BE:EE:FF/g' \
|
||||||
|
extensions/libebt_dnat.txlate \
|
||||||
|
extensions/libebt_snat.txlate
|
||||||
|
`,
|
||||||
|
}, &MakeHelper{
|
||||||
|
Generate: "./autogen.sh",
|
||||||
|
Configure: []KV{
|
||||||
|
{"enable-static"},
|
||||||
|
},
|
||||||
|
ScriptCheckEarly: `
|
||||||
|
ln -s ../system/bin/bash /bin/
|
||||||
|
chmod +w /etc/ && ln -s ../usr/src/iptables/etc/ethertypes /etc/
|
||||||
|
`,
|
||||||
|
},
|
||||||
|
Automake,
|
||||||
|
Libtool,
|
||||||
|
PkgConfig,
|
||||||
|
Bash,
|
||||||
|
Python,
|
||||||
|
|
||||||
|
Libnftnl,
|
||||||
|
KernelHeaders,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newIPTables,
|
||||||
|
|
||||||
|
Name: "iptables",
|
||||||
|
Description: "the userspace command line program used to configure the Linux 2.4.x and later packet filtering ruleset",
|
||||||
|
Website: "https://www.netfilter.org/projects/iptables/",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
Libnftnl,
|
||||||
|
},
|
||||||
|
|
||||||
|
ID: 1394,
|
||||||
|
})
|
||||||
|
}
|
||||||
35
internal/rosa/nettle.go
Normal file
35
internal/rosa/nettle.go
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newNettle() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "4.0"
|
||||||
|
checksum = "6agC-vHzzoqAlaX3K9tX8yHgrm03HLqPZzVzq8jh_ePbuPMIvpxereu_uRJFmQK7"
|
||||||
|
)
|
||||||
|
return t.NewPackage("nettle", version, newTar(
|
||||||
|
"https://ftpmirror.gnu.org/gnu/nettle/nettle-"+version+".tar.gz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
), nil, (*MakeHelper)(nil),
|
||||||
|
M4,
|
||||||
|
Diffutils,
|
||||||
|
|
||||||
|
GMP,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newNettle,
|
||||||
|
|
||||||
|
Name: "nettle",
|
||||||
|
Description: "a low-level cryptographic library",
|
||||||
|
Website: "https://www.lysator.liu.se/~nisse/nettle/",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
GMP,
|
||||||
|
},
|
||||||
|
|
||||||
|
ID: 2073,
|
||||||
|
})
|
||||||
|
}
|
||||||
33
internal/rosa/nettle3.go
Normal file
33
internal/rosa/nettle3.go
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
package rosa
|
||||||
|
|
||||||
|
import "hakurei.app/internal/pkg"
|
||||||
|
|
||||||
|
func (t Toolchain) newNettle3() (pkg.Artifact, string) {
|
||||||
|
const (
|
||||||
|
version = "3.10.2"
|
||||||
|
checksum = "07aXlj10X5llf67jIqRQAA1pgLSgb0w_JYggZVPuKNoc-B-_usb5Kr8FrfBe7g1S"
|
||||||
|
)
|
||||||
|
return t.NewPackage("nettle", version, newTar(
|
||||||
|
"https://ftpmirror.gnu.org/gnu/nettle/nettle-"+version+".tar.gz",
|
||||||
|
checksum,
|
||||||
|
pkg.TarGzip,
|
||||||
|
), nil, (*MakeHelper)(nil),
|
||||||
|
M4,
|
||||||
|
Diffutils,
|
||||||
|
|
||||||
|
GMP,
|
||||||
|
), version
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
native.MustRegister(&Artifact{
|
||||||
|
f: Toolchain.newNettle3,
|
||||||
|
|
||||||
|
Name: "nettle3",
|
||||||
|
Description: "a low-level cryptographic library",
|
||||||
|
Website: "https://www.lysator.liu.se/~nisse/nettle/",
|
||||||
|
|
||||||
|
Dependencies: P{
|
||||||
|
GMP,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user