forked from rosa/hakurei
Compare commits
83 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
e231341e48
|
|||
|
70f977627d
|
|||
|
f3a6f7ddf9
|
|||
|
2a9aa3b400
|
|||
|
68a91523b9
|
|||
|
5647321622
|
|||
|
cdd31dd27b
|
|||
|
0615899e56
|
|||
|
0914569e62
|
|||
|
25d9edfc64
|
|||
|
af4c3bbff2
|
|||
|
54aae9d72a
|
|||
|
58646f8ea5
|
|||
|
9d7a27d8ac
|
|||
|
6546ddc64b
|
|||
|
cbf18b302d
|
|||
|
1acb5b0105
|
|||
|
40b33f9fc7
|
|||
|
443a7a30f6
|
|||
|
497e4a5642
|
|||
|
c0e3841ddb
|
|||
|
9ce2c325db
|
|||
|
9836030c59
|
|||
|
b482fd4abf
|
|||
|
2e502ede6c
|
|||
|
4bec0b890c
|
|||
|
7770ccf0aa
|
|||
|
656059278d
|
|||
|
1a9974ffdc
|
|||
|
1a2699b486
|
|||
|
1d3d621e2f
|
|||
|
47f4e287fc
|
|||
|
2e710328a4
|
|||
|
2e7b52d701
|
|||
|
d728607505
|
|||
|
ef414ab01a
|
|||
|
96abf266dd
|
|||
|
fcba32e9c4
|
|||
|
a7f5a5802d
|
|||
|
bb230378e0
|
|||
|
f638c73933
|
|||
|
98d915af3d
|
|||
|
c0593e8325
|
|||
|
608d8303ec
|
|||
|
1c6f30379e
|
|||
|
009a4e0d58
|
|||
|
e7c8656691
|
|||
|
d6be116ff8
|
|||
|
962b02cf25
|
|||
|
6fd6d971ed
|
|||
|
548c96c7ec
|
|||
|
6e8bfa6c4c
|
|||
|
a770d62b9b
|
|||
|
ff44060763
|
|||
|
3010a209b5
|
|||
|
e65a3b435c
|
|||
|
23515f67c8
|
|||
|
4389df60ae
|
|||
|
8092492018
|
|||
|
a7877844bf
|
|||
|
1ed027846d
|
|||
|
2f376d4813
|
|||
|
dc3810b530
|
|||
|
6e9e8c74f3
|
|||
|
4d60fa5632
|
|||
|
8807cbc730
|
|||
|
0e95573f18
|
|||
|
eb2b53307a
|
|||
|
682b3a2ce5
|
|||
|
594221eb78
|
|||
|
34822925e1
|
|||
|
37df040d85
|
|||
|
0360e779f3
|
|||
|
3e236333a7
|
|||
|
f24ae21af1
|
|||
|
99b324fb17
|
|||
|
6f50811dc9
|
|||
|
6b87bac401
|
|||
|
a967aa3b6e
|
|||
|
38bc2c7508
|
|||
|
30eb0d6a61
|
|||
|
c2ff9c9fa5
|
|||
|
d38d306147
|
1
cmd/dist/VERSION
vendored
Normal file
1
cmd/dist/VERSION
vendored
Normal file
@@ -0,0 +1 @@
|
||||
v0.4.3
|
||||
7
cmd/dist/main.go
vendored
7
cmd/dist/main.go
vendored
@@ -18,8 +18,13 @@ import (
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
"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.
|
||||
func getenv(key, fallback string) string {
|
||||
if v, ok := os.LookupEnv(key); ok {
|
||||
@@ -47,7 +52,7 @@ func main() {
|
||||
|
||||
verbose := os.Getenv("VERBOSE") != ""
|
||||
runTests := os.Getenv("HAKUREI_DIST_MAKE") == ""
|
||||
version := getenv("HAKUREI_VERSION", "untagged")
|
||||
version = getenv("HAKUREI_VERSION", strings.TrimSpace(version))
|
||||
prefix := getenv("PREFIX", "/usr")
|
||||
destdir := getenv("DESTDIR", "dist")
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
"unique"
|
||||
|
||||
"hakurei.app/internal/pkg"
|
||||
"hakurei.app/internal/rosa"
|
||||
@@ -35,17 +36,19 @@ func commandInfo(
|
||||
}
|
||||
}
|
||||
|
||||
t := rosa.Native().Std()
|
||||
for i, name := range args {
|
||||
if p, ok := rosa.ResolveName(name); !ok {
|
||||
handle := rosa.ArtifactH(unique.Make(name))
|
||||
if meta, a := t.Load(handle); meta == nil {
|
||||
return fmt.Errorf("unknown artifact %q", name)
|
||||
} else {
|
||||
var suffix string
|
||||
if version := rosa.Std.Version(p); version != rosa.Unversioned {
|
||||
suffix += "-" + version
|
||||
|
||||
if meta.Version != rosa.Unversioned {
|
||||
suffix += "-" + meta.Version
|
||||
}
|
||||
mustPrintln("name : " + name + suffix)
|
||||
|
||||
meta := rosa.GetMetadata(p)
|
||||
mustPrintln("description : " + meta.Description)
|
||||
if meta.Website != "" {
|
||||
mustPrintln("website : " +
|
||||
@@ -54,9 +57,10 @@ func commandInfo(
|
||||
if len(meta.Dependencies) > 0 {
|
||||
mustPrint("depends on :")
|
||||
for _, d := range meta.Dependencies {
|
||||
s := rosa.GetMetadata(d).Name
|
||||
if version := rosa.Std.Version(d); version != rosa.Unversioned {
|
||||
s += "-" + version
|
||||
_meta, _ := rosa.Native().Std().MustLoad(d)
|
||||
s := _meta.Name
|
||||
if _meta.Version != rosa.Unversioned {
|
||||
s += "-" + _meta.Version
|
||||
}
|
||||
mustPrint(" " + s)
|
||||
}
|
||||
@@ -68,7 +72,7 @@ func commandInfo(
|
||||
if r == nil {
|
||||
var f io.ReadSeekCloser
|
||||
err = cm.Do(func(cache *pkg.Cache) (err error) {
|
||||
f, err = cache.OpenStatus(rosa.Std.Load(p))
|
||||
f, err = cache.OpenStatus(a)
|
||||
return
|
||||
})
|
||||
if err != nil {
|
||||
@@ -87,7 +91,7 @@ func commandInfo(
|
||||
}
|
||||
}
|
||||
} else if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
||||
status, n := r.ArtifactOf(cache.Ident(rosa.Std.Load(p)))
|
||||
status, n := r.ArtifactOf(cache.Ident(a))
|
||||
if status == nil {
|
||||
mustPrintln(
|
||||
statusPrefix + "not in report",
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"strings"
|
||||
"syscall"
|
||||
"testing"
|
||||
"unique"
|
||||
"unsafe"
|
||||
|
||||
"hakurei.app/internal/pkg"
|
||||
@@ -20,6 +21,14 @@ import (
|
||||
func TestInfo(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
_t := rosa.Native().Std()
|
||||
qemuMeta, _ := _t.Load(rosa.H("qemu"))
|
||||
glibMeta, _ := _t.Load(rosa.H("glib"))
|
||||
zlibMeta, zlib := _t.Load(rosa.H("zlib"))
|
||||
zstdMeta, _ := _t.Load(rosa.H("zstd"))
|
||||
hakureiMeta, _ := _t.Load(rosa.H("hakurei"))
|
||||
hakureiDistMeta, _ := _t.Load(rosa.H("hakurei-dist"))
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
@@ -29,24 +38,24 @@ func TestInfo(t *testing.T) {
|
||||
wantErr any
|
||||
}{
|
||||
{"qemu", []string{"qemu"}, nil, "", `
|
||||
name : qemu-` + rosa.Std.Version(rosa.QEMU) + `
|
||||
name : qemu-` + qemuMeta.Version + `
|
||||
description : a generic and open source machine emulator and virtualizer
|
||||
website : https://www.qemu.org
|
||||
depends on : glib-` + rosa.Std.Version(rosa.GLib) + ` zstd-` + rosa.Std.Version(rosa.Zstd) + `
|
||||
depends on : glib-` + glibMeta.Version + ` zstd-` + zstdMeta.Version + `
|
||||
`, nil},
|
||||
|
||||
{"multi", []string{"hakurei", "hakurei-dist"}, nil, "", `
|
||||
name : hakurei-` + rosa.Std.Version(rosa.Hakurei) + `
|
||||
name : hakurei-` + hakureiMeta.Version + `
|
||||
description : low-level userspace tooling for Rosa OS
|
||||
website : https://hakurei.app
|
||||
|
||||
name : hakurei-dist-` + rosa.Std.Version(rosa.HakureiDist) + `
|
||||
name : hakurei-dist-` + hakureiDistMeta.Version + `
|
||||
description : low-level userspace tooling for Rosa OS (distribution tarball)
|
||||
website : https://hakurei.app
|
||||
`, nil},
|
||||
|
||||
{"nonexistent", []string{"zlib", "\x00"}, nil, "", `
|
||||
name : zlib-` + rosa.Std.Version(rosa.Zlib) + `
|
||||
name : zlib-` + zlibMeta.Version + `
|
||||
description : lossless data-compression library
|
||||
website : https://zlib.net
|
||||
|
||||
@@ -56,12 +65,12 @@ website : https://zlib.net
|
||||
"zstd": "internal/pkg (amd64) on satori\n",
|
||||
"hakurei": "internal/pkg (amd64) on satori\n\n",
|
||||
}, "", `
|
||||
name : zlib-` + rosa.Std.Version(rosa.Zlib) + `
|
||||
name : zlib-` + zlibMeta.Version + `
|
||||
description : lossless data-compression library
|
||||
website : https://zlib.net
|
||||
status : not yet cured
|
||||
|
||||
name : zstd-` + rosa.Std.Version(rosa.Zstd) + `
|
||||
name : zstd-` + zstdMeta.Version + `
|
||||
description : a fast compression algorithm
|
||||
website : https://facebook.github.io/zstd
|
||||
status : internal/pkg (amd64) on satori
|
||||
@@ -70,19 +79,19 @@ status : internal/pkg (amd64) on satori
|
||||
{"status cache perm", []string{"zlib"}, map[string]string{
|
||||
"zlib": "\x00",
|
||||
}, "", `
|
||||
name : zlib-` + rosa.Std.Version(rosa.Zlib) + `
|
||||
name : zlib-` + zlibMeta.Version + `
|
||||
description : lossless data-compression library
|
||||
website : https://zlib.net
|
||||
`, func(cm *cache) error {
|
||||
return &os.PathError{
|
||||
Op: "open",
|
||||
Path: filepath.Join(cm.base, "status", pkg.Encode(cm.c.Ident(rosa.Std.Load(rosa.Zlib)).Value())),
|
||||
Path: filepath.Join(cm.base, "status", pkg.Encode(cm.c.Ident(zlib).Value())),
|
||||
Err: syscall.EACCES,
|
||||
}
|
||||
}},
|
||||
|
||||
{"status report", []string{"zlib"}, nil, strings.Repeat("\x00", len(pkg.Checksum{})+8), `
|
||||
name : zlib-` + rosa.Std.Version(rosa.Zlib) + `
|
||||
name : zlib-` + zlibMeta.Version + `
|
||||
description : lossless data-compression library
|
||||
website : https://zlib.net
|
||||
status : not in report
|
||||
@@ -131,8 +140,8 @@ status : not in report
|
||||
|
||||
if tc.status != nil {
|
||||
for name, status := range tc.status {
|
||||
p, ok := rosa.ResolveName(name)
|
||||
if !ok {
|
||||
_, a := _t.Load(rosa.ArtifactH(unique.Make(name)))
|
||||
if a == nil {
|
||||
t.Fatalf("invalid name %q", name)
|
||||
}
|
||||
perm := os.FileMode(0400)
|
||||
@@ -143,7 +152,7 @@ status : not in report
|
||||
return os.WriteFile(filepath.Join(
|
||||
cm.base,
|
||||
"status",
|
||||
pkg.Encode(cache.Ident(rosa.Std.Load(p)).Value()),
|
||||
pkg.Encode(cache.Ident(a).Value()),
|
||||
), unsafe.Slice(unsafe.StringData(status), len(status)), perm)
|
||||
}); err != nil {
|
||||
t.Fatalf("Do: error = %v", err)
|
||||
|
||||
@@ -30,7 +30,7 @@ var (
|
||||
// handleInfo writes constant system information.
|
||||
func handleInfo(w http.ResponseWriter, _ *http.Request) {
|
||||
infoPayloadOnce.Do(func() {
|
||||
infoPayload.Count = int(rosa.PresetUnexportedStart)
|
||||
infoPayload.Count = len(rosa.Native().Collect())
|
||||
infoPayload.HakureiVersion = info.Version()
|
||||
})
|
||||
// TODO(mae): cache entire response if no additional fields are planned
|
||||
@@ -91,7 +91,7 @@ func (index *packageIndex) handleGet(w http.ResponseWriter, r *http.Request) {
|
||||
if err != nil || i >= len(index.sorts[0]) || i < 0 {
|
||||
http.Error(
|
||||
w, "index must be an integer between 0 and "+
|
||||
strconv.Itoa(int(rosa.PresetUnexportedStart-1)),
|
||||
strconv.Itoa(len(index.sorts[0])-1),
|
||||
http.StatusBadRequest,
|
||||
)
|
||||
return
|
||||
@@ -125,7 +125,7 @@ func (index *packageIndex) handleSearch(w http.ResponseWriter, r *http.Request)
|
||||
if err != nil || i >= len(index.sorts[0]) || i < 0 {
|
||||
http.Error(
|
||||
w, "index must be an integer between 0 and "+
|
||||
strconv.Itoa(int(rosa.PresetUnexportedStart-1)),
|
||||
strconv.Itoa(len(index.sorts[0])-1),
|
||||
http.StatusBadRequest,
|
||||
)
|
||||
return
|
||||
|
||||
@@ -3,7 +3,6 @@ package pkgserver
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"slices"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
@@ -32,7 +31,7 @@ func TestAPIInfo(t *testing.T) {
|
||||
checkPayload(t, resp, struct {
|
||||
Count int `json:"count"`
|
||||
HakureiVersion string `json:"hakurei_version"`
|
||||
}{int(rosa.PresetUnexportedStart), info.Version()})
|
||||
}{len(rosa.Native().Collect()), info.Version()})
|
||||
}
|
||||
|
||||
func TestAPIGet(t *testing.T) {
|
||||
@@ -93,11 +92,12 @@ func TestAPIGet(t *testing.T) {
|
||||
)
|
||||
})
|
||||
|
||||
count := len(rosa.Native().Collect())
|
||||
t.Run("index", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
checkValidate(
|
||||
t, "limit=1&sort=0&index", 0, int(rosa.PresetUnexportedStart-1),
|
||||
"index must be an integer between 0 and "+strconv.Itoa(int(rosa.PresetUnexportedStart-1)),
|
||||
t, "limit=1&sort=0&index", 0, count-1,
|
||||
"index must be an integer between 0 and "+strconv.Itoa(count-1),
|
||||
)
|
||||
})
|
||||
|
||||
@@ -108,74 +108,4 @@ func TestAPIGet(t *testing.T) {
|
||||
"sort must be an integer between 0 and "+strconv.Itoa(int(sortOrderEnd)),
|
||||
)
|
||||
})
|
||||
|
||||
checkWithSuffix := func(name, suffix string, want []*metadata) {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
w := newRequest(suffix)
|
||||
resp := w.Result()
|
||||
checkStatus(t, resp, http.StatusOK)
|
||||
checkAPIHeader(t, w.Header())
|
||||
checkPayloadFunc(t, resp, func(got *struct {
|
||||
Values []*metadata `json:"values"`
|
||||
}) bool {
|
||||
return slices.EqualFunc(got.Values, want, func(a, b *metadata) bool {
|
||||
return (a.Version == b.Version ||
|
||||
a.Version == rosa.Unversioned ||
|
||||
b.Version == rosa.Unversioned) &&
|
||||
a.HasReport == b.HasReport &&
|
||||
a.Name == b.Name &&
|
||||
a.Description == b.Description &&
|
||||
a.Website == b.Website
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
checkWithSuffix("declarationAscending", "?limit=2&index=1&sort=0", []*metadata{
|
||||
{
|
||||
Metadata: rosa.GetMetadata(1),
|
||||
Version: rosa.Std.Version(1),
|
||||
},
|
||||
{
|
||||
Metadata: rosa.GetMetadata(2),
|
||||
Version: rosa.Std.Version(2),
|
||||
},
|
||||
})
|
||||
checkWithSuffix("declarationAscending offset", "?limit=3&index=5&sort=0", []*metadata{
|
||||
{
|
||||
Metadata: rosa.GetMetadata(5),
|
||||
Version: rosa.Std.Version(5),
|
||||
},
|
||||
{
|
||||
Metadata: rosa.GetMetadata(6),
|
||||
Version: rosa.Std.Version(6),
|
||||
},
|
||||
{
|
||||
Metadata: rosa.GetMetadata(7),
|
||||
Version: rosa.Std.Version(7),
|
||||
},
|
||||
})
|
||||
checkWithSuffix("declarationDescending", "?limit=3&index=0&sort=1", []*metadata{
|
||||
{
|
||||
Metadata: rosa.GetMetadata(rosa.PresetUnexportedStart - 1),
|
||||
Version: rosa.Std.Version(rosa.PresetUnexportedStart - 1),
|
||||
},
|
||||
{
|
||||
Metadata: rosa.GetMetadata(rosa.PresetUnexportedStart - 2),
|
||||
Version: rosa.Std.Version(rosa.PresetUnexportedStart - 2),
|
||||
},
|
||||
{
|
||||
Metadata: rosa.GetMetadata(rosa.PresetUnexportedStart - 3),
|
||||
Version: rosa.Std.Version(rosa.PresetUnexportedStart - 3),
|
||||
},
|
||||
})
|
||||
checkWithSuffix("declarationDescending offset", "?limit=1&index=37&sort=1", []*metadata{
|
||||
{
|
||||
Metadata: rosa.GetMetadata(rosa.PresetUnexportedStart - 38),
|
||||
Version: rosa.Std.Version(rosa.PresetUnexportedStart - 38),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ const (
|
||||
|
||||
// packageIndex refers to metadata by name and various sort orders.
|
||||
type packageIndex struct {
|
||||
sorts [sortOrderEnd + 1][rosa.PresetUnexportedStart]*metadata
|
||||
sorts [sortOrderEnd + 1][]*metadata
|
||||
names map[string]*metadata
|
||||
search searchCache
|
||||
// Taken from [rosa.Report] if available.
|
||||
@@ -32,11 +32,11 @@ type packageIndex struct {
|
||||
|
||||
// metadata holds [rosa.Metadata] extended with additional information.
|
||||
type metadata struct {
|
||||
p rosa.PArtifact
|
||||
handle rosa.ArtifactH
|
||||
*rosa.Metadata
|
||||
|
||||
// Populated via [rosa.Toolchain.Version], [rosa.Unversioned] is equivalent
|
||||
// to the zero value. Otherwise, the zero value is invalid.
|
||||
// Copied from [rosa.Metadata], [rosa.Unversioned] is equivalent to the zero
|
||||
// value. Otherwise, the zero value is invalid.
|
||||
Version string `json:"version,omitempty"`
|
||||
// Output data size, available if present in report.
|
||||
Size int64 `json:"size,omitempty"`
|
||||
@@ -56,15 +56,17 @@ func (index *packageIndex) populate(report *rosa.Report) (err error) {
|
||||
index.handleAccess = report.HandleAccess
|
||||
}
|
||||
|
||||
var work [rosa.PresetUnexportedStart]*metadata
|
||||
handles := rosa.Native().Collect()
|
||||
work := make([]*metadata, len(handles))
|
||||
index.names = make(map[string]*metadata)
|
||||
ir := pkg.NewIR()
|
||||
for p := range rosa.PresetUnexportedStart {
|
||||
for i, handle := range handles {
|
||||
meta, a := rosa.Native().Std().MustLoad(handle)
|
||||
m := metadata{
|
||||
p: p,
|
||||
handle: handle,
|
||||
|
||||
Metadata: rosa.GetMetadata(p),
|
||||
Version: rosa.Std.Version(p),
|
||||
Metadata: meta,
|
||||
Version: meta.Version,
|
||||
}
|
||||
if m.Version == "" {
|
||||
return errors.New("invalid version from " + m.Name)
|
||||
@@ -74,32 +76,32 @@ func (index *packageIndex) populate(report *rosa.Report) (err error) {
|
||||
}
|
||||
|
||||
if report != nil {
|
||||
id := ir.Ident(rosa.Std.Load(p))
|
||||
id := ir.Ident(a)
|
||||
m.ids = pkg.Encode(id.Value())
|
||||
m.status, m.Size = report.ArtifactOf(id)
|
||||
m.HasReport = m.Size >= 0
|
||||
}
|
||||
|
||||
work[p] = &m
|
||||
work[i] = &m
|
||||
index.names[m.Name] = &m
|
||||
}
|
||||
|
||||
index.sorts[declarationAscending] = work
|
||||
index.sorts[declarationDescending] = work
|
||||
index.sorts[declarationDescending] = slices.Clone(work)
|
||||
slices.Reverse(index.sorts[declarationDescending][:])
|
||||
|
||||
index.sorts[nameAscending] = work
|
||||
index.sorts[nameAscending] = slices.Clone(work)
|
||||
slices.SortFunc(index.sorts[nameAscending][:], func(a, b *metadata) int {
|
||||
return strings.Compare(a.Name, b.Name)
|
||||
})
|
||||
index.sorts[nameDescending] = index.sorts[nameAscending]
|
||||
index.sorts[nameDescending] = slices.Clone(index.sorts[nameAscending])
|
||||
slices.Reverse(index.sorts[nameDescending][:])
|
||||
|
||||
index.sorts[sizeAscending] = work
|
||||
index.sorts[sizeAscending] = slices.Clone(work)
|
||||
slices.SortFunc(index.sorts[sizeAscending][:], func(a, b *metadata) int {
|
||||
return cmp.Compare(a.Size, b.Size)
|
||||
})
|
||||
index.sorts[sizeDescending] = index.sorts[sizeAscending]
|
||||
index.sorts[sizeDescending] = slices.Clone(index.sorts[sizeAscending])
|
||||
slices.Reverse(index.sorts[sizeDescending][:])
|
||||
|
||||
return
|
||||
|
||||
@@ -4,11 +4,12 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<title>Hakurei PkgServer</title>
|
||||
<link rel="icon" href="https://hakurei.app/favicon.ico"/>
|
||||
<title>Rosa OS Packages</title>
|
||||
<script src="index.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hakurei PkgServer</h1>
|
||||
<h1>Rosa OS Packages</h1>
|
||||
<div class="top-controls" id="top-controls-regular">
|
||||
<p>Showing entries <span id="entry-counter"></span>.</p>
|
||||
<span id="search-bar">
|
||||
|
||||
114
cmd/mbf/main.go
114
cmd/mbf/main.go
@@ -58,6 +58,19 @@ func main() {
|
||||
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(),
|
||||
syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP)
|
||||
defer stop()
|
||||
@@ -71,12 +84,21 @@ func main() {
|
||||
flagArch string
|
||||
flagCheck bool
|
||||
flagLTO bool
|
||||
flagPT bool
|
||||
|
||||
flagCrossOverride int
|
||||
|
||||
addr net.UnixAddr
|
||||
)
|
||||
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)
|
||||
cm.ctx, cm.msg = ctx, msg
|
||||
cm.base = os.ExpandEnv(cm.base)
|
||||
@@ -97,10 +119,10 @@ func main() {
|
||||
if !flagLTO {
|
||||
flags |= rosa.OptLLVMNoLTO
|
||||
}
|
||||
rosa.DropCaches("", flags)
|
||||
rosa.Native().DropCaches("", flags)
|
||||
cross := flagArch != "" && flagArch != runtime.GOARCH
|
||||
if flagQEMU || cross {
|
||||
cm.qemu = rosa.Std.Load(rosa.QEMU)
|
||||
_, cm.qemu = rosa.Native().Std().MustLoad(rosa.H("qemu"))
|
||||
}
|
||||
|
||||
if cross {
|
||||
@@ -108,8 +130,8 @@ func main() {
|
||||
flags = flagCrossOverride
|
||||
}
|
||||
|
||||
rosa.DropCaches(flagArch, flags)
|
||||
if !rosa.HasStage0() {
|
||||
rosa.Native().DropCaches(flagArch, flags)
|
||||
if !rosa.Native().HasStageEarly() {
|
||||
return pkg.UnsupportedArchError(flagArch)
|
||||
}
|
||||
}
|
||||
@@ -170,6 +192,10 @@ func main() {
|
||||
&addr.Name,
|
||||
"socket", command.StringFlag("$MBF_DAEMON_SOCKET"),
|
||||
"Pathname of socket to bind to",
|
||||
).Flag(
|
||||
&flagPT,
|
||||
"parse-time", command.BoolFlag(false),
|
||||
"Print duration of the initial azalea parse",
|
||||
)
|
||||
|
||||
c.NewCommand(
|
||||
@@ -331,12 +357,12 @@ func main() {
|
||||
n atomic.Uint64
|
||||
)
|
||||
|
||||
w := make(chan rosa.PArtifact)
|
||||
w := make(chan rosa.ArtifactH)
|
||||
var wg sync.WaitGroup
|
||||
for range max(flagJobs, 1) {
|
||||
wg.Go(func() {
|
||||
for p := range w {
|
||||
meta := rosa.GetMetadata(p)
|
||||
meta, _ := rosa.Native().Std().MustLoad(p)
|
||||
if meta.ID == 0 {
|
||||
continue
|
||||
}
|
||||
@@ -349,12 +375,9 @@ func main() {
|
||||
continue
|
||||
}
|
||||
|
||||
if current, latest :=
|
||||
rosa.Std.Version(p),
|
||||
meta.GetLatest(v); current != latest {
|
||||
|
||||
if latest := meta.GetLatest(v); meta.Version != latest {
|
||||
n.Add(1)
|
||||
log.Printf("%s %s < %s", meta.Name, current, latest)
|
||||
log.Printf("%s %s < %s", meta.Name, meta.Version, latest)
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -364,9 +387,9 @@ func main() {
|
||||
}
|
||||
|
||||
done:
|
||||
for i := range rosa.PresetEnd {
|
||||
for _, p := range rosa.Native().CollectAll() {
|
||||
select {
|
||||
case w <- rosa.PArtifact(i):
|
||||
case w <- p:
|
||||
break
|
||||
case <-ctx.Done():
|
||||
break done
|
||||
@@ -411,9 +434,9 @@ func main() {
|
||||
"stage3",
|
||||
"Check for toolchain 3-stage non-determinism",
|
||||
func(args []string) (err error) {
|
||||
t := rosa.Std
|
||||
s := rosa.Std
|
||||
if flagGentoo != "" {
|
||||
t -= 3 // magic number to discourage misuse
|
||||
s -= 3 // magic number to discourage misuse
|
||||
|
||||
var checksum pkg.Checksum
|
||||
if len(flagChecksum) != 0 {
|
||||
@@ -421,7 +444,7 @@ func main() {
|
||||
return
|
||||
}
|
||||
}
|
||||
rosa.SetGentooStage3(flagGentoo, checksum)
|
||||
rosa.Native().SetGentooStage3(flagGentoo, checksum)
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -429,10 +452,10 @@ func main() {
|
||||
checksum [2]unique.Handle[pkg.Checksum]
|
||||
)
|
||||
|
||||
_llvm := rosa.H("llvm")
|
||||
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
||||
pathname, _, err = cache.Cure(
|
||||
(t - 2).Load(rosa.LLVM),
|
||||
)
|
||||
_, llvm := rosa.Native().New(s - 2).Load(_llvm)
|
||||
pathname, _, err = cache.Cure(llvm)
|
||||
return
|
||||
}); err != nil {
|
||||
return
|
||||
@@ -440,18 +463,16 @@ func main() {
|
||||
log.Println("stage1:", pathname)
|
||||
|
||||
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
||||
pathname, checksum[0], err = cache.Cure(
|
||||
(t - 1).Load(rosa.LLVM),
|
||||
)
|
||||
_, llvm := rosa.Native().New(s - 1).Load(_llvm)
|
||||
pathname, checksum[0], err = cache.Cure(llvm)
|
||||
return
|
||||
}); err != nil {
|
||||
return
|
||||
}
|
||||
log.Println("stage2:", pathname)
|
||||
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
||||
pathname, checksum[1], err = cache.Cure(
|
||||
t.Load(rosa.LLVM),
|
||||
)
|
||||
_, llvm := rosa.Native().New(s).Load(_llvm)
|
||||
pathname, checksum[1], err = cache.Cure(llvm)
|
||||
return
|
||||
}); err != nil {
|
||||
return
|
||||
@@ -472,9 +493,7 @@ func main() {
|
||||
|
||||
if flagStage0 {
|
||||
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
||||
pathname, _, err = cache.Cure(
|
||||
t.Load(rosa.Stage0),
|
||||
)
|
||||
pathname, _, err = cache.Cure(rosa.Native().Std().NewStage0())
|
||||
return
|
||||
}); err != nil {
|
||||
return
|
||||
@@ -519,10 +538,6 @@ func main() {
|
||||
if len(args) != 1 {
|
||||
return errors.New("cure requires 1 argument")
|
||||
}
|
||||
p, ok := rosa.ResolveName(args[0])
|
||||
if !ok {
|
||||
return fmt.Errorf("unknown artifact %q", args[0])
|
||||
}
|
||||
|
||||
t := rosa.Std
|
||||
if flagBoot {
|
||||
@@ -531,11 +546,16 @@ func main() {
|
||||
t -= 1
|
||||
}
|
||||
|
||||
_, a := rosa.Native().New(t).Load(rosa.ArtifactH(unique.Make(args[0])))
|
||||
if a == nil {
|
||||
return fmt.Errorf("unknown artifact %q", args[0])
|
||||
}
|
||||
|
||||
switch {
|
||||
default:
|
||||
var pathname *check.Absolute
|
||||
err := cm.Do(func(cache *pkg.Cache) (err error) {
|
||||
pathname, _, err = cache.Cure(t.Load(p))
|
||||
pathname, _, err = cache.Cure(a)
|
||||
return
|
||||
})
|
||||
if err != nil {
|
||||
@@ -577,7 +597,7 @@ func main() {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = pkg.NewIR().EncodeAll(f, rosa.Std.Load(p)); err != nil {
|
||||
if err = pkg.NewIR().EncodeAll(f, a); err != nil {
|
||||
_ = f.Close()
|
||||
return err
|
||||
}
|
||||
@@ -588,7 +608,7 @@ func main() {
|
||||
return cm.Do(func(cache *pkg.Cache) error {
|
||||
return cache.EnterExec(
|
||||
ctx,
|
||||
t.Load(p),
|
||||
a,
|
||||
true, os.Stdin, os.Stdout, os.Stderr,
|
||||
rosa.AbsSystem.Append("bin", "mksh"),
|
||||
"sh",
|
||||
@@ -600,7 +620,6 @@ func main() {
|
||||
if flagNoReply {
|
||||
flags |= remoteNoReply
|
||||
}
|
||||
a := t.Load(p)
|
||||
pathname, err := cureRemote(ctx, &addr, a, flags)
|
||||
if !flagNoReply && err == nil {
|
||||
log.Println(pathname)
|
||||
@@ -620,7 +639,7 @@ func main() {
|
||||
case flagFaults:
|
||||
var faults []pkg.Fault
|
||||
if err := cm.Do(func(cache *pkg.Cache) (err error) {
|
||||
faults, err = cache.ReadFaults(t.Load(p))
|
||||
faults, err = cache.ReadFaults(a)
|
||||
return
|
||||
}); err != nil {
|
||||
return err
|
||||
@@ -634,7 +653,7 @@ func main() {
|
||||
case flagPop:
|
||||
var faults []pkg.Fault
|
||||
if err := cm.Do(func(cache *pkg.Cache) (err error) {
|
||||
faults, err = cache.ReadFaults(t.Load(p))
|
||||
faults, err = cache.ReadFaults(a)
|
||||
return
|
||||
}); err != nil {
|
||||
return err
|
||||
@@ -740,27 +759,26 @@ func main() {
|
||||
"shell",
|
||||
"Interactive shell in the specified Rosa OS environment",
|
||||
func(args []string) error {
|
||||
presets := make([]rosa.PArtifact, len(args)+3)
|
||||
handles := make([]rosa.ArtifactH, len(args), len(args)+3)
|
||||
for i, arg := range args {
|
||||
p, ok := rosa.ResolveName(arg)
|
||||
if !ok {
|
||||
handles[i] = rosa.ArtifactH(unique.Make(arg))
|
||||
if meta, _ := rosa.Native().Std().Load(handles[i]); meta == nil {
|
||||
return fmt.Errorf("unknown artifact %q", arg)
|
||||
}
|
||||
presets[i] = p
|
||||
}
|
||||
|
||||
base := rosa.LLVM
|
||||
base := rosa.H("llvm")
|
||||
if !flagWithToolchain {
|
||||
base = rosa.Musl
|
||||
base = rosa.H("musl")
|
||||
}
|
||||
presets = append(presets,
|
||||
handles = append(handles,
|
||||
base,
|
||||
rosa.Mksh,
|
||||
rosa.Toybox,
|
||||
rosa.H("mksh"),
|
||||
rosa.H("toybox"),
|
||||
)
|
||||
|
||||
root := make(pkg.Collect, 0, 6+len(args))
|
||||
root = rosa.Std.AppendPresets(root, presets...)
|
||||
root = rosa.Native().Std().Append(root, handles...)
|
||||
|
||||
if err := cm.Do(func(cache *pkg.Cache) error {
|
||||
_, _, err := cache.Cure(&root)
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
rosa.DropCaches("", rosa.OptLLVMNoLTO)
|
||||
rosa.Native().DropCaches("", rosa.OptLLVMNoLTO)
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
@@ -35,10 +35,10 @@ func TestCureAll(t *testing.T) {
|
||||
}
|
||||
})
|
||||
|
||||
for i := range rosa.PresetEnd {
|
||||
p := rosa.PArtifact(i)
|
||||
t.Run(rosa.GetMetadata(p).Name, func(t *testing.T) {
|
||||
_, err := cureRemote(t.Context(), &addr, rosa.Std.Load(p), 0)
|
||||
for _, handle := range rosa.Native().Collect() {
|
||||
_, a := rosa.Native().Std().MustLoad(handle)
|
||||
t.Run(handle.String(), func(t *testing.T) {
|
||||
_, err := cureRemote(t.Context(), &addr, a, 0)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
@@ -139,7 +139,6 @@
|
||||
GOCACHE="$(mktemp -d)" \
|
||||
PATH="${pkgs.pkgsStatic.musl.bin}/bin:$PATH" \
|
||||
DESTDIR="$out" \
|
||||
HAKUREI_VERSION="v${hakurei.version}" \
|
||||
./all.sh
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -183,10 +183,10 @@ func TestExec(t *testing.T) {
|
||||
"checksum/OLBgp1GsljhM2TJ-sbHjaiH9txEUvgdDTAzHv2P24donTt6_529l-9Ua0vFImLlb": {Mode: 0400, Data: []byte{}},
|
||||
|
||||
"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/_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.OfflineS: {Mode: fs.ModeSymlink | 0777, Data: []byte("../checksum/" + wantOfflineEncode)},
|
||||
"identifier/vjz1MHPcGBKV7sjcs8jQP3cqxJ1hgPTiQBMCEHP9BGXjGxd-tJmEmXKaStObo5gK": {Mode: fs.ModeSymlink | 0777, Data: []byte("../checksum/MGWmEfjut2QE2xPJwTsmUzpff4BN_FEnQ7T0j7gvUCCiugJQNwqt9m151fm9D1yU")},
|
||||
|
||||
"substitute": {Mode: fs.ModeDir | 0700},
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package expected
|
||||
|
||||
const (
|
||||
Offline = "q5ktDTq0miP-VvB2blxqXQeaRXCUWgP_KbC18KNtUDtyoaI_h5mHmGuPMArVEBDs"
|
||||
OvlRoot = "NacZGXwuRkTvcHaG08a22ujJ8qCWN0RSoFlRSR5FSt0ZcBbJ28FRvkYsHEtX7G8i"
|
||||
Layers = "WBJDrATtX6rIE5yAu8ePX3WmDF0Tt9kFiue0m3cRnyRoVx1my8a67fh3CAW486oP"
|
||||
Net = "CmYtj2sNB3LHtqiDuck_Lz3MjLLIiwyP8N4NDitQ1Icvv__LVP9p8tm-sHeQaKKp"
|
||||
Promote = "TX3eCloaQFkV-SZIH6Jg6E5WKH--rcXY1P0jnZKmLFKWrNqnOzd4G9eIBh6i5ywN"
|
||||
Work = "OuNiLSC68pZhAOr1YQ4WbV1tzASA0nxLEBcK7lO7MqxDY_j8dmP_C612RTuF23Lu"
|
||||
Offline = "q5ktDTq0miP-VvB2blxqXQeaRXCUWgP_KbC18KNtUDtyoaI_h5mHmGuPMArVEBDs"
|
||||
OfflineS = "IY91PCtOpCYy21AaIK0c9f8-Z6fb2_2ewoHWkt4dxoLf0GOrWqS8yAGFLV84b1Dw"
|
||||
OvlRoot = "NacZGXwuRkTvcHaG08a22ujJ8qCWN0RSoFlRSR5FSt0ZcBbJ28FRvkYsHEtX7G8i"
|
||||
Layers = "WBJDrATtX6rIE5yAu8ePX3WmDF0Tt9kFiue0m3cRnyRoVx1my8a67fh3CAW486oP"
|
||||
Net = "CmYtj2sNB3LHtqiDuck_Lz3MjLLIiwyP8N4NDitQ1Icvv__LVP9p8tm-sHeQaKKp"
|
||||
Promote = "TX3eCloaQFkV-SZIH6Jg6E5WKH--rcXY1P0jnZKmLFKWrNqnOzd4G9eIBh6i5ywN"
|
||||
Work = "OuNiLSC68pZhAOr1YQ4WbV1tzASA0nxLEBcK7lO7MqxDY_j8dmP_C612RTuF23Lu"
|
||||
)
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package expected
|
||||
|
||||
const (
|
||||
Offline = "WapqyoPxbWSnq07dWHt71mHaJXq99pAjJfFlELlJljSiZMhTFqqlzU1_mN86shSj"
|
||||
OvlRoot = "V9anFOiRvjGfAeBhLl14AL8TKdWZyD0WTPYe4fS9mOBw8iW5Lmarvt6TG6MV8uWm"
|
||||
Layers = "tKx7JNRoSBdK_7MdzI-nwTNV2wmiPzwYdcd17oLmXKL_iLmUzUiA79qTqdrTasrv"
|
||||
Net = "aXyDLzBCJ9XltXZIfetEVsEkrqHfcXuD5XE_FcUnYbN3emwL55N6P8LlHzNfGnM5"
|
||||
Promote = "3k4V16n96Lq04gjFSKmm4sFjyQ883FFBNXgTy9s_DjeTwxT3pg_iacEh8yMb_S4m"
|
||||
Work = "6Q49MhFWRE3Ne6MycwAotgl1GtoU5WCHqJNWG2byYZCY-zX-IxPrWiKk7bKkNzhE"
|
||||
Offline = "WapqyoPxbWSnq07dWHt71mHaJXq99pAjJfFlELlJljSiZMhTFqqlzU1_mN86shSj"
|
||||
OfflineS = "ibQZHcdXgNQ1OiMX1FrburBbGPVvKEHvPilbQCkm_0oV0BQCHomyyTbYNrFMGIwl"
|
||||
OvlRoot = "V9anFOiRvjGfAeBhLl14AL8TKdWZyD0WTPYe4fS9mOBw8iW5Lmarvt6TG6MV8uWm"
|
||||
Layers = "tKx7JNRoSBdK_7MdzI-nwTNV2wmiPzwYdcd17oLmXKL_iLmUzUiA79qTqdrTasrv"
|
||||
Net = "aXyDLzBCJ9XltXZIfetEVsEkrqHfcXuD5XE_FcUnYbN3emwL55N6P8LlHzNfGnM5"
|
||||
Promote = "3k4V16n96Lq04gjFSKmm4sFjyQ883FFBNXgTy9s_DjeTwxT3pg_iacEh8yMb_S4m"
|
||||
Work = "6Q49MhFWRE3Ne6MycwAotgl1GtoU5WCHqJNWG2byYZCY-zX-IxPrWiKk7bKkNzhE"
|
||||
)
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package expected
|
||||
|
||||
const (
|
||||
Offline = "Z6yXE5gOJScL3srmnVMWgCXccDiUNZ5snSrf6RkXuU1_U0rX_kGVwsfHUgNG_awd"
|
||||
OvlRoot = "zYXJHFRLuxvUhuisZEXgGgVvdQd6piMfp5jmtT6jdVjvC2gICXquOq-UTwlrSD5I"
|
||||
Layers = "_F8EDazHbcLeT0sVSQXRN_kn9IjduqJcDYgzXpsT-hpKU4EBcZ0PISN2zchpqMbm"
|
||||
Net = "CA_FAaSIYJgapBEHV40doxpH23PdUEy_6s1TZc7wfSPN0XYqwGpMceXXDSabGveO"
|
||||
Promote = "_3LPrLp--4h9k4GsNNApu9hHtAafq-GUhfU6d4hJKBDKT3bz_szOsvkXxc5sK53d"
|
||||
Work = "FEgHeiCD_WT4wsfB-9kDH5n6cRWCEYtJmXdKZgmUUukAOoXumH_hLlosXREC-tqq"
|
||||
Offline = "Z6yXE5gOJScL3srmnVMWgCXccDiUNZ5snSrf6RkXuU1_U0rX_kGVwsfHUgNG_awd"
|
||||
OfflineS = "zN16xv6LKRJRipUJwupyxg2rZcvf-qpsMn_qCxUmgxlTSuNwYI70ZEb7dHW5k0gO"
|
||||
OvlRoot = "zYXJHFRLuxvUhuisZEXgGgVvdQd6piMfp5jmtT6jdVjvC2gICXquOq-UTwlrSD5I"
|
||||
Layers = "_F8EDazHbcLeT0sVSQXRN_kn9IjduqJcDYgzXpsT-hpKU4EBcZ0PISN2zchpqMbm"
|
||||
Net = "CA_FAaSIYJgapBEHV40doxpH23PdUEy_6s1TZc7wfSPN0XYqwGpMceXXDSabGveO"
|
||||
Promote = "_3LPrLp--4h9k4GsNNApu9hHtAafq-GUhfU6d4hJKBDKT3bz_szOsvkXxc5sK53d"
|
||||
Work = "FEgHeiCD_WT4wsfB-9kDH5n6cRWCEYtJmXdKZgmUUukAOoXumH_hLlosXREC-tqq"
|
||||
)
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Attr] = Metadata{
|
||||
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() {
|
||||
artifactsM[ACL] = Metadata{
|
||||
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,
|
||||
}
|
||||
}
|
||||
@@ -1,448 +0,0 @@
|
||||
package rosa
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"sync"
|
||||
|
||||
"hakurei.app/internal/pkg"
|
||||
)
|
||||
|
||||
// PArtifact is a lazily-initialised [pkg.Artifact] preset.
|
||||
type PArtifact int
|
||||
|
||||
const (
|
||||
LLVM PArtifact = iota
|
||||
|
||||
// EarlyInit is the Rosa OS init program.
|
||||
EarlyInit
|
||||
// ImageSystem is the Rosa OS /system image.
|
||||
ImageSystem
|
||||
// ImageInitramfs is the Rosa OS initramfs archive.
|
||||
ImageInitramfs
|
||||
|
||||
// Kernel is the generic Rosa OS Linux kernel.
|
||||
Kernel
|
||||
// KernelHeaders is an installation of kernel headers for [Kernel].
|
||||
KernelHeaders
|
||||
// KernelSource is a writable kernel source tree installed to [AbsUsrSrc].
|
||||
KernelSource
|
||||
// Firmware is firmware blobs for use with the Linux kernel.
|
||||
Firmware
|
||||
|
||||
ACL
|
||||
ArgpStandalone
|
||||
Attr
|
||||
Autoconf
|
||||
Automake
|
||||
BC
|
||||
Bash
|
||||
Binutils
|
||||
Bison
|
||||
Bzip2
|
||||
CMake
|
||||
Connman
|
||||
Coreutils
|
||||
Curl
|
||||
DBus
|
||||
DTC
|
||||
Diffutils
|
||||
Elfutils
|
||||
Fakeroot
|
||||
Findutils
|
||||
Flex
|
||||
FontUtil
|
||||
Freetype
|
||||
Fuse
|
||||
GMP
|
||||
GLib
|
||||
Gawk
|
||||
GenInitCPIO
|
||||
Gettext
|
||||
Git
|
||||
Glslang
|
||||
GnuTLS
|
||||
Go
|
||||
Gperf
|
||||
Grep
|
||||
Gzip
|
||||
Hakurei
|
||||
HakureiDist
|
||||
Hwdata
|
||||
IPTables
|
||||
Kmod
|
||||
LIT
|
||||
LibX11
|
||||
LibXau
|
||||
LibXdmcp
|
||||
LibXext
|
||||
LibXfixes
|
||||
LibXfont2
|
||||
LibXrandr
|
||||
LibXrender
|
||||
LibXxf86vm
|
||||
Libarchive
|
||||
Libbsd
|
||||
Libcap
|
||||
Libconfig
|
||||
LibdisplayInfo
|
||||
Libdrm
|
||||
Libepoxy
|
||||
Libev
|
||||
Libexpat
|
||||
Libffi
|
||||
Libfontenc
|
||||
Libgd
|
||||
Libglvnd
|
||||
Libiconv
|
||||
Libmd
|
||||
Libmnl
|
||||
Libnftnl
|
||||
Libpciaccess
|
||||
Libpng
|
||||
Libpsl
|
||||
Libseccomp
|
||||
Libtasn1
|
||||
Libtirpc
|
||||
Libtool
|
||||
Libucontext
|
||||
Libunistring
|
||||
Libva
|
||||
LibxcbRenderUtil
|
||||
LibxcbUtil
|
||||
LibxcbUtilImage
|
||||
LibxcbUtilKeysyms
|
||||
LibxcbUtilWM
|
||||
Libxcvt
|
||||
Libxkbfile
|
||||
Libxml2
|
||||
Libxshmfence
|
||||
Libxslt
|
||||
Libxtrans
|
||||
LMSensors
|
||||
M4
|
||||
MPC
|
||||
MPFR
|
||||
Make
|
||||
Mesa
|
||||
Meson
|
||||
Mksh
|
||||
MuslFts
|
||||
MuslObstack
|
||||
NSS
|
||||
NSSCACert
|
||||
Ncurses
|
||||
Nettle
|
||||
Ninja
|
||||
OpenSSL
|
||||
P11Kit
|
||||
PCRE2
|
||||
Parallel
|
||||
Patch
|
||||
Perl
|
||||
PerlLocaleGettext
|
||||
PerlMIMECharset
|
||||
PerlModuleBuild
|
||||
PerlPodParser
|
||||
PerlSGMLS
|
||||
PerlTermReadKey
|
||||
PerlTestCmd
|
||||
PerlTextCharWidth
|
||||
PerlTextWrapI18N
|
||||
PerlUnicodeLineBreak
|
||||
PerlYAMLTiny
|
||||
Pixman
|
||||
PkgConfig
|
||||
Procps
|
||||
Python
|
||||
PythonFlitCore
|
||||
PythonHatchling
|
||||
PythonIniConfig
|
||||
PythonMako
|
||||
PythonMarkupSafe
|
||||
PythonPackaging
|
||||
PythonPathspec
|
||||
PythonPluggy
|
||||
PythonPyTest
|
||||
PythonPyYAML
|
||||
PythonPycparser
|
||||
PythonPygments
|
||||
PythonSetuptools
|
||||
PythonSetuptoolsSCM
|
||||
PythonTroveClassifiers
|
||||
PythonVCSVersioning
|
||||
PythonWheel
|
||||
QEMU
|
||||
Rdfind
|
||||
Readline
|
||||
Rsync
|
||||
Ruby
|
||||
Sed
|
||||
SPIRVHeaders
|
||||
SPIRVLLVMTranslator
|
||||
SPIRVTools
|
||||
SquashfsTools
|
||||
Strace
|
||||
TamaGo
|
||||
Tar
|
||||
Texinfo
|
||||
Toybox
|
||||
toyboxEarly
|
||||
Unzip
|
||||
UtilLinux
|
||||
VIM
|
||||
Wayland
|
||||
WaylandProtocols
|
||||
XCB
|
||||
XCBProto
|
||||
XDGDBusProxy
|
||||
XZ
|
||||
Xkbcomp
|
||||
XkeyboardConfig
|
||||
XorgProto
|
||||
Xserver
|
||||
Zlib
|
||||
Zstd
|
||||
|
||||
// PresetUnexportedStart is the first unexported preset.
|
||||
PresetUnexportedStart
|
||||
|
||||
stage0Dist = iota - 1
|
||||
llvmSource
|
||||
// earlyCompilerRT is an early, standalone compiler-rt installation for the
|
||||
// standalone runtimes build.
|
||||
//
|
||||
// earlyCompilerRT must only be loaded by [LLVM].
|
||||
earlyCompilerRT
|
||||
// earlyRuntimes is an early, standalone installation of LLVM runtimes to
|
||||
// work around the cmake build system leaking the system LLVM installation
|
||||
// when invoking the newly built toolchain.
|
||||
//
|
||||
// earlyRuntimes must only be loaded by [LLVM].
|
||||
earlyRuntimes
|
||||
|
||||
buildcatrust
|
||||
utilMacros
|
||||
|
||||
// Musl is a standalone libc that does not depend on the toolchain.
|
||||
Musl
|
||||
// muslHeaders is a system installation of [Musl] headers.
|
||||
muslHeaders
|
||||
|
||||
// gcc is a hacked-to-pieces GCC toolchain meant for use in intermediate
|
||||
// stages only. This preset and its direct output must never be exposed.
|
||||
gcc
|
||||
|
||||
// nettle3 is an older version of [Nettle].
|
||||
nettle3
|
||||
|
||||
// Stage0 is a tarball containing all compile-time dependencies of artifacts
|
||||
// part of the [Std] toolchain.
|
||||
Stage0
|
||||
|
||||
// PresetEnd is the total number of presets and does not denote a preset.
|
||||
PresetEnd
|
||||
)
|
||||
|
||||
// P represents multiple [PArtifact] and is stable through JSON.
|
||||
type P []PArtifact
|
||||
|
||||
// MarshalJSON represents [PArtifact] by their [Metadata.Name].
|
||||
func (s P) MarshalJSON() ([]byte, error) {
|
||||
names := make([]string, len(s))
|
||||
for i, p := range s {
|
||||
names[i] = GetMetadata(p).Name
|
||||
}
|
||||
return json.Marshal(names)
|
||||
}
|
||||
|
||||
// UnmarshalJSON resolves the value created by MarshalJSON back to [P].
|
||||
func (s *P) UnmarshalJSON(data []byte) error {
|
||||
var names []string
|
||||
if err := json.Unmarshal(data, &names); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*s = make(P, len(names))
|
||||
for i, name := range names {
|
||||
if p, ok := ResolveName(name); !ok {
|
||||
return fmt.Errorf("unknown artifact %q", name)
|
||||
} else {
|
||||
(*s)[i] = p
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Metadata is stage-agnostic information of a [PArtifact] not directly
|
||||
// representable in the resulting [pkg.Artifact].
|
||||
type Metadata struct {
|
||||
f func(t Toolchain) (a pkg.Artifact, version string)
|
||||
|
||||
// Unique package name.
|
||||
Name string `json:"name"`
|
||||
// Short user-facing description.
|
||||
Description string `json:"description"`
|
||||
// Project home page.
|
||||
Website string `json:"website,omitempty"`
|
||||
|
||||
// Runtime dependencies.
|
||||
Dependencies P `json:"dependencies"`
|
||||
|
||||
// Project identifier on [Anitya].
|
||||
//
|
||||
// [Anitya]: https://release-monitoring.org/
|
||||
ID int `json:"-"`
|
||||
|
||||
// Optional custom version checking behaviour.
|
||||
latest func(v *Versions) string
|
||||
}
|
||||
|
||||
// GetLatest returns the latest version described by v.
|
||||
func (meta *Metadata) GetLatest(v *Versions) string {
|
||||
if meta.latest != nil {
|
||||
return meta.latest(v)
|
||||
}
|
||||
return v.Latest
|
||||
}
|
||||
|
||||
// Unversioned denotes an unversioned [PArtifact].
|
||||
const Unversioned = "\x00"
|
||||
|
||||
// UnpopulatedIDError is returned by [Metadata.GetLatest] for an instance of
|
||||
// [Metadata] where ID is not populated.
|
||||
type UnpopulatedIDError struct{}
|
||||
|
||||
func (UnpopulatedIDError) Unwrap() error { return errors.ErrUnsupported }
|
||||
func (UnpopulatedIDError) Error() string { return "Anitya ID is not populated" }
|
||||
|
||||
// Versions are package versions returned by Anitya.
|
||||
type Versions struct {
|
||||
// The latest version for the project, as determined by the version sorting algorithm.
|
||||
Latest string `json:"latest_version"`
|
||||
// List of all versions that aren’t flagged as pre-release.
|
||||
Stable []string `json:"stable_versions"`
|
||||
// List of all versions stored, sorted from newest to oldest.
|
||||
All []string `json:"versions"`
|
||||
}
|
||||
|
||||
// getStable returns the first Stable version, or Latest if that is unavailable.
|
||||
func (v *Versions) getStable() string {
|
||||
if len(v.Stable) == 0 {
|
||||
return v.Latest
|
||||
}
|
||||
return v.Stable[0]
|
||||
}
|
||||
|
||||
// GetVersions returns versions fetched from Anitya.
|
||||
func (meta *Metadata) GetVersions(ctx context.Context) (*Versions, error) {
|
||||
if meta.ID == 0 {
|
||||
return nil, UnpopulatedIDError{}
|
||||
}
|
||||
|
||||
var resp *http.Response
|
||||
if req, err := http.NewRequestWithContext(
|
||||
ctx,
|
||||
http.MethodGet,
|
||||
"https://release-monitoring.org/api/v2/versions/?project_id="+
|
||||
strconv.Itoa(meta.ID),
|
||||
nil,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
req.Header.Set("User-Agent", "Rosa/1.1")
|
||||
if resp, err = http.DefaultClient.Do(req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
var v Versions
|
||||
err := json.NewDecoder(resp.Body).Decode(&v)
|
||||
return &v, errors.Join(err, resp.Body.Close())
|
||||
}
|
||||
|
||||
var (
|
||||
// artifactsM is an array of [PArtifact] metadata.
|
||||
artifactsM [PresetEnd]Metadata
|
||||
|
||||
// artifacts stores the result of Metadata.f.
|
||||
artifacts [_toolchainEnd][len(artifactsM)]struct {
|
||||
a pkg.Artifact
|
||||
v string
|
||||
}
|
||||
// artifactsOnce is for lazy initialisation of artifacts.
|
||||
artifactsOnce [_toolchainEnd][len(artifactsM)]sync.Once
|
||||
|
||||
// arch is the target architecture.
|
||||
arch = runtime.GOARCH
|
||||
|
||||
// presetOpts globally modifies behaviour of presets.
|
||||
presetOpts int
|
||||
)
|
||||
|
||||
const (
|
||||
// OptSkipCheck skips running all test suites.
|
||||
OptSkipCheck = 1 << iota
|
||||
// OptLLVMNoLTO disables LTO in all [LLVM] stages.
|
||||
OptLLVMNoLTO
|
||||
)
|
||||
|
||||
// Arch returns the target architecture.
|
||||
func Arch() string { return arch }
|
||||
|
||||
// Flags returns the current preset flags
|
||||
func Flags() int { return presetOpts }
|
||||
|
||||
// zero zeros the value pointed to by p.
|
||||
func zero[T any](p *T) { var v T; *p = v }
|
||||
|
||||
// DropCaches arranges for all cached [pkg.Artifact] to be freed some time after
|
||||
// it returns. Must not be used concurrently with any other function from this
|
||||
// package.
|
||||
func DropCaches(targetArch string, flags int) {
|
||||
if targetArch == "" {
|
||||
targetArch = runtime.GOARCH
|
||||
}
|
||||
|
||||
arch = targetArch
|
||||
presetOpts = flags
|
||||
zero(&artifacts)
|
||||
zero(&artifactsOnce)
|
||||
}
|
||||
|
||||
// GetMetadata returns [Metadata] of a [PArtifact].
|
||||
func GetMetadata(p PArtifact) *Metadata { return &artifactsM[p] }
|
||||
|
||||
// construct constructs a [pkg.Artifact] corresponding to a [PArtifact] once.
|
||||
func (t Toolchain) construct(p PArtifact) {
|
||||
artifactsOnce[t][p].Do(func() {
|
||||
artifacts[t][p].a, artifacts[t][p].v = artifactsM[p].f(t)
|
||||
})
|
||||
}
|
||||
|
||||
// Load returns the resulting [pkg.Artifact] of [PArtifact].
|
||||
func (t Toolchain) Load(p PArtifact) pkg.Artifact {
|
||||
t.construct(p)
|
||||
return artifacts[t][p].a
|
||||
}
|
||||
|
||||
// Version returns the version string of [PArtifact].
|
||||
func (t Toolchain) Version(p PArtifact) string {
|
||||
t.construct(p)
|
||||
return artifacts[t][p].v
|
||||
}
|
||||
|
||||
// ResolveName returns a [PArtifact] by name.
|
||||
func ResolveName(name string) (p PArtifact, ok bool) {
|
||||
for i := range PresetUnexportedStart {
|
||||
if name == artifactsM[i].Name {
|
||||
return i, true
|
||||
}
|
||||
}
|
||||
return 0, false
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
package rosa_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"hakurei.app/internal/rosa"
|
||||
)
|
||||
|
||||
func TestLoad(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
for i := range rosa.PresetEnd {
|
||||
p := rosa.PArtifact(i)
|
||||
t.Run(rosa.GetMetadata(p).Name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
rosa.Std.Load(p)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkAll(b *testing.B) {
|
||||
arch, flags := rosa.Arch(), rosa.Flags()
|
||||
b.Cleanup(func() { rosa.DropCaches(arch, flags) })
|
||||
|
||||
for b.Loop() {
|
||||
for i := range rosa.PresetEnd {
|
||||
rosa.Std.Load(rosa.PArtifact(i))
|
||||
}
|
||||
|
||||
b.StopTimer()
|
||||
rosa.DropCaches("", 0)
|
||||
b.StartTimer()
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolveName(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
for i := range rosa.PresetUnexportedStart {
|
||||
p := i
|
||||
name := rosa.GetMetadata(p).Name
|
||||
t.Run(name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if got, ok := rosa.ResolveName(name); !ok {
|
||||
t.Fatal("ResolveName: ok = false")
|
||||
} else if got != p {
|
||||
t.Fatalf("ResolveName: %d, want %d", got, p)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
func TestResolveNameUnexported(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
for i := rosa.PresetUnexportedStart; i < rosa.PresetEnd; i++ {
|
||||
p := i
|
||||
name := rosa.GetMetadata(p).Name
|
||||
t.Run(name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if got, ok := rosa.ResolveName(name); ok {
|
||||
t.Fatalf("ResolveName: resolved unexported preset %d", got)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnique(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
names := make(map[string]struct{})
|
||||
for i := range rosa.PresetEnd {
|
||||
name := rosa.GetMetadata(rosa.PArtifact(i)).Name
|
||||
if _, ok := names[name]; ok {
|
||||
t.Fatalf("name %s is not unique", name)
|
||||
}
|
||||
names[name] = struct{}{}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
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() {
|
||||
artifactsM[ArgpStandalone] = Metadata{
|
||||
f: Toolchain.newArgpStandalone,
|
||||
|
||||
Name: "argp-standalone",
|
||||
Description: "hierarchical argument parsing library broken out from glibc",
|
||||
Website: "http://www.lysator.liu.se/~nisse/misc/",
|
||||
}
|
||||
}
|
||||
348
internal/rosa/azalea/azalea.go
Normal file
348
internal/rosa/azalea/azalea.go
Normal file
@@ -0,0 +1,348 @@
|
||||
// Package azalea implements a proof-of-concept, domain-specific language for
|
||||
// Rosa OS software packaging.
|
||||
package azalea
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"strconv"
|
||||
"text/scanner"
|
||||
)
|
||||
|
||||
// idents are runes accepted in an identifier.
|
||||
var idents = [...]bool{
|
||||
'0': true, '1': true, '2': true, '3': true, '4': true, '5': true, '6': true,
|
||||
'7': true, '8': true, '9': true,
|
||||
|
||||
'A': true, 'B': true, 'C': true, 'D': true, 'E': true, 'F': true, 'G': true,
|
||||
'H': true, 'I': true, 'J': true, 'K': true, 'L': true, 'M': true, 'N': true,
|
||||
'O': true, 'P': true, 'Q': true, 'R': true, 'S': true, 'T': true, 'U': true,
|
||||
'V': true, 'W': true, 'X': true, 'Y': true, 'Z': true,
|
||||
|
||||
'a': true, 'b': true, 'c': true, 'd': true, 'e': true, 'f': true, 'g': true,
|
||||
'h': true, 'i': true, 'j': true, 'k': true, 'l': true, 'm': true, 'n': true,
|
||||
'o': true, 'p': true, 'q': true, 'r': true, 's': true, 't': true, 'u': true,
|
||||
'v': true, 'w': true, 'x': true, 'y': true, 'z': true,
|
||||
|
||||
'-': true, '_': true,
|
||||
}
|
||||
|
||||
// TokenError describes an unexpected token.
|
||||
type TokenError [2]rune
|
||||
|
||||
func (e TokenError) Error() string {
|
||||
return "expected " + scanner.TokenString(e[0]) +
|
||||
", found " + scanner.TokenString(e[1])
|
||||
}
|
||||
|
||||
// ExprError is an unexpected token encountered while parsing an expression.
|
||||
type ExprError rune
|
||||
|
||||
func (e ExprError) Error() string {
|
||||
return "unexpected token " + scanner.TokenString(rune(e))
|
||||
}
|
||||
|
||||
// must1 returns v, or panics if err is not nil.
|
||||
func must1[T any](v T, err error) T {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// parser retains the current token.
|
||||
type parser struct {
|
||||
s scanner.Scanner
|
||||
tok rune
|
||||
}
|
||||
|
||||
// scan advances the underlying scanner to the next token, storing its result.
|
||||
func (p *parser) scan() rune { p.tok = p.s.Scan(); return p.tok }
|
||||
|
||||
// expects panics with [TokenError] for an unexpected tok.
|
||||
func (p *parser) expects(expects rune) {
|
||||
if p.tok != expects {
|
||||
panic(TokenError{expects, p.tok})
|
||||
}
|
||||
}
|
||||
|
||||
// scanAs advances the scanner for an expected token.
|
||||
func (p *parser) scanAs(expects rune) { p.scan(); p.expects(expects) }
|
||||
|
||||
// An Int is the value represented by an integer literal.
|
||||
type Int int64
|
||||
|
||||
func (v Int) GoString() string {
|
||||
return "azalea.Int(" + strconv.FormatInt(int64(v), 10) + ")"
|
||||
}
|
||||
|
||||
// parseInt parses the current token as a base 10 representation of a 64-bit
|
||||
// signed integer.
|
||||
func (p *parser) parseInt() Int {
|
||||
v, err := strconv.ParseInt(p.s.TokenText(), 10, 64)
|
||||
return must1(Int(v), err)
|
||||
}
|
||||
|
||||
// A String holds the unquoted content of a string literal.
|
||||
type String string
|
||||
|
||||
func (v String) GoString() string {
|
||||
return "azalea.String(" + strconv.Quote(string(v)) + ")"
|
||||
}
|
||||
|
||||
// parseString parses the current token as a string.
|
||||
func (p *parser) parseString() String {
|
||||
s, err := strconv.Unquote(p.s.TokenText())
|
||||
return must1(String(s), err)
|
||||
}
|
||||
|
||||
// An Ident holds the name of an identifier.
|
||||
type Ident string
|
||||
|
||||
func (v Ident) GoString() string {
|
||||
return "azalea.Ident(" + strconv.Quote(string(v)) + ")"
|
||||
}
|
||||
|
||||
// A Val are statements joined by the '+' operator. Only the [String] type
|
||||
// supports concatenation.
|
||||
type Val []any
|
||||
|
||||
// parseVal parses until the end of the [Val].
|
||||
func (p *parser) parseVal() (v Val) {
|
||||
v = append(v, p.parseExpr())
|
||||
for p.tok == '+' {
|
||||
p.scan()
|
||||
v = append(v, p.parseExpr())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// An Array holds statements in an array.
|
||||
type Array []Val
|
||||
|
||||
// A KV holds a key/value pair.
|
||||
type KV struct {
|
||||
K String
|
||||
V Val
|
||||
}
|
||||
|
||||
// An Arg represents an argument of [Func].
|
||||
type Arg struct {
|
||||
K []Ident
|
||||
V Val
|
||||
R bool
|
||||
}
|
||||
|
||||
// Func is a function call or package declaration.
|
||||
type Func struct {
|
||||
// Function or package identifier.
|
||||
Ident Ident
|
||||
// Whether this is a package declaration.
|
||||
Package bool
|
||||
// Key-value arguments.
|
||||
Args []Arg
|
||||
}
|
||||
|
||||
// parseExpr parses the current expression.
|
||||
func (p *parser) parseExpr() any {
|
||||
switch p.tok {
|
||||
case scanner.Int:
|
||||
v := p.parseInt()
|
||||
p.scan()
|
||||
return v
|
||||
|
||||
case scanner.String, scanner.RawString:
|
||||
v := p.parseString()
|
||||
p.scan()
|
||||
return v
|
||||
|
||||
case scanner.Ident:
|
||||
var v Func
|
||||
v.Ident = Ident(p.s.TokenText())
|
||||
if v.Package = v.Ident == "package"; v.Package {
|
||||
p.scanAs(scanner.Ident)
|
||||
v.Ident = Ident(p.s.TokenText())
|
||||
}
|
||||
|
||||
p.scan()
|
||||
switch p.tok {
|
||||
case '{':
|
||||
for {
|
||||
p.scan()
|
||||
switch p.tok {
|
||||
case '}':
|
||||
p.scan()
|
||||
return v
|
||||
|
||||
case scanner.Ident:
|
||||
break
|
||||
|
||||
default:
|
||||
panic(TokenError{scanner.Ident, p.tok})
|
||||
}
|
||||
|
||||
arg := Arg{K: []Ident{Ident(p.s.TokenText())}}
|
||||
delim := true
|
||||
arg:
|
||||
for {
|
||||
p.scan()
|
||||
switch p.tok {
|
||||
case ',':
|
||||
if delim {
|
||||
delim = false
|
||||
continue
|
||||
}
|
||||
panic(ExprError(p.tok))
|
||||
|
||||
case scanner.Ident:
|
||||
if delim {
|
||||
panic(TokenError{',', p.tok})
|
||||
}
|
||||
delim = true
|
||||
arg.K = append(arg.K, Ident(p.s.TokenText()))
|
||||
|
||||
default:
|
||||
break arg
|
||||
}
|
||||
}
|
||||
switch p.tok {
|
||||
case '=':
|
||||
break
|
||||
|
||||
case '*':
|
||||
arg.R = true
|
||||
p.scanAs('=')
|
||||
|
||||
default:
|
||||
panic(TokenError{'=', p.tok})
|
||||
}
|
||||
p.scan()
|
||||
arg.V = p.parseVal()
|
||||
v.Args = append(v.Args, arg)
|
||||
p.expects(';')
|
||||
}
|
||||
|
||||
default:
|
||||
return v.Ident
|
||||
}
|
||||
|
||||
case '{':
|
||||
var v []KV
|
||||
for {
|
||||
p.scan()
|
||||
switch p.tok {
|
||||
case '}':
|
||||
p.scan()
|
||||
return v
|
||||
|
||||
case scanner.String:
|
||||
pair := KV{K: p.parseString()}
|
||||
p.scan()
|
||||
switch p.tok {
|
||||
case ';':
|
||||
break
|
||||
|
||||
case ':':
|
||||
p.scan()
|
||||
pair.V = p.parseVal()
|
||||
p.expects(';')
|
||||
break
|
||||
|
||||
default:
|
||||
panic(ExprError(p.tok))
|
||||
}
|
||||
v = append(v, pair)
|
||||
|
||||
default:
|
||||
panic(ExprError(p.tok))
|
||||
}
|
||||
}
|
||||
|
||||
case '[':
|
||||
var (
|
||||
v Array
|
||||
delim bool
|
||||
)
|
||||
p.scan()
|
||||
for {
|
||||
switch p.tok {
|
||||
case ',':
|
||||
if delim {
|
||||
p.scan()
|
||||
delim = false
|
||||
continue
|
||||
}
|
||||
panic(ExprError(','))
|
||||
case ']':
|
||||
p.scan()
|
||||
return v
|
||||
case scanner.EOF:
|
||||
panic(ExprError(scanner.EOF))
|
||||
default:
|
||||
if delim {
|
||||
panic(TokenError{',', p.tok})
|
||||
}
|
||||
delim = true
|
||||
break
|
||||
}
|
||||
v = append(v, p.parseVal())
|
||||
}
|
||||
|
||||
default:
|
||||
panic(ExprError(p.tok))
|
||||
}
|
||||
}
|
||||
|
||||
// ScanError is the error count parsing all expressions.
|
||||
type ScanError int
|
||||
|
||||
func (ScanError) Error() string {
|
||||
return "aborting due to scanning errors"
|
||||
}
|
||||
|
||||
// Parse parses expressions from r.
|
||||
func Parse(r io.Reader) (e []any, err error) {
|
||||
var p parser
|
||||
p.s.Init(r)
|
||||
|
||||
p.s.Mode = scanner.ScanIdents |
|
||||
scanner.ScanInts |
|
||||
scanner.ScanStrings |
|
||||
scanner.ScanRawStrings |
|
||||
scanner.ScanComments |
|
||||
scanner.SkipComments
|
||||
p.s.IsIdentRune = func(ch rune, i int) bool {
|
||||
if i == 0 && ch >= '0' && ch <= '9' {
|
||||
return false
|
||||
}
|
||||
return ch > 0 && ch < rune(len(idents)) && idents[ch]
|
||||
}
|
||||
|
||||
defer func() {
|
||||
v := recover()
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
|
||||
_err, ok := v.(error)
|
||||
if !ok {
|
||||
panic(v)
|
||||
}
|
||||
|
||||
if err == nil {
|
||||
err = _err
|
||||
return
|
||||
}
|
||||
err = errors.Join(err, _err)
|
||||
}()
|
||||
|
||||
p.scan()
|
||||
for p.tok != scanner.EOF {
|
||||
e = append(e, p.parseExpr())
|
||||
}
|
||||
|
||||
if p.s.ErrorCount != 0 {
|
||||
err = ScanError(p.s.ErrorCount)
|
||||
}
|
||||
return
|
||||
}
|
||||
169
internal/rosa/azalea/azalea_test.go
Normal file
169
internal/rosa/azalea/azalea_test.go
Normal file
@@ -0,0 +1,169 @@
|
||||
package azalea_test
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
"text/scanner"
|
||||
|
||||
. "hakurei.app/internal/rosa/azalea"
|
||||
)
|
||||
|
||||
//go:embed testdata/gcc.az
|
||||
var sample string
|
||||
|
||||
func TestParse(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
data string
|
||||
want []any
|
||||
err error
|
||||
}{
|
||||
{"invalid", "}", nil, ExprError('}')},
|
||||
{"bad sep", "f{v?}", nil, TokenError{'=', '?'}},
|
||||
{"bad ident", "f{9}", nil, TokenError{scanner.Ident, scanner.Int}},
|
||||
{"share bad sep", "f { v,,v = v; }", nil, ExprError(',')},
|
||||
{"share missing sep", "f { v v }", nil, TokenError{',', scanner.Ident}},
|
||||
|
||||
{"ident", `v`, []any{Ident("v")}, nil},
|
||||
{"concat", `f { v = v+"\xfd"+p{}+9; }`, []any{Func{
|
||||
Ident: "f",
|
||||
|
||||
Args: []Arg{{K: []Ident{"v"}, V: Val{
|
||||
Ident("v"),
|
||||
String("\xfd"),
|
||||
Func{Ident: "p"},
|
||||
Int(9),
|
||||
}}},
|
||||
}}, nil},
|
||||
{"truncated string concat", `f { v = v+; }`, nil,
|
||||
ExprError(';')},
|
||||
|
||||
{"empty pairs", `{}`, []any{[]KV(nil)}, nil},
|
||||
{"short kv", `{"\x00":v;}`, []any{[]KV{
|
||||
{K: "\x00", V: Val{Ident("v")}},
|
||||
}}, nil},
|
||||
{"truncated kv", `{"\x00"`, nil, ExprError(scanner.EOF)},
|
||||
{"ident kv", `{v="";}`, nil, ExprError(scanner.Ident)},
|
||||
|
||||
{"empty array", `[]`, []any{Array(nil)}, nil},
|
||||
{"integer array", `[9]`, []any{Array{{Int(9)}}}, nil},
|
||||
{"short array", `[ "\x00" ]`, []any{
|
||||
Array{{String("\x00")}},
|
||||
}, nil},
|
||||
{"short array delim", `[ "\x00", ]`, []any{
|
||||
Array{{String("\x00")}},
|
||||
}, nil},
|
||||
{"missing array value", `[ "\x00", , v ]`, nil, ExprError(',')},
|
||||
{"missing array delimiter", `[ v0 v1 ]`, nil, TokenError{',', scanner.Ident}},
|
||||
{"truncated array", `[ "\x00"`, nil,
|
||||
ExprError(scanner.EOF)},
|
||||
|
||||
{"gcc", sample, []any{Func{
|
||||
Ident: Ident("gcc"),
|
||||
Package: true,
|
||||
|
||||
Args: []Arg{
|
||||
{K: []Ident{Ident("description")}, V: Val{String("The GNU Compiler Collection")}},
|
||||
{K: []Ident{Ident("website")}, V: Val{String("https://www.gnu.org/software/gcc")}},
|
||||
{K: []Ident{Ident("anitya")}, V: Val{Int(6502)}},
|
||||
|
||||
{K: []Ident{Ident("version")}, V: Val{String("16.1.0")}, R: true},
|
||||
{K: []Ident{Ident("source")}, V: Val{Func{
|
||||
Ident: Ident("remoteTar"),
|
||||
|
||||
Args: []Arg{
|
||||
{K: []Ident{Ident("url")}, V: Val{
|
||||
String("https://ftp.tsukuba.wide.ad.jp/software/gcc/releases/"),
|
||||
String("gcc-"),
|
||||
Ident("version"),
|
||||
String("/gcc-"),
|
||||
Ident("version"),
|
||||
String(".tar.gz"),
|
||||
}},
|
||||
{K: []Ident{Ident("checksum")}, V: Val{String("4ASoWbxaA2FW7PAB0zzHDPC5XnNhyaAyjtDPpGzceSLeYnEIXsNYZR3PA_Zu5P0K")}},
|
||||
{K: []Ident{Ident("compress")}, V: Val{Ident("gzip")}},
|
||||
},
|
||||
}}},
|
||||
{K: []Ident{Ident("patches")}, V: Val{Array{
|
||||
{String("musl-off64_t-loff_t.patch")},
|
||||
{String("musl-legacy-lfs.patch")},
|
||||
}}},
|
||||
|
||||
{K: []Ident{Ident("exclusive")}, V: Val{Ident("true")}},
|
||||
|
||||
{K: []Ident{Ident("exec")}, V: Val{Func{
|
||||
Ident: Ident("make"),
|
||||
|
||||
Args: []Arg{
|
||||
{K: []Ident{Ident("configure")}, V: Val{[]KV{
|
||||
{K: String("disable-multilib")},
|
||||
{K: String("enable-default-pie")},
|
||||
{K: String("disable-nls")},
|
||||
{K: String("with-gnu-as")},
|
||||
{K: String("with-gnu-ld")},
|
||||
{K: String("with-system-zlib")},
|
||||
{K: String("enable-languages"), V: Val{String("c,c++,go")}},
|
||||
{K: String("with-native-system-header-dir"), V: Val{String("/system/include")}},
|
||||
{K: String("with-multilib-list"), V: Val{Func{
|
||||
Ident: Ident("arch"),
|
||||
|
||||
Args: []Arg{
|
||||
{K: []Ident{Ident("amd64"), Ident("arm64")}, V: Val{String("''")}},
|
||||
{K: []Ident{Ident("default")}, V: Val{Ident("unset")}},
|
||||
},
|
||||
}}},
|
||||
}}},
|
||||
{K: []Ident{Ident("make")}, V: Val{Array{
|
||||
{String("BOOT_CFLAGS='-O2 -g'")},
|
||||
{
|
||||
Func{Ident: Ident("noop"), Args: []Arg{{K: []Ident{Ident("key")}, V: Val{Ident("value")}}}},
|
||||
String("\x00"),
|
||||
},
|
||||
{String("bootstrap")},
|
||||
}}},
|
||||
|
||||
{K: []Ident{Ident("skip-check")}, V: Val{Ident("true")}},
|
||||
},
|
||||
}}},
|
||||
|
||||
{K: []Ident{Ident("inputs")}, V: Val{Array{
|
||||
{Ident("binutils")},
|
||||
{Ident("mpc")},
|
||||
{Ident("zlib")},
|
||||
{Ident("libucontext")},
|
||||
{Ident("kernel-headers")},
|
||||
}}},
|
||||
},
|
||||
}}, nil},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
p, err := Parse(strings.NewReader(tc.data))
|
||||
if !reflect.DeepEqual(p, tc.want) {
|
||||
t.Errorf("Parse: %#v, want %#v", p, tc.want)
|
||||
}
|
||||
if !reflect.DeepEqual(err, tc.err) {
|
||||
t.Errorf("Parse: error = %v, want %v", err, tc.err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkParse(b *testing.B) {
|
||||
r := strings.NewReader(sample)
|
||||
for b.Loop() {
|
||||
if _, err := Parse(r); err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
|
||||
b.StopTimer()
|
||||
r.Reset(sample)
|
||||
b.StartTimer()
|
||||
}
|
||||
}
|
||||
392
internal/rosa/azalea/evaluate.go
Normal file
392
internal/rosa/azalea/evaluate.go
Normal file
@@ -0,0 +1,392 @@
|
||||
package azalea
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"maps"
|
||||
"reflect"
|
||||
"slices"
|
||||
"unique"
|
||||
)
|
||||
|
||||
// Value are types supported by the language.
|
||||
type Value interface {
|
||||
bool | int64 | string | []string | []int64 | [][2]string
|
||||
}
|
||||
|
||||
type (
|
||||
// FArg is an argument passed to [F].
|
||||
FArg struct {
|
||||
K unique.Handle[Ident]
|
||||
V any
|
||||
R bool
|
||||
}
|
||||
// FArgs are arguments passed to [F].
|
||||
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 struct {
|
||||
F func(args FArgs) (v any, set bool, err error)
|
||||
V map[unique.Handle[Ident]]any
|
||||
}
|
||||
)
|
||||
|
||||
// Apply applies named arguments and rejects unused arguments.
|
||||
func (args FArgs) Apply(v map[unique.Handle[Ident]]any) error {
|
||||
for _, arg := range args {
|
||||
if arg.V == nil {
|
||||
// unset
|
||||
continue
|
||||
}
|
||||
|
||||
r, ok := v[arg.K]
|
||||
if !ok {
|
||||
if arg.R {
|
||||
continue
|
||||
}
|
||||
return UndefinedError(arg.K.Value())
|
||||
}
|
||||
err := storeE(r, arg.V)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// A Frame refers to local variables and debugging information.
|
||||
type Frame struct {
|
||||
// Local constants.
|
||||
Val map[unique.Handle[Ident]]any
|
||||
// Functions.
|
||||
Func map[unique.Handle[Ident]]F
|
||||
}
|
||||
|
||||
// UnsupportedExprError is an expression with invalid concrete type.
|
||||
type UnsupportedExprError struct{ E any }
|
||||
|
||||
func (e UnsupportedExprError) Error() string {
|
||||
return fmt.Sprintf("unsupported expression %#v", e.E)
|
||||
}
|
||||
|
||||
// UndefinedError is an identifier not defined in any stack frame visible to the
|
||||
// expression containing it.
|
||||
type UndefinedError Ident
|
||||
|
||||
func (e UndefinedError) Error() string {
|
||||
return "undefined: " + string(e)
|
||||
}
|
||||
|
||||
// evaluate is evaluateAny with a type parameter.
|
||||
func evaluate[T Value](d PF, s []Frame, expr any, rp *T) bool {
|
||||
return evaluateAny(d, 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.
|
||||
type TypeError struct {
|
||||
Concrete, Asserted reflect.Type
|
||||
}
|
||||
|
||||
func (e TypeError) Error() string {
|
||||
return fmt.Sprintf("expected %s, got %s", e.Asserted, e.Concrete)
|
||||
}
|
||||
|
||||
func (e TypeError) Is(err error) bool {
|
||||
var v TypeError
|
||||
return errors.As(err, &v) &&
|
||||
e.Asserted == v.Asserted &&
|
||||
e.Concrete == v.Concrete
|
||||
}
|
||||
|
||||
// storeE is a convenience function to set the value of a result pointer.
|
||||
func storeE(rp any, r any) error {
|
||||
pv := reflect.ValueOf(rp).Elem()
|
||||
v := reflect.ValueOf(r)
|
||||
pt, vt := pv.Type(), v.Type()
|
||||
if !vt.AssignableTo(pt) {
|
||||
return TypeError{vt, pt}
|
||||
}
|
||||
pv.Set(v)
|
||||
return nil
|
||||
}
|
||||
|
||||
// store is like storeE, but panics if error is non-nil.
|
||||
func store[T Value](rp any, r T) {
|
||||
err := storeE(rp, r)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// EvaluationError is an error and the expression it occurred in.
|
||||
type EvaluationError struct {
|
||||
Expr any
|
||||
Err error
|
||||
}
|
||||
|
||||
// Unwrap returns the underlying error.
|
||||
func (e EvaluationError) Unwrap() error { return e.Err }
|
||||
|
||||
// Error returns a very long error description that should not be presented
|
||||
// to the user directly.
|
||||
func (e EvaluationError) Error() string {
|
||||
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].
|
||||
func evaluateAny(d PF, s []Frame, expr, rp any) bool {
|
||||
defer func() {
|
||||
r := recover()
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
|
||||
err, ok := r.(error)
|
||||
if !ok {
|
||||
panic(r)
|
||||
}
|
||||
|
||||
if _, ok = err.(EvaluationError); ok {
|
||||
panic(err)
|
||||
}
|
||||
panic(EvaluationError{expr, err})
|
||||
}()
|
||||
|
||||
switch e := expr.(type) {
|
||||
case Int:
|
||||
store(rp, int64(e))
|
||||
return true
|
||||
|
||||
case String:
|
||||
store(rp, string(e))
|
||||
return true
|
||||
|
||||
case Ident:
|
||||
var (
|
||||
v any
|
||||
ok bool
|
||||
)
|
||||
for i := range s {
|
||||
v, ok = s[len(s)-1-i].Val[unique.Make(e)]
|
||||
if ok {
|
||||
break
|
||||
}
|
||||
}
|
||||
if !ok {
|
||||
panic(UndefinedError(e))
|
||||
}
|
||||
if err := storeE(rp, v); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return true
|
||||
|
||||
case Val:
|
||||
if len(e) == 1 {
|
||||
switch v := e[0].(type) {
|
||||
case Ident:
|
||||
switch v {
|
||||
case "unset":
|
||||
return false
|
||||
case "true":
|
||||
store(rp, true)
|
||||
return true
|
||||
case "false":
|
||||
store(rp, false)
|
||||
return true
|
||||
default:
|
||||
return evaluateAny(d, s, v, rp)
|
||||
}
|
||||
|
||||
default:
|
||||
return evaluateAny(d, s, e[0], rp)
|
||||
}
|
||||
}
|
||||
var v string
|
||||
for i := range e {
|
||||
var _r string
|
||||
if evaluate(d, s, e[i], &_r) {
|
||||
v += _r
|
||||
}
|
||||
}
|
||||
store(rp, v)
|
||||
return true
|
||||
|
||||
case Array:
|
||||
if len(e) > 0 && len(e[0]) == 1 {
|
||||
if _, ok := e[0][0].(Int); ok {
|
||||
store(rp, evaluateArray[int64](d, s, e))
|
||||
return true
|
||||
}
|
||||
}
|
||||
store(rp, evaluateArray[string](d, s, e))
|
||||
return true
|
||||
|
||||
case []KV:
|
||||
r := make([][2]string, 0, len(e))
|
||||
for i := range e {
|
||||
var _r string
|
||||
if e[i].V == nil || evaluate(d, s, e[i].V, &_r) {
|
||||
r = append(r, [2]string{string(e[i].K), _r})
|
||||
}
|
||||
}
|
||||
store(rp, r)
|
||||
return true
|
||||
|
||||
case Func:
|
||||
var (
|
||||
f F
|
||||
ok bool
|
||||
)
|
||||
if !e.Package {
|
||||
for i := range s {
|
||||
f, ok = s[len(s)-1-i].Func[unique.Make(e.Ident)]
|
||||
if ok {
|
||||
break
|
||||
}
|
||||
}
|
||||
if !ok {
|
||||
panic(UndefinedError(e.Ident))
|
||||
}
|
||||
}
|
||||
|
||||
argc := len(e.Args)
|
||||
for _, arg := range e.Args {
|
||||
argc += len(arg.K) - 1
|
||||
}
|
||||
fargs := make([]FArg, 0, len(e.Args))
|
||||
s = append(s, Frame{})
|
||||
fp := &s[len(s)-1]
|
||||
if !e.Package {
|
||||
fp.Val = maps.Clone(f.V)
|
||||
}
|
||||
|
||||
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}
|
||||
if e.Package {
|
||||
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
|
||||
}
|
||||
for _, name := range names {
|
||||
farg.K = name
|
||||
fargs = append(fargs, farg)
|
||||
|
||||
if arg.R && farg.V != nil {
|
||||
if fp.Val == nil {
|
||||
fp.Val = make(map[unique.Handle[Ident]]any)
|
||||
}
|
||||
(*fp).Val[name] = farg.V
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
v any
|
||||
err error
|
||||
)
|
||||
if !e.Package {
|
||||
v, ok, err = f.F(fargs)
|
||||
} else {
|
||||
v, ok, err = d(e.Ident, fargs)
|
||||
}
|
||||
if err != nil {
|
||||
panic(err)
|
||||
} else if v != nil {
|
||||
if err = storeE(rp, v); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
return ok
|
||||
|
||||
default:
|
||||
panic(UnsupportedExprError{expr})
|
||||
}
|
||||
}
|
||||
|
||||
// Evaluate evaluates a statement and returns its value.
|
||||
func Evaluate[T any](d PF, s []Frame, expr any) (v T, set bool, err error) {
|
||||
defer func() {
|
||||
r := recover()
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
|
||||
_err, ok := r.(error)
|
||||
if !ok {
|
||||
panic(r)
|
||||
}
|
||||
err = _err
|
||||
}()
|
||||
set = evaluateAny(d, s, expr, &v)
|
||||
return
|
||||
}
|
||||
407
internal/rosa/azalea/evaluate_test.go
Normal file
407
internal/rosa/azalea/evaluate_test.go
Normal file
@@ -0,0 +1,407 @@
|
||||
package azalea_test
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
"unique"
|
||||
|
||||
. "hakurei.app/internal/rosa/azalea"
|
||||
)
|
||||
|
||||
// makeStackCheck creates a stack with a single frame with a single function "f"
|
||||
// which calls the check function internally.
|
||||
func makeStackCheck(check func(args FArgs) (any, error)) []Frame {
|
||||
return []Frame{{Func: map[unique.Handle[Ident]]F{
|
||||
unique.Make(Ident("f")): {F: func(
|
||||
args FArgs,
|
||||
) (v any, set bool, err error) {
|
||||
set = true
|
||||
v, err = check(args)
|
||||
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) {
|
||||
t.Parallel()
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
data string
|
||||
s []Frame
|
||||
want any
|
||||
err error
|
||||
}{
|
||||
{"apply unset", `f { v = unset; }`, makeStackCheck(func(
|
||||
args FArgs,
|
||||
) (v any, err error) {
|
||||
v = "\xfd"
|
||||
err = args.Apply(map[unique.Handle[Ident]]any{
|
||||
unique.Make(Ident("v")): &v,
|
||||
})
|
||||
return
|
||||
}), "\xfd", nil},
|
||||
|
||||
{"apply bad type", `f { v = 9; }`, makeStackCheck(func(
|
||||
args FArgs,
|
||||
) (v any, err error) {
|
||||
v = "\xfd"
|
||||
err = args.Apply(map[unique.Handle[Ident]]any{
|
||||
unique.Make(Ident("v")): &v,
|
||||
})
|
||||
return
|
||||
}), "", TypeError{
|
||||
Concrete: reflect.TypeFor[int64](),
|
||||
Asserted: reflect.TypeFor[string](),
|
||||
}},
|
||||
|
||||
{"apply undefined", `f { v = 9; }`, makeStackCheck(func(
|
||||
args FArgs,
|
||||
) (v any, err error) {
|
||||
v = "\xfd"
|
||||
err = args.Apply(map[unique.Handle[Ident]]any{})
|
||||
return
|
||||
}), "", EvaluationError{
|
||||
Expr: Func{
|
||||
Ident: Ident("f"),
|
||||
Args: []Arg{
|
||||
{K: []Ident{"v"}, V: Val{Int(9)}},
|
||||
},
|
||||
},
|
||||
Err: UndefinedError("v"),
|
||||
}},
|
||||
|
||||
{"apply bound undefined", `f { _v* = "\x00"; v = _v; }`, makeStackCheck(func(
|
||||
args FArgs,
|
||||
) (v any, err error) {
|
||||
v = "\xfd"
|
||||
err = args.Apply(map[unique.Handle[Ident]]any{
|
||||
unique.Make(Ident("v")): &v,
|
||||
})
|
||||
return
|
||||
}), "\x00", nil},
|
||||
|
||||
{"undefined function", `f {}`, nil, "", EvaluationError{
|
||||
Expr: Func{Ident: "f"},
|
||||
Err: UndefinedError("f"),
|
||||
}},
|
||||
|
||||
{"error wrap deep", `f { v = nil; }`, makeStackCheck(func(
|
||||
FArgs,
|
||||
) (any, error) {
|
||||
panic("unreachable")
|
||||
}), "", EvaluationError{
|
||||
Expr: Ident("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 {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var expr Func
|
||||
if e, err := Parse(strings.NewReader(tc.data)); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if len(e) != 1 {
|
||||
t.Fatalf("got expression %#v", e)
|
||||
} else {
|
||||
expr = e[0].(Func)
|
||||
}
|
||||
const rPackage = "\xff\xff\xff\xff"
|
||||
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) {
|
||||
t.Error("Evaluate: unexpected unset")
|
||||
}
|
||||
|
||||
if r != rPackage && r != tc.want {
|
||||
t.Errorf("Evaluate: %q, want %q", r, tc.want)
|
||||
}
|
||||
|
||||
var errEquals bool
|
||||
if errors.As(err, new(TypeError)) {
|
||||
errEquals = errors.Is(err, tc.err)
|
||||
} else {
|
||||
errEquals = reflect.DeepEqual(err, tc.err)
|
||||
}
|
||||
if !errEquals {
|
||||
t.Errorf("Evaluate: error = %v, want %v", err, tc.err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestEvaluateGCC(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var gcc Func
|
||||
if e, err := Parse(strings.NewReader(sample)); err != nil {
|
||||
t.Fatal(err)
|
||||
} else {
|
||||
gcc = e[0].(Func)
|
||||
}
|
||||
|
||||
var got [3]FArgs
|
||||
if r, set, err := Evaluate[string](func(
|
||||
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{
|
||||
unique.Make(Ident("remoteTar")): {F: func(
|
||||
args FArgs,
|
||||
) (v any, set bool, err error) {
|
||||
var url, checksum string
|
||||
var compress int
|
||||
if err = args.Apply(map[unique.Handle[Ident]]any{
|
||||
unique.Make(Ident("url")): &url,
|
||||
unique.Make(Ident("checksum")): &checksum,
|
||||
unique.Make(Ident("compress")): &compress,
|
||||
}); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if compress != 0xcafe {
|
||||
err = fmt.Errorf("unexpected compress %#v", compress)
|
||||
}
|
||||
set = true
|
||||
v = url + "?checksum=" + checksum
|
||||
return
|
||||
}, V: map[unique.Handle[Ident]]any{
|
||||
unique.Make(Ident("gzip")): 0xcafe,
|
||||
}},
|
||||
|
||||
unique.Make(Ident("make")): {F: func(
|
||||
args FArgs,
|
||||
) (v any, set bool, err error) {
|
||||
v = args
|
||||
set = true
|
||||
return
|
||||
}},
|
||||
|
||||
unique.Make(Ident("arch")): {F: func(
|
||||
args FArgs,
|
||||
) (v any, set bool, err error) {
|
||||
set = false
|
||||
got[1] = args
|
||||
return
|
||||
}},
|
||||
|
||||
unique.Make(Ident("noop")): {F: func(
|
||||
args FArgs,
|
||||
) (v any, set bool, err error) {
|
||||
set = false
|
||||
set = true
|
||||
got[2] = args
|
||||
return
|
||||
}, V: map[unique.Handle[Ident]]any{
|
||||
unique.Make(Ident("value")): "\xfd",
|
||||
}},
|
||||
},
|
||||
}}, gcc); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if r != "\x00" {
|
||||
t.Fatalf("package: %q", r)
|
||||
} else if !set {
|
||||
t.Fatal("package: unset")
|
||||
}
|
||||
|
||||
want := [...]FArgs{
|
||||
{
|
||||
{K: unique.Make(Ident("description")), V: "The GNU Compiler Collection"},
|
||||
{K: unique.Make(Ident("website")), V: "https://www.gnu.org/software/gcc"},
|
||||
{K: unique.Make(Ident("anitya")), V: int64(6502)},
|
||||
|
||||
{K: unique.Make(Ident("version")), V: "16.1.0", R: true},
|
||||
{K: unique.Make(Ident("source")), V: "https://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-16.1.0/gcc-16.1.0.tar.gz?checksum=4ASoWbxaA2FW7PAB0zzHDPC5XnNhyaAyjtDPpGzceSLeYnEIXsNYZR3PA_Zu5P0K"},
|
||||
{K: unique.Make(Ident("patches")), V: []string{"musl-off64_t-loff_t.patch", "musl-legacy-lfs.patch"}},
|
||||
|
||||
{K: unique.Make(Ident("exclusive")), V: true},
|
||||
{K: unique.Make(Ident("exec")), V: FArgs{
|
||||
{K: unique.Make(Ident("configure")), V: [][2]string{
|
||||
{"disable-multilib", ""},
|
||||
{"enable-default-pie", ""},
|
||||
{"disable-nls", ""},
|
||||
{"with-gnu-as", ""},
|
||||
{"with-gnu-ld", ""},
|
||||
{"with-system-zlib", ""},
|
||||
{"enable-languages", "c,c++,go"},
|
||||
{"with-native-system-header-dir", "/system/include"},
|
||||
}},
|
||||
{K: unique.Make(Ident("make")), V: []string{
|
||||
"BOOT_CFLAGS='-O2 -g'",
|
||||
"\x00",
|
||||
"bootstrap",
|
||||
}},
|
||||
{K: unique.Make(Ident("skip-check")), V: true},
|
||||
}},
|
||||
|
||||
{K: unique.Make(Ident("inputs")), V: Array{
|
||||
{Ident("binutils")},
|
||||
{Ident("mpc")},
|
||||
{Ident("zlib")},
|
||||
{Ident("libucontext")},
|
||||
{Ident("kernel-headers")},
|
||||
}},
|
||||
},
|
||||
{
|
||||
{K: unique.Make(Ident("amd64")), V: "''"},
|
||||
{K: unique.Make(Ident("arm64")), V: "''"},
|
||||
{K: unique.Make(Ident("default"))},
|
||||
},
|
||||
{{K: unique.Make(Ident("key")), V: "\xfd"}},
|
||||
}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("package: args = %#v, want %#v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkEvaluate(b *testing.B) {
|
||||
var gcc Func
|
||||
if e, err := Parse(strings.NewReader(sample)); err != nil {
|
||||
b.Fatal(err)
|
||||
} else {
|
||||
gcc = e[0].(Func)
|
||||
}
|
||||
|
||||
s := []Frame{{
|
||||
Func: map[unique.Handle[Ident]]F{
|
||||
unique.Make(Ident("remoteTar")): {F: func(
|
||||
FArgs,
|
||||
) (v any, set bool, err error) {
|
||||
return
|
||||
}, V: map[unique.Handle[Ident]]any{
|
||||
unique.Make(Ident("gzip")): 0xcafe,
|
||||
}},
|
||||
|
||||
unique.Make(Ident("make")): {F: func(
|
||||
FArgs,
|
||||
) (v any, set bool, err error) {
|
||||
return
|
||||
}},
|
||||
|
||||
unique.Make(Ident("arch")): {F: func(
|
||||
FArgs,
|
||||
) (v any, set bool, err error) {
|
||||
return
|
||||
}},
|
||||
|
||||
unique.Make(Ident("noop")): {F: func(
|
||||
FArgs,
|
||||
) (v any, set bool, err error) {
|
||||
return
|
||||
}, V: map[unique.Handle[Ident]]any{
|
||||
unique.Make(Ident("value")): "\xfd",
|
||||
}},
|
||||
},
|
||||
}}
|
||||
for b.Loop() {
|
||||
if _, _, err := Evaluate[string](func(
|
||||
Ident,
|
||||
FArgs,
|
||||
) (v any, set bool, err error) {
|
||||
return
|
||||
}, s, gcc); err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
57
internal/rosa/azalea/testdata/gcc.az
vendored
Normal file
57
internal/rosa/azalea/testdata/gcc.az
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
package gcc {
|
||||
description = "The GNU Compiler Collection";
|
||||
website = "https://www.gnu.org/software/gcc";
|
||||
anitya = 6502;
|
||||
|
||||
version* = "16.1.0";
|
||||
source = remoteTar {
|
||||
url = "https://ftp.tsukuba.wide.ad.jp/software/gcc/releases/"+
|
||||
"gcc-"+version+"/gcc-"+version+".tar.gz";
|
||||
checksum = "4ASoWbxaA2FW7PAB0zzHDPC5XnNhyaAyjtDPpGzceSLeYnEIXsNYZR3PA_Zu5P0K";
|
||||
compress = gzip;
|
||||
};
|
||||
patches = [
|
||||
"musl-off64_t-loff_t.patch",
|
||||
"musl-legacy-lfs.patch",
|
||||
];
|
||||
|
||||
// GCC spends most of its time in its many configure scripts, however
|
||||
// it also saturates the CPU for a consequential amount of time.
|
||||
exclusive = true;
|
||||
|
||||
exec = make {
|
||||
configure = {
|
||||
"disable-multilib";
|
||||
"enable-default-pie";
|
||||
"disable-nls";
|
||||
"with-gnu-as";
|
||||
"with-gnu-ld";
|
||||
"with-system-zlib";
|
||||
"enable-languages": "c,c++,go";
|
||||
"with-native-system-header-dir": "/system/include";
|
||||
"with-multilib-list": arch {
|
||||
amd64, arm64 = "''";
|
||||
default = unset;
|
||||
};
|
||||
};
|
||||
make = [
|
||||
"BOOT_CFLAGS='-O2 -g'",
|
||||
noop { key = value; } + "\x00",
|
||||
"bootstrap",
|
||||
];
|
||||
|
||||
// This toolchain is hacked to pieces, it is not expected to ever work
|
||||
// well in its current state. That does not matter as long as the
|
||||
// toolchain it produces passes its own test suite.
|
||||
skip-check = true;
|
||||
};
|
||||
|
||||
inputs = [
|
||||
binutils,
|
||||
|
||||
mpc,
|
||||
zlib,
|
||||
libucontext,
|
||||
kernel-headers,
|
||||
];
|
||||
}
|
||||
106
internal/rosa/builtins.go
Normal file
106
internal/rosa/builtins.go
Normal file
@@ -0,0 +1,106 @@
|
||||
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()
|
||||
}
|
||||
@@ -11,18 +11,18 @@ func TestSkipGNUTests(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
testCases := []struct {
|
||||
tests []int
|
||||
tests []int64
|
||||
want string
|
||||
}{
|
||||
{[]int{764}, "1-763 765-"},
|
||||
{[]int{764, 0xcafe, 37, 9}, "1-8 10-36 38-763 765-51965 51967-"},
|
||||
{[]int{1, 2, 0xbed}, "3-3052 3054-"},
|
||||
{[]int{3, 4}, "1-2 5-"},
|
||||
{[]int64{764}, "1-763 765-"},
|
||||
{[]int64{764, 0xcafe, 37, 9}, "1-8 10-36 38-763 765-51965 51967-"},
|
||||
{[]int64{1, 2, 0xbed}, "3-3052 3054-"},
|
||||
{[]int64{3, 4}, "1-2 5-"},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
t.Run(strings.Join(slices.Collect(func(yield func(string) bool) {
|
||||
for _, n := range tc.tests {
|
||||
yield(strconv.Itoa(n))
|
||||
yield(strconv.Itoa(int(n)))
|
||||
}
|
||||
}), ","), func(t *testing.T) {
|
||||
t.Parallel()
|
||||
@@ -85,13 +85,13 @@ func (a busyboxBin) Cure(t *pkg.TContext) (err error) {
|
||||
|
||||
// newBusyboxBin returns a [pkg.Artifact] containing a busybox installation from
|
||||
// the https://busybox.net/downloads/binaries/ binary release.
|
||||
func newBusyboxBin() pkg.Artifact {
|
||||
func (s *S) newBusyboxBin() pkg.Artifact {
|
||||
var version, url, checksum string
|
||||
switch arch {
|
||||
switch s.arch {
|
||||
case "amd64":
|
||||
version = "1.35.0"
|
||||
url = "https://busybox.net/downloads/binaries/" +
|
||||
version + "-" + linuxArch() + "-linux-musl/busybox"
|
||||
version + "-" + s.linuxArch() + "-linux-musl/busybox"
|
||||
checksum = "L7OBIsPu9enNHn7FqpBT1kOg_mCLNmetSeNMA3i4Y60Z5jTgnlX3qX3zcQtLx5AB"
|
||||
case "arm64":
|
||||
version = "1.31.0"
|
||||
@@ -100,11 +100,11 @@ func newBusyboxBin() pkg.Artifact {
|
||||
checksum = "npJjBO7iwhjW6Kx2aXeSxf8kXhVgTCDChOZTTsI8ZfFfa3tbsklxRiidZQdrVERg"
|
||||
|
||||
default:
|
||||
panic("unsupported target " + arch)
|
||||
panic("unsupported target " + s.arch)
|
||||
}
|
||||
|
||||
return pkg.NewExec(
|
||||
"busybox-bin-"+version, arch, nil, pkg.ExecTimeoutMax, false, false,
|
||||
"busybox-bin-"+version, s.arch, nil, pkg.ExecTimeoutMax, false, false,
|
||||
fhs.AbsRoot, []string{
|
||||
"PATH=/system/bin",
|
||||
},
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Bzip2] = Metadata{
|
||||
f: Toolchain.newBzip2,
|
||||
|
||||
Name: "bzip2",
|
||||
Description: "a freely available, patent free, high-quality data compressor",
|
||||
Website: "https://sourceware.org/bzip2/",
|
||||
|
||||
ID: 237,
|
||||
}
|
||||
}
|
||||
@@ -4,118 +4,12 @@ import (
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"hakurei.app/internal/pkg"
|
||||
)
|
||||
|
||||
func (t Toolchain) newCMake() (pkg.Artifact, string) {
|
||||
const (
|
||||
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() {
|
||||
artifactsM[CMake] = Metadata{
|
||||
f: Toolchain.newCMake,
|
||||
|
||||
Name: "cmake",
|
||||
Description: "cross-platform, open-source build system",
|
||||
Website: "https://cmake.org/",
|
||||
|
||||
ID: 306,
|
||||
}
|
||||
}
|
||||
var (
|
||||
_cmake = H("cmake")
|
||||
_ninja = H("ninja")
|
||||
)
|
||||
|
||||
// CMakeHelper is the [CMake] build system helper.
|
||||
type CMakeHelper struct {
|
||||
@@ -143,9 +37,9 @@ var _ Helper = new(CMakeHelper)
|
||||
// extra returns a hardcoded slice of [CMake] and [Ninja].
|
||||
func (attr *CMakeHelper) extra(int) P {
|
||||
if attr != nil && attr.Make {
|
||||
return P{CMake, Make}
|
||||
return P{_cmake, _make}
|
||||
}
|
||||
return P{CMake, Ninja}
|
||||
return P{_cmake, _ninja}
|
||||
}
|
||||
|
||||
// wantsChmod returns false.
|
||||
@@ -157,14 +51,11 @@ func (*CMakeHelper) wantsWrite() bool { return false }
|
||||
// scriptEarly returns the zero value.
|
||||
func (*CMakeHelper) scriptEarly() string { return "" }
|
||||
|
||||
// createDir returns true.
|
||||
func (*CMakeHelper) createDir() bool { return true }
|
||||
|
||||
// wantsDir returns a hardcoded, deterministic pathname.
|
||||
func (*CMakeHelper) wantsDir() string { return "/cure/" }
|
||||
func (*CMakeHelper) wantsDir() (string, bool) { return "/cure/", true }
|
||||
|
||||
// script generates the cure script.
|
||||
func (attr *CMakeHelper) script(name string) string {
|
||||
func (attr *CMakeHelper) script(t Toolchain, name string) string {
|
||||
if attr == nil {
|
||||
attr = new(CMakeHelper)
|
||||
}
|
||||
@@ -180,7 +71,7 @@ func (attr *CMakeHelper) script(name string) string {
|
||||
}
|
||||
|
||||
script := attr.Script
|
||||
if !attr.SkipTest && presetOpts&OptSkipCheck == 0 {
|
||||
if !attr.SkipTest && t.opts&OptSkipCheck == 0 {
|
||||
script += "\n" + test
|
||||
}
|
||||
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Curl] = Metadata{
|
||||
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,
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
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() {
|
||||
artifactsM[DBus] = Metadata{
|
||||
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() {
|
||||
artifactsM[XDGDBusProxy] = Metadata{
|
||||
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,
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
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() {
|
||||
artifactsM[DTC] = Metadata{
|
||||
f: Toolchain.newDTC,
|
||||
|
||||
Name: "dtc",
|
||||
Description: "The Device Tree Compiler",
|
||||
Website: "https://git.kernel.org/pub/scm/utils/dtc/dtc.git/",
|
||||
|
||||
ID: 16911,
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Elfutils] = Metadata{
|
||||
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,
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Fakeroot] = Metadata{
|
||||
f: Toolchain.newFakeroot,
|
||||
|
||||
Name: "fakeroot",
|
||||
Description: "tool for simulating superuser privileges",
|
||||
Website: "https://salsa.debian.org/clint/fakeroot",
|
||||
|
||||
ID: 12048,
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Flex] = Metadata{
|
||||
f: Toolchain.newFlex,
|
||||
|
||||
Name: "flex",
|
||||
Description: "scanner generator for lexing in C and C++",
|
||||
Website: "https://github.com/westes/flex/",
|
||||
|
||||
ID: 819,
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Freetype] = Metadata{
|
||||
f: Toolchain.newFreetype,
|
||||
|
||||
Name: "freetype",
|
||||
Description: "a freely available software library to render fonts",
|
||||
Website: "http://www.freetype.org/",
|
||||
|
||||
ID: 854,
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Fuse] = Metadata{
|
||||
f: Toolchain.newFuse,
|
||||
|
||||
Name: "fuse",
|
||||
Description: "the reference implementation of the Linux FUSE interface",
|
||||
Website: "https://github.com/libfuse/libfuse/",
|
||||
|
||||
ID: 861,
|
||||
}
|
||||
}
|
||||
@@ -7,103 +7,10 @@ import (
|
||||
"hakurei.app/internal/pkg"
|
||||
)
|
||||
|
||||
func (t Toolchain) newGit() (pkg.Artifact, string) {
|
||||
const (
|
||||
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() {
|
||||
artifactsM[Git] = Metadata{
|
||||
f: Toolchain.newGit,
|
||||
|
||||
Name: "git",
|
||||
Description: "distributed version control system",
|
||||
Website: "https://www.git-scm.com/",
|
||||
|
||||
Dependencies: P{
|
||||
Zlib,
|
||||
Curl,
|
||||
Libexpat,
|
||||
},
|
||||
|
||||
ID: 5350,
|
||||
}
|
||||
}
|
||||
var (
|
||||
_git = H("git")
|
||||
_nssCACert = H("nss-cacert")
|
||||
)
|
||||
|
||||
// NewViaGit returns a [pkg.Artifact] for cloning a git repository.
|
||||
func (t Toolchain) NewViaGit(
|
||||
@@ -113,9 +20,9 @@ func (t Toolchain) NewViaGit(
|
||||
return t.New(strings.TrimSuffix(
|
||||
path.Base(url),
|
||||
".git",
|
||||
)+"-src-"+path.Base(rev), THostNet, t.AppendPresets(nil,
|
||||
NSSCACert,
|
||||
Git,
|
||||
)+"-src-"+path.Base(rev), THostNet, t.Append(nil,
|
||||
_nssCACert,
|
||||
_git,
|
||||
), &checksum, nil, `
|
||||
git \
|
||||
-c advice.detachedHead=false \
|
||||
|
||||
@@ -1,248 +0,0 @@
|
||||
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() {
|
||||
artifactsM[SPIRVHeaders] = Metadata{
|
||||
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() {
|
||||
artifactsM[SPIRVTools] = Metadata{
|
||||
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() {
|
||||
artifactsM[Glslang] = Metadata{
|
||||
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 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() {
|
||||
artifactsM[SPIRVLLVMTranslator] = Metadata{
|
||||
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
1366
internal/rosa/gnu.go
File diff suppressed because it is too large
Load Diff
@@ -6,89 +6,113 @@ import (
|
||||
"hakurei.app/internal/pkg"
|
||||
)
|
||||
|
||||
// newGoBootstrap returns the Go bootstrap toolchain.
|
||||
func (t Toolchain) newGoBootstrap() pkg.Artifact {
|
||||
const checksum = "8o9JL_ToiQKadCTb04nvBDkp8O1xiWOolAxVEqaTGodieNe4lOFEjlOxN3bwwe23"
|
||||
return t.New("go1.4-bootstrap", 0, t.AppendPresets(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,
|
||||
)))
|
||||
}
|
||||
var _go = H("go")
|
||||
|
||||
// newGo returns a specific version of the Go toolchain.
|
||||
func (t Toolchain) newGo(
|
||||
version, checksum string,
|
||||
env []string,
|
||||
script string,
|
||||
extra ...pkg.Artifact,
|
||||
boot pkg.Artifact,
|
||||
) pkg.Artifact {
|
||||
name := "all"
|
||||
if presetOpts&OptSkipCheck != 0 {
|
||||
name = "make"
|
||||
}
|
||||
return t.New("go"+version, 0, t.AppendPresets(extra,
|
||||
Bash,
|
||||
), nil, slices.Concat([]string{
|
||||
"CC=cc",
|
||||
"GOCACHE=/tmp/gocache",
|
||||
"GOROOT_BOOTSTRAP=/system/go",
|
||||
"TMPDIR=/dev/shm/go",
|
||||
}, env), `
|
||||
mkdir /work/system "${TMPDIR}"
|
||||
cp -r /usr/src/go /work/system
|
||||
cd /work/system/go/src
|
||||
return t.NewPackage("go", version, newTar(
|
||||
"https://go.dev/dl/go"+version+".src.tar.gz",
|
||||
checksum,
|
||||
pkg.TarGzip,
|
||||
), &PackageAttr{
|
||||
EnterSource: true,
|
||||
Env: slices.Concat([]string{
|
||||
"CC=cc",
|
||||
"GOCACHE=/tmp/gocache",
|
||||
"GOROOT_BOOTSTRAP=/system/go",
|
||||
"TMPDIR=/dev/shm/go",
|
||||
}, env),
|
||||
|
||||
Extra: []pkg.Artifact{boot},
|
||||
}, &GenericHelper{
|
||||
InPlace: true,
|
||||
Build: `
|
||||
mkdir /work/system/ "${TMPDIR}"
|
||||
cp -r . /work/system/go
|
||||
cd /work/system/go/src/
|
||||
chmod -R +w ..
|
||||
`+script+`
|
||||
./`+name+`.bash
|
||||
` + script + `
|
||||
set +u
|
||||
. ./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
|
||||
ln -s \
|
||||
../go/bin/go \
|
||||
../go/bin/gofmt \
|
||||
/work/system/bin
|
||||
`, pkg.Path(AbsUsrSrc.Append("go"), false, newTar(
|
||||
"https://go.dev/dl/go"+version+".src.tar.gz",
|
||||
checksum,
|
||||
pkg.TarGzip,
|
||||
)))
|
||||
`,
|
||||
},
|
||||
_bash,
|
||||
)
|
||||
}
|
||||
|
||||
func (t Toolchain) newGoLatest() (pkg.Artifact, string) {
|
||||
var (
|
||||
bootstrapEnv []string
|
||||
bootstrapExtra []pkg.Artifact
|
||||
|
||||
finalEnv []string
|
||||
func init() {
|
||||
const (
|
||||
version = "1.26.3"
|
||||
checksum = "lEiFocZFnN5fKvZzmwVdqc9pYUjAuhzqZGbuiOqxUP4XdcY8yECisKcqsQ_eNn1N"
|
||||
)
|
||||
switch arch {
|
||||
case "amd64":
|
||||
bootstrapExtra = append(bootstrapExtra, t.newGoBootstrap())
|
||||
meta := Metadata{
|
||||
Name: "go",
|
||||
Description: "the Go programming language toolchain",
|
||||
Website: "https://go.dev",
|
||||
Version: version,
|
||||
|
||||
case "arm64", "riscv64":
|
||||
bootstrapEnv = append(bootstrapEnv, "GOROOT_BOOTSTRAP=/system")
|
||||
bootstrapExtra = t.AppendPresets(bootstrapExtra, gcc)
|
||||
finalEnv = append(finalEnv, "CGO_ENABLED=0")
|
||||
|
||||
default:
|
||||
panic("unsupported target " + arch)
|
||||
ID: 1227,
|
||||
}
|
||||
native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) {
|
||||
var (
|
||||
bootstrapEnv []string
|
||||
bootstrapEarly pkg.Artifact
|
||||
|
||||
go119 := t.newGo(
|
||||
"1.19",
|
||||
"9_e0aFHsIkVxWVGsp9T2RvvjOc3p4n9o9S8tkNe9Cvgzk_zI2FhRQB7ioQkeAAro",
|
||||
append(bootstrapEnv, "CGO_ENABLED=0"), `
|
||||
finalEnv []string
|
||||
)
|
||||
switch t.arch {
|
||||
case "amd64":
|
||||
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 \
|
||||
crypto/tls/handshake_client_test.go \
|
||||
cmd/pprof/pprof_test.go \
|
||||
@@ -99,15 +123,15 @@ sed -i \
|
||||
echo \
|
||||
'type syscallDescriptor = int' >> \
|
||||
os/rawconn_test.go
|
||||
`, bootstrapExtra...)
|
||||
`, bootstrapEarly)
|
||||
|
||||
go121 := t.newGo(
|
||||
"1.21.13",
|
||||
"YtrDka402BOAEwywx03Vz4QlVwoBiguJHzG7PuythMCPHXS8CVMLvzmvgEbu4Tzu",
|
||||
[]string{"CGO_ENABLED=0"}, `
|
||||
go121 := t.newGo(
|
||||
"1.21.13",
|
||||
"YtrDka402BOAEwywx03Vz4QlVwoBiguJHzG7PuythMCPHXS8CVMLvzmvgEbu4Tzu",
|
||||
[]string{"CGO_ENABLED=0"}, `
|
||||
sed -i \
|
||||
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
|
||||
cmd/link/internal/`+arch+`/obj.go
|
||||
's,/lib/ld-musl-`+t.linuxArch()+`.so.1,/system/bin/linker,' \
|
||||
cmd/link/internal/`+t.arch+`/obj.go
|
||||
|
||||
rm \
|
||||
crypto/tls/handshake_client_test.go \
|
||||
@@ -117,43 +141,39 @@ echo \
|
||||
'type syscallDescriptor = int' >> \
|
||||
os/rawconn_test.go
|
||||
`, go119,
|
||||
)
|
||||
)
|
||||
|
||||
go123 := t.newGo(
|
||||
"1.23.12",
|
||||
"wcI32bl1tkqbgcelGtGWPI4RtlEddd-PTd76Eb-k7nXA5LbE9yTNdIL9QSOOxMOs",
|
||||
[]string{"CGO_ENABLED=0"}, `
|
||||
go123 := t.newGo(
|
||||
"1.23.12",
|
||||
"wcI32bl1tkqbgcelGtGWPI4RtlEddd-PTd76Eb-k7nXA5LbE9yTNdIL9QSOOxMOs",
|
||||
[]string{"CGO_ENABLED=0"}, `
|
||||
sed -i \
|
||||
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
|
||||
cmd/link/internal/`+arch+`/obj.go
|
||||
's,/lib/ld-musl-`+t.linuxArch()+`.so.1,/system/bin/linker,' \
|
||||
cmd/link/internal/`+t.arch+`/obj.go
|
||||
`, go121,
|
||||
)
|
||||
)
|
||||
|
||||
go125 := t.newGo(
|
||||
"1.25.10",
|
||||
"TwKwatkpwal-j9U2sDSRPEdM3YesI4Gm88YgGV59wtU-L85K9gA7UPy9SCxn6PMb",
|
||||
[]string{"CGO_ENABLED=0"}, `
|
||||
go125 := t.newGo(
|
||||
"1.25.10",
|
||||
"TwKwatkpwal-j9U2sDSRPEdM3YesI4Gm88YgGV59wtU-L85K9gA7UPy9SCxn6PMb",
|
||||
[]string{"CGO_ENABLED=0"}, `
|
||||
sed -i \
|
||||
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
|
||||
cmd/link/internal/`+arch+`/obj.go
|
||||
's,/lib/ld-musl-`+t.linuxArch()+`.so.1,/system/bin/linker,' \
|
||||
cmd/link/internal/`+t.arch+`/obj.go
|
||||
|
||||
rm \
|
||||
os/root_unix_test.go \
|
||||
net/smtp/smtp_test.go
|
||||
`, go123,
|
||||
)
|
||||
)
|
||||
|
||||
const (
|
||||
version = "1.26.3"
|
||||
checksum = "lEiFocZFnN5fKvZzmwVdqc9pYUjAuhzqZGbuiOqxUP4XdcY8yECisKcqsQ_eNn1N"
|
||||
)
|
||||
return t.newGo(
|
||||
version,
|
||||
checksum,
|
||||
finalEnv, `
|
||||
return &meta, t.newGo(
|
||||
version,
|
||||
checksum,
|
||||
finalEnv, `
|
||||
sed -i \
|
||||
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
|
||||
cmd/link/internal/`+arch+`/obj.go
|
||||
's,/lib/ld-musl-`+t.linuxArch()+`.so.1,/system/bin/linker,' \
|
||||
cmd/link/internal/`+t.arch+`/obj.go
|
||||
sed -i \
|
||||
's/cpu.X86.HasAVX512VBMI/& \&\& cpu.X86.HasPOPCNT/' \
|
||||
internal/runtime/gc/scan/scan_amd64.go
|
||||
@@ -163,16 +183,7 @@ rm \
|
||||
cmd/cgo/internal/testsanitizers/tsan_test.go \
|
||||
cmd/cgo/internal/testsanitizers/cshared_test.go
|
||||
`, go125,
|
||||
), version
|
||||
}
|
||||
func init() {
|
||||
artifactsM[Go] = Metadata{
|
||||
f: Toolchain.newGoLatest,
|
||||
)
|
||||
|
||||
Name: "go",
|
||||
Description: "the Go programming language toolchain",
|
||||
Website: "https://go.dev/",
|
||||
|
||||
ID: 1227,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
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() {
|
||||
artifactsM[GLib] = Metadata{
|
||||
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,
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
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.AppendPresets(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() {
|
||||
artifactsM[Hakurei] = Metadata{
|
||||
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,
|
||||
}
|
||||
artifactsM[HakureiDist] = Metadata{
|
||||
f: func(t Toolchain) (pkg.Artifact, string) {
|
||||
name := "all"
|
||||
if presetOpts&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/",
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
//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
|
||||
@@ -1,18 +0,0 @@
|
||||
//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
|
||||
@@ -1,34 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Hwdata] = Metadata{
|
||||
f: Toolchain.newHwdata,
|
||||
|
||||
Name: "hwdata",
|
||||
Description: "contains various hardware identification and configuration data",
|
||||
Website: "https://github.com/vcrhonek/hwdata",
|
||||
|
||||
ID: 5387,
|
||||
}
|
||||
}
|
||||
@@ -6,70 +6,46 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
artifactsM[EarlyInit] = Metadata{
|
||||
Name: "earlyinit",
|
||||
Description: "Rosa OS initramfs init program",
|
||||
|
||||
f: func(t Toolchain) (pkg.Artifact, string) {
|
||||
return t.newHakurei("-early-init", `
|
||||
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.AppendPresets(nil,
|
||||
SquashfsTools,
|
||||
), nil, nil, `
|
||||
mksquashfs /mnt/system /work/system.img
|
||||
`, pkg.Path(fhs.AbsRoot.Append("mnt"), false, t.AppendPresets(nil,
|
||||
Musl,
|
||||
Mksh,
|
||||
Toybox,
|
||||
|
||||
Kmod,
|
||||
Kernel,
|
||||
Firmware,
|
||||
)...)), Unversioned
|
||||
}
|
||||
func init() {
|
||||
artifactsM[ImageSystem] = Metadata{
|
||||
meta := Metadata{
|
||||
Name: "system-image",
|
||||
Description: "Rosa OS system image",
|
||||
|
||||
f: Toolchain.newImageSystem,
|
||||
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"),
|
||||
H("kernel"),
|
||||
H("firmware"),
|
||||
)...))
|
||||
})
|
||||
}
|
||||
|
||||
func (t Toolchain) newImageInitramfs() (pkg.Artifact, string) {
|
||||
return t.New("initramfs", TNoToolchain, t.AppendPresets(nil,
|
||||
Zstd,
|
||||
EarlyInit,
|
||||
GenInitCPIO,
|
||||
), nil, nil, `
|
||||
func init() {
|
||||
meta := Metadata{
|
||||
Name: "initramfs-image",
|
||||
Description: "Rosa OS initramfs image",
|
||||
Version: Unversioned,
|
||||
}
|
||||
native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) {
|
||||
return &meta, t.New("initramfs", TNoToolchain, t.Append(nil,
|
||||
_zstd,
|
||||
H("earlyinit"),
|
||||
H("gen_init_cpio"),
|
||||
), nil, nil, `
|
||||
gen_init_cpio -t 4294967295 -c /usr/src/initramfs | zstd > /work/initramfs.zst
|
||||
`, pkg.Path(AbsUsrSrc.Append("initramfs"), false, pkg.NewFile("initramfs", []byte(`
|
||||
dir /dev 0755 0 0
|
||||
nod /dev/null 0666 0 0 c 1 3
|
||||
nod /dev/console 0600 0 0 c 5 1
|
||||
file /init /system/libexec/hakurei/earlyinit 0555 0 0
|
||||
`)))), Unversioned
|
||||
}
|
||||
func init() {
|
||||
artifactsM[ImageInitramfs] = Metadata{
|
||||
Name: "initramfs-image",
|
||||
Description: "Rosa OS initramfs image",
|
||||
|
||||
f: Toolchain.newImageInitramfs,
|
||||
}
|
||||
`))))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
package rosa
|
||||
|
||||
import _ "embed"
|
||||
|
||||
//go:embed kernel_amd64.config
|
||||
var kernelConfig []byte
|
||||
|
||||
const kernelName = "bzImage"
|
||||
@@ -1,8 +0,0 @@
|
||||
package rosa
|
||||
|
||||
import _ "embed"
|
||||
|
||||
//go:embed kernel_arm64.config
|
||||
var kernelConfig []byte
|
||||
|
||||
const kernelName = "vmlinuz.efi"
|
||||
@@ -1,8 +0,0 @@
|
||||
package rosa
|
||||
|
||||
import _ "embed"
|
||||
|
||||
//go:embed kernel_riscv64.config
|
||||
var kernelConfig []byte
|
||||
|
||||
const kernelName = "bzImage"
|
||||
@@ -1,50 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Kmod] = Metadata{
|
||||
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,62 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Libmd] = Metadata{
|
||||
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() {
|
||||
artifactsM[Libbsd] = Metadata{
|
||||
f: Toolchain.newLibbsd,
|
||||
|
||||
Name: "libbsd",
|
||||
Description: "provides useful functions commonly found on BSD systems",
|
||||
Website: "https://libbsd.freedesktop.org/",
|
||||
|
||||
ID: 1567,
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Libcap] = Metadata{
|
||||
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,30 +0,0 @@
|
||||
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() {
|
||||
artifactsM[LibdisplayInfo] = Metadata{
|
||||
f: Toolchain.newLibdisplayInfo,
|
||||
|
||||
Name: "libdisplay-info",
|
||||
Description: "EDID and DisplayID library",
|
||||
Website: "https://gitlab.freedesktop.org/emersion/libdisplay-info",
|
||||
|
||||
ID: 326668,
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Libepoxy] = Metadata{
|
||||
f: Toolchain.newLibepoxy,
|
||||
|
||||
Name: "libepoxy",
|
||||
Description: "a library for handling OpenGL function pointer management",
|
||||
Website: "https://github.com/anholt/libepoxy",
|
||||
|
||||
ID: 6090,
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Libev] = Metadata{
|
||||
f: Toolchain.newLibev,
|
||||
|
||||
Name: "libev",
|
||||
Description: "a full-featured and high-performance event loop",
|
||||
Website: "http://libev.schmorp.de/",
|
||||
|
||||
ID: 1605,
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Libexpat] = Metadata{
|
||||
f: Toolchain.newLibexpat,
|
||||
|
||||
Name: "libexpat",
|
||||
Description: "a stream-oriented XML parser library",
|
||||
Website: "https://libexpat.github.io/",
|
||||
|
||||
ID: 770,
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Libffi] = Metadata{
|
||||
f: Toolchain.newLibffi,
|
||||
|
||||
Name: "libffi",
|
||||
Description: "a portable, high level programming interface to various calling conventions",
|
||||
Website: "https://sourceware.org/libffi/",
|
||||
|
||||
ID: 1611,
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Libgd] = Metadata{
|
||||
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,
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Libpng] = Metadata{
|
||||
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,
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Libpsl] = Metadata{
|
||||
f: Toolchain.newLibpsl,
|
||||
|
||||
Name: "libpsl",
|
||||
Description: "provides functions to work with the Mozilla Public Suffix List",
|
||||
Website: "https://rockdaboot.github.io/libpsl/",
|
||||
|
||||
ID: 7305,
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Libseccomp] = Metadata{
|
||||
f: Toolchain.newLibseccomp,
|
||||
|
||||
Name: "libseccomp",
|
||||
Description: "an interface to the Linux Kernel's syscall filtering mechanism",
|
||||
Website: "https://github.com/seccomp/libseccomp/",
|
||||
|
||||
ID: 13823,
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Libtirpc] = Metadata{
|
||||
f: Toolchain.newLibtirpc,
|
||||
|
||||
Name: "libtirpc",
|
||||
Description: "a port of Suns Transport-Independent RPC library to Linux",
|
||||
Website: "https://sourceforge.net/projects/libtirpc/",
|
||||
|
||||
ID: 1740,
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
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=" + linuxArch(),
|
||||
},
|
||||
Install: "make prefix=/system DESTDIR=/work install",
|
||||
}), version
|
||||
}
|
||||
func init() {
|
||||
artifactsM[Libucontext] = Metadata{
|
||||
f: Toolchain.newLibucontext,
|
||||
|
||||
Name: "libucontext",
|
||||
Description: "ucontext implementation featuring glibc-compatible ABI",
|
||||
Website: "https://github.com/kaniini/libucontext/",
|
||||
|
||||
ID: 17085,
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Libxml2] = Metadata{
|
||||
f: Toolchain.newLibxml2,
|
||||
|
||||
Name: "libxml2",
|
||||
Description: "an XML toolkit implemented in C",
|
||||
Website: "https://gitlab.gnome.org/GNOME/libxml2/",
|
||||
|
||||
ID: 1783,
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Libxslt] = Metadata{
|
||||
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,14 +1,34 @@
|
||||
package rosa
|
||||
|
||||
import (
|
||||
"io/fs"
|
||||
"regexp"
|
||||
"slices"
|
||||
"strings"
|
||||
"unsafe"
|
||||
|
||||
"hakurei.app/internal/pkg"
|
||||
)
|
||||
|
||||
// litArgs returns [LIT] arguments for optional verbosity and check skipping.
|
||||
var (
|
||||
_llvmSource = H("llvm-project")
|
||||
_muslHeaders = H("musl-headers")
|
||||
_earlyCompilerRT = H("early-compiler-rt")
|
||||
_earlyRuntimes = H("early-runtimes")
|
||||
_musl = H("musl")
|
||||
|
||||
_bash = H("bash")
|
||||
_gawk = H("gawk")
|
||||
_coreutils = H("coreutils")
|
||||
_diffutils = H("diffutils")
|
||||
_findutils = H("findutils")
|
||||
|
||||
_zlib = H("zlib")
|
||||
_zstd = H("zstd")
|
||||
_kernelHeaders = H("kernel-headers")
|
||||
)
|
||||
|
||||
// litArgs returns LIT arguments for optional verbosity and check skipping.
|
||||
func litArgs(verbose bool, skipChecks ...string) string {
|
||||
args := []string{"-sv"}
|
||||
if verbose {
|
||||
@@ -29,271 +49,316 @@ func litArgs(verbose bool, skipChecks ...string) string {
|
||||
return "'" + strings.Join(args, " ") + "'"
|
||||
}
|
||||
|
||||
func (t Toolchain) newEarlyCompilerRT() (pkg.Artifact, string) {
|
||||
version := t.Version(llvmSource)
|
||||
major, _, _ := strings.Cut(version, ".")
|
||||
return t.NewPackage("early-compiler-rt", version, t.Load(llvmSource), &PackageAttr{
|
||||
Flag: TExclusive,
|
||||
}, &CMakeHelper{
|
||||
Append: []string{"compiler-rt"},
|
||||
func init() {
|
||||
var llvmPatches []KV
|
||||
for _, name := range [...]string{
|
||||
"increase-stack-size-unconditional",
|
||||
"add-rosa-vendor",
|
||||
"xfail-broken-tests",
|
||||
"path-system-include",
|
||||
"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)),
|
||||
})
|
||||
}
|
||||
|
||||
Cache: []KV{
|
||||
{"ENABLE_LINKER_BUILD_ID", "ON"},
|
||||
native.MustRegister("early-compiler-rt", func(t Toolchain) (*Metadata, pkg.Artifact) {
|
||||
meta := Metadata{
|
||||
Name: "early-compiler-rt",
|
||||
Description: "early LLVM runtime: compiler-rt",
|
||||
|
||||
// libc++ not yet available
|
||||
{"CMAKE_CXX_COMPILER_TARGET", ""},
|
||||
Dependencies: P{_musl},
|
||||
}
|
||||
_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"},
|
||||
|
||||
{"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_PER_TARGET_RUNTIME_DIR", "ON"},
|
||||
Cache: []KV{
|
||||
{"ENABLE_LINKER_BUILD_ID", "ON"},
|
||||
|
||||
{"COMPILER_RT_BUILD_BUILTINS", "ON"},
|
||||
{"COMPILER_RT_DEFAULT_TARGET_ONLY", "ON"},
|
||||
{"COMPILER_RT_USE_BUILTINS_LIBRARY", "ON"},
|
||||
{"COMPILER_RT_SANITIZERS_TO_BUILD", "asan"},
|
||||
{"COMPILER_RT_BUILD_GWP_ASAN", "OFF"},
|
||||
// libc++ not yet available
|
||||
{"CMAKE_CXX_COMPILER_TARGET", ""},
|
||||
|
||||
// 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: `
|
||||
{"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_PER_TARGET_RUNTIME_DIR", "ON"},
|
||||
|
||||
{"COMPILER_RT_BUILD_BUILTINS", "ON"},
|
||||
{"COMPILER_RT_DEFAULT_TARGET_ONLY", "ON"},
|
||||
{"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/"
|
||||
ln -s \
|
||||
"../../../${ROSA_TRIPLE}" \
|
||||
"/work/system/lib/clang/` + major + `/lib/"
|
||||
|
||||
ln -s \
|
||||
"clang_rt.crtbegin-` + linuxArch() + `.o" \
|
||||
"clang_rt.crtbegin-` + t.linuxArch() + `.o" \
|
||||
"/work/system/lib/${ROSA_TRIPLE}/crtbeginS.o"
|
||||
ln -s \
|
||||
"clang_rt.crtend-` + linuxArch() + `.o" \
|
||||
"clang_rt.crtend-` + t.linuxArch() + `.o" \
|
||||
"/work/system/lib/${ROSA_TRIPLE}/crtendS.o"
|
||||
`,
|
||||
},
|
||||
Python,
|
||||
|
||||
muslHeaders,
|
||||
KernelHeaders,
|
||||
), version
|
||||
}
|
||||
func init() {
|
||||
artifactsM[earlyCompilerRT] = Metadata{
|
||||
f: Toolchain.newEarlyCompilerRT,
|
||||
|
||||
Name: "early-compiler-rt",
|
||||
Description: "early LLVM runtime: compiler-rt",
|
||||
|
||||
Dependencies: P{
|
||||
Musl,
|
||||
},
|
||||
}
|
||||
}
|
||||
_python,
|
||||
|
||||
func (t Toolchain) newEarlyRuntimes() (pkg.Artifact, string) {
|
||||
version := t.Version(llvmSource)
|
||||
return t.NewPackage("early-runtimes", version, t.Load(llvmSource), &PackageAttr{
|
||||
Flag: TExclusive,
|
||||
}, &CMakeHelper{
|
||||
Append: []string{"runtimes"},
|
||||
_muslHeaders,
|
||||
_kernelHeaders,
|
||||
)
|
||||
})
|
||||
|
||||
Cache: []KV{
|
||||
native.MustRegister("early-runtimes", func(t Toolchain) (*Metadata, pkg.Artifact) {
|
||||
meta := Metadata{
|
||||
Name: "early-runtimes",
|
||||
Description: "early LLVM runtimes: libunwind, libcxx, libcxxabi",
|
||||
|
||||
Dependencies: P{
|
||||
_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"},
|
||||
|
||||
// libc++ not yet available
|
||||
{"CMAKE_CXX_COMPILER_WORKS", "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_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,
|
||||
), version
|
||||
}
|
||||
func init() {
|
||||
artifactsM[earlyRuntimes] = Metadata{
|
||||
f: Toolchain.newEarlyRuntimes,
|
||||
|
||||
Name: "early-runtimes",
|
||||
Description: "early LLVM runtimes: libunwind, libcxx, libcxxabi",
|
||||
|
||||
Dependencies: P{
|
||||
earlyCompilerRT,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (t Toolchain) newLLVM() (pkg.Artifact, string) {
|
||||
var early PArtifact = muslHeaders
|
||||
if t.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.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 arch {
|
||||
case "arm64":
|
||||
skipChecks = append(skipChecks,
|
||||
// LLVM: intermittently crashes
|
||||
"ExecutionEngine/OrcLazy/multiple-compile-threads-basic.ll",
|
||||
// unwind: unexpectedly passes
|
||||
"unwind_leaffunction",
|
||||
)
|
||||
{"LLVM_ENABLE_PROJECTS", "'" + strings.Join([]string{
|
||||
"clang",
|
||||
"lld",
|
||||
}, ";") + "'"},
|
||||
{"LLVM_ENABLE_RUNTIMES", "'" + strings.Join([]string{
|
||||
"compiler-rt",
|
||||
"libcxx",
|
||||
"libcxxabi",
|
||||
"libunwind",
|
||||
"libclc",
|
||||
}, ";") + "'"},
|
||||
}
|
||||
|
||||
if presetOpts&OptLLVMNoLTO == 0 {
|
||||
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.opts&OptLLVMNoLTO == 0 {
|
||||
cache = append(cache, []KV{
|
||||
// very expensive
|
||||
{"LLVM_ENABLE_LTO", "Thin"},
|
||||
}...)
|
||||
}
|
||||
|
||||
cache = append(cache, []KV{
|
||||
// very expensive
|
||||
{"LLVM_ENABLE_LTO", "Thin"},
|
||||
// symbols: clock_gettime, mallopt
|
||||
{"COMPILER_RT_INCLUDE_TESTS", "OFF"},
|
||||
|
||||
{"LLVM_BUILD_TESTS", "ON"},
|
||||
{"LLVM_LIT_ARGS", litArgs(true, skipChecks...)},
|
||||
}...)
|
||||
}
|
||||
|
||||
cache = append(cache, []KV{
|
||||
// symbols: clock_gettime, mallopt
|
||||
{"COMPILER_RT_INCLUDE_TESTS", "OFF"},
|
||||
return &meta, t.NewPackage("llvm", meta.Version, source, &PackageAttr{
|
||||
Flag: TExclusive,
|
||||
}, &CMakeHelper{
|
||||
Append: []string{"llvm"},
|
||||
|
||||
{"LLVM_BUILD_TESTS", "ON"},
|
||||
{"LLVM_LIT_ARGS", litArgs(true, skipChecks...)},
|
||||
}...)
|
||||
}
|
||||
|
||||
version := t.Version(llvmSource)
|
||||
return t.NewPackage("llvm", version, t.Load(llvmSource), &PackageAttr{
|
||||
Flag: TExclusive,
|
||||
}, &CMakeHelper{
|
||||
Append: []string{"llvm"},
|
||||
|
||||
Cache: cache,
|
||||
Script: `
|
||||
Cache: cache,
|
||||
Script: `
|
||||
ln -s ld.lld /work/system/bin/ld
|
||||
ln -s clang /work/system/bin/cc
|
||||
ln -s clang /work/system/bin/cpp
|
||||
ln -s clang++ /work/system/bin/c++
|
||||
`,
|
||||
|
||||
// LLVM_LINK_LLVM_DYLIB causes llvm test suite to leak system
|
||||
// installation into test environment, and the tests end up testing the
|
||||
// system installation instead. Tests are disabled on stage0 and relies
|
||||
// on 3-stage determinism to test later stages.
|
||||
SkipTest: t.isStage0(),
|
||||
// LLVM_LINK_LLVM_DYLIB causes llvm test suite to leak system
|
||||
// installation into test environment, and the tests end up testing the
|
||||
// system installation instead. Tests are disabled on stage0 and relies
|
||||
// on 3-stage determinism to test later stages.
|
||||
SkipTest: t.stage.isStage0(),
|
||||
|
||||
Test: `
|
||||
Test: `
|
||||
chmod +w /bin && ln -s \
|
||||
../system/bin/chmod \
|
||||
../system/bin/mkdir \
|
||||
@@ -303,53 +368,20 @@ chmod +w /bin && ln -s \
|
||||
/bin
|
||||
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"
|
||||
)
|
||||
|
||||
artifactsM[llvmSource] = Metadata{
|
||||
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,
|
||||
|
||||
Name: "llvm-project",
|
||||
Description: "LLVM monorepo with Rosa OS patches",
|
||||
_zlib,
|
||||
_zstd,
|
||||
early,
|
||||
_kernelHeaders,
|
||||
)
|
||||
|
||||
ID: 1830,
|
||||
}
|
||||
|
||||
artifactsM[LLVM] = Metadata{
|
||||
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,59 +0,0 @@
|
||||
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() {
|
||||
artifactsM[LMSensors] = Metadata{
|
||||
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,40 +3,9 @@ package rosa
|
||||
import (
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"hakurei.app/internal/pkg"
|
||||
)
|
||||
|
||||
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() {
|
||||
artifactsM[Make] = Metadata{
|
||||
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,
|
||||
}
|
||||
}
|
||||
var _make = H("make")
|
||||
|
||||
// MakeHelper is the [Make] build system helper.
|
||||
type MakeHelper struct {
|
||||
@@ -70,6 +39,8 @@ type MakeHelper struct {
|
||||
Make []string
|
||||
// Whether to skip the check target.
|
||||
SkipCheck bool
|
||||
// Whether to skip the check target during stage0.
|
||||
SkipCheckEarly bool
|
||||
// Name of the check target, zero value is equivalent to "check".
|
||||
Check []string
|
||||
// Replaces the default install command.
|
||||
@@ -80,11 +51,11 @@ var _ Helper = new(MakeHelper)
|
||||
|
||||
// extra returns make and other optional dependencies.
|
||||
func (attr *MakeHelper) extra(flag int) P {
|
||||
extra := P{Make}
|
||||
extra := P{_make}
|
||||
if (attr == nil || !attr.OmitDefaults) && flag&TEarly == 0 {
|
||||
extra = append(extra,
|
||||
Gawk,
|
||||
Coreutils,
|
||||
_gawk,
|
||||
_coreutils,
|
||||
)
|
||||
}
|
||||
return extra
|
||||
@@ -111,19 +82,16 @@ func (attr *MakeHelper) scriptEarly() string {
|
||||
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.
|
||||
func (attr *MakeHelper) wantsDir() string {
|
||||
func (attr *MakeHelper) wantsDir() (string, bool) {
|
||||
if attr != nil && attr.InPlace {
|
||||
return helperInPlace
|
||||
return helperInPlace, false
|
||||
}
|
||||
return `"$(mktemp -d)"`
|
||||
return `"$(mktemp -d)"`, false
|
||||
}
|
||||
|
||||
// script generates the cure script.
|
||||
func (attr *MakeHelper) script(name string) string {
|
||||
func (attr *MakeHelper) script(t Toolchain, name string) string {
|
||||
if attr == nil {
|
||||
attr = new(MakeHelper)
|
||||
}
|
||||
@@ -194,7 +162,8 @@ make \
|
||||
}
|
||||
scriptMake += "\n"
|
||||
|
||||
if !attr.SkipCheck && presetOpts&OptSkipCheck == 0 {
|
||||
if !attr.SkipCheck && t.opts&OptSkipCheck == 0 &&
|
||||
(!attr.SkipCheckEarly || !t.stage.isStage0()) {
|
||||
scriptMake += attr.ScriptCheckEarly + `make \
|
||||
` + jobsFlagE + ` \
|
||||
`
|
||||
|
||||
@@ -1,265 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Libglvnd] = Metadata{
|
||||
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() {
|
||||
artifactsM[Libdrm] = Metadata{
|
||||
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() {
|
||||
artifactsM[Libva] = Metadata{
|
||||
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() {
|
||||
artifactsM[Mesa] = Metadata{
|
||||
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,72 +3,9 @@ package rosa
|
||||
import (
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"hakurei.app/internal/pkg"
|
||||
)
|
||||
|
||||
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() {
|
||||
artifactsM[Meson] = Metadata{
|
||||
f: Toolchain.newMeson,
|
||||
|
||||
Name: "meson",
|
||||
Description: "an open source build system",
|
||||
Website: "https://mesonbuild.com/",
|
||||
|
||||
Dependencies: P{
|
||||
Python,
|
||||
PkgConfig,
|
||||
CMake,
|
||||
Ninja,
|
||||
},
|
||||
|
||||
ID: 6472,
|
||||
}
|
||||
}
|
||||
var _meson = H("meson")
|
||||
|
||||
// MesonHelper is the [Meson] build system helper.
|
||||
type MesonHelper struct {
|
||||
@@ -88,7 +25,7 @@ type MesonHelper struct {
|
||||
var _ Helper = new(MesonHelper)
|
||||
|
||||
// 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.
|
||||
func (*MesonHelper) wantsChmod() bool { return false }
|
||||
@@ -99,14 +36,11 @@ func (*MesonHelper) wantsWrite() bool { return false }
|
||||
// scriptEarly returns the zero value.
|
||||
func (*MesonHelper) scriptEarly() string { return "" }
|
||||
|
||||
// createDir returns false.
|
||||
func (*MesonHelper) createDir() bool { return false }
|
||||
|
||||
// wantsDir requests a new directory in TMPDIR.
|
||||
func (*MesonHelper) wantsDir() string { return `"$(mktemp -d)"` }
|
||||
func (*MesonHelper) wantsDir() (string, bool) { return `"$(mktemp -d)"`, false }
|
||||
|
||||
// script generates the cure script.
|
||||
func (attr *MesonHelper) script(name string) string {
|
||||
func (attr *MesonHelper) script(t Toolchain, name string) string {
|
||||
if attr == nil {
|
||||
attr = new(MesonHelper)
|
||||
}
|
||||
@@ -117,7 +51,7 @@ func (attr *MesonHelper) script(name string) string {
|
||||
}
|
||||
|
||||
var scriptTest string
|
||||
if !attr.SkipTest && presetOpts&OptSkipCheck == 0 {
|
||||
if !attr.SkipTest && t.opts&OptSkipCheck == 0 {
|
||||
scriptTest = `
|
||||
meson test \
|
||||
--print-errorlogs`
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
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 presetOpts&OptSkipCheck != 0 {
|
||||
scriptTest = ""
|
||||
}
|
||||
return t.New("mksh-"+version, 0, t.AppendPresets(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() {
|
||||
artifactsM[Mksh] = Metadata{
|
||||
f: Toolchain.newMksh,
|
||||
|
||||
Name: "mksh",
|
||||
Description: "MirBSD Korn Shell",
|
||||
Website: "https://www.mirbsd.org/mksh",
|
||||
|
||||
ID: 5590,
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
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() {
|
||||
artifactsM[MuslFts] = Metadata{
|
||||
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,
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
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() {
|
||||
artifactsM[MuslObstack] = Metadata{
|
||||
f: Toolchain.newMuslObstack,
|
||||
|
||||
Name: "musl-obstack",
|
||||
Description: "obstack functions and macros separated from glibc",
|
||||
Website: "https://github.com/void-linux/musl-obstack",
|
||||
|
||||
ID: 146206,
|
||||
}
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
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-` + 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=" + earlyLDFLAGS(false),
|
||||
}
|
||||
if t.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() {
|
||||
artifactsM[Musl] = Metadata{
|
||||
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,
|
||||
}
|
||||
|
||||
artifactsM[muslHeaders] = Metadata{
|
||||
f: func(t Toolchain) (pkg.Artifact, string) {
|
||||
return t.newMusl(true)
|
||||
},
|
||||
|
||||
Name: "musl-headers",
|
||||
Description: "system installation of musl headers",
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Ncurses] = Metadata{
|
||||
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,
|
||||
}
|
||||
}
|
||||
@@ -1,147 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Libmnl] = Metadata{
|
||||
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() {
|
||||
artifactsM[Libnftnl] = Metadata{
|
||||
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() {
|
||||
artifactsM[IPTables] = Metadata{
|
||||
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,
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
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() {
|
||||
artifactsM[Nettle] = Metadata{
|
||||
f: Toolchain.newNettle,
|
||||
|
||||
Name: "nettle",
|
||||
Description: "a low-level cryptographic library",
|
||||
Website: "https://www.lysator.liu.se/~nisse/nettle/",
|
||||
|
||||
Dependencies: P{
|
||||
GMP,
|
||||
},
|
||||
|
||||
ID: 2073,
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
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() {
|
||||
artifactsM[nettle3] = Metadata{
|
||||
f: Toolchain.newNettle3,
|
||||
|
||||
Name: "nettle3",
|
||||
Description: "a low-level cryptographic library",
|
||||
Website: "https://www.lysator.liu.se/~nisse/nettle/",
|
||||
|
||||
Dependencies: P{
|
||||
GMP,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package rosa
|
||||
|
||||
import "hakurei.app/internal/pkg"
|
||||
|
||||
func (t Toolchain) newNinja() (pkg.Artifact, string) {
|
||||
const (
|
||||
version = "1.13.2"
|
||||
checksum = "ygKWMa0YV2lWKiFro5hnL-vcKbc_-RACZuPu0Io8qDvgQlZ0dxv7hPNSFkt4214v"
|
||||
)
|
||||
return t.New("ninja-"+version, 0, []pkg.Artifact{
|
||||
t.Load(Python),
|
||||
t.Load(Bash),
|
||||
}, nil, nil, `
|
||||
cd "$(mktemp -d)"
|
||||
python3 /usr/src/ninja/configure.py \
|
||||
--verbose \
|
||||
--bootstrap \
|
||||
--gtest-source-dir=/usr/src/googletest
|
||||
./ninja `+jobsFlagE+` all
|
||||
./ninja_test
|
||||
|
||||
mkdir -p /work/system/bin/
|
||||
cp ninja /work/system/bin/
|
||||
`, pkg.Path(AbsUsrSrc.Append("googletest"), false,
|
||||
newFromGitHubRelease(
|
||||
"google/googletest",
|
||||
"v1.16.0",
|
||||
"googletest-1.16.0.tar.gz",
|
||||
"NjLGvSbgPy_B-y-o1hdanlzEzaYeStFcvFGxpYV3KYlhrWWFRcugYhM3ZMzOA9B_",
|
||||
pkg.TarGzip,
|
||||
)), pkg.Path(AbsUsrSrc.Append("ninja"), true, t.NewPatchedSource(
|
||||
"ninja", version, newFromGitHub(
|
||||
"ninja-build/ninja",
|
||||
"v"+version,
|
||||
checksum,
|
||||
), false,
|
||||
))), version
|
||||
}
|
||||
func init() {
|
||||
artifactsM[Ninja] = Metadata{
|
||||
f: Toolchain.newNinja,
|
||||
|
||||
Name: "ninja",
|
||||
Description: "a small build system with a focus on speed",
|
||||
Website: "https://ninja-build.org/",
|
||||
|
||||
ID: 2089,
|
||||
}
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
package rosa
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"hakurei.app/internal/pkg"
|
||||
)
|
||||
|
||||
func (t Toolchain) newNSS() (pkg.Artifact, string) {
|
||||
const (
|
||||
version = "3.123.1"
|
||||
checksum = "g811Z_fc74ssg-s6BeXRG-ipSfJggD6hrxjVJxrOBIz98CE7piv0OLwzIRLMQpwR"
|
||||
|
||||
version0 = "4_38_2"
|
||||
checksum0 = "25x2uJeQnOHIiq_zj17b4sYqKgeoU8-IsySUptoPcdHZ52PohFZfGuIisBreWzx0"
|
||||
)
|
||||
return t.NewPackage("nss", version, newFromGitHub(
|
||||
"nss-dev/nss",
|
||||
"NSS_"+strings.Join(strings.SplitN(version, ".", 3), "_")+"_RTM",
|
||||
checksum,
|
||||
), &PackageAttr{
|
||||
Paths: []pkg.ExecPath{
|
||||
pkg.Path(AbsUsrSrc.Append("nspr.zip"), false, pkg.NewHTTPGet(
|
||||
nil, "https://hg-edge.mozilla.org/projects/nspr/archive/"+
|
||||
"NSPR_"+version0+"_RTM.zip",
|
||||
mustDecode(checksum0),
|
||||
)),
|
||||
},
|
||||
|
||||
// uses source tree as scratch space
|
||||
Writable: true,
|
||||
Chmod: true,
|
||||
|
||||
ScriptEarly: `
|
||||
unzip /usr/src/nspr.zip -d /usr/src
|
||||
mv '/usr/src/nspr-NSPR_` + version0 + `_RTM' /usr/src/nspr
|
||||
`,
|
||||
}, &MakeHelper{
|
||||
OmitDefaults: true,
|
||||
SkipConfigure: true,
|
||||
InPlace: true,
|
||||
|
||||
SkipCheck: true,
|
||||
Make: []string{
|
||||
"CCC=clang++",
|
||||
"NSDISTMODE=copy",
|
||||
"BUILD_OPT=1",
|
||||
"USE_64=1",
|
||||
"nss_build_all",
|
||||
},
|
||||
Install: `
|
||||
mkdir -p /work/system/nss
|
||||
cp -r \
|
||||
/usr/src/dist/. \
|
||||
lib/ckfw/builtins/certdata.txt \
|
||||
/work/system/nss
|
||||
`,
|
||||
},
|
||||
Perl,
|
||||
Python,
|
||||
Unzip,
|
||||
Gawk,
|
||||
Coreutils,
|
||||
|
||||
Zlib,
|
||||
KernelHeaders,
|
||||
), version
|
||||
}
|
||||
func init() {
|
||||
artifactsM[NSS] = Metadata{
|
||||
f: Toolchain.newNSS,
|
||||
|
||||
Name: "nss",
|
||||
Description: "Network Security Services",
|
||||
Website: "https://firefox-source-docs.mozilla.org/security/nss/index.html",
|
||||
|
||||
Dependencies: P{
|
||||
Zlib,
|
||||
},
|
||||
|
||||
ID: 2503,
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
const (
|
||||
version = "0.5.1"
|
||||
checksum = "oxjnuIrPVMPvD6x8VFLqB7EdbfuhouGQdtPuHDpEHGzoyH5nkxqtYN9UthMY9noA"
|
||||
)
|
||||
artifactsM[buildcatrust] = newPythonPackage(
|
||||
"buildcatrust", 233988,
|
||||
"transform certificate stores between formats",
|
||||
"https://github.com/nix-community/buildcatrust",
|
||||
version, newFromGitHub(
|
||||
"nix-community/buildcatrust",
|
||||
"v"+version, checksum,
|
||||
), &PackageAttr{
|
||||
ScriptEarly: `
|
||||
rm buildcatrust/tests/test_nonhermetic.py
|
||||
`,
|
||||
}, nil, P{PythonFlitCore},
|
||||
)
|
||||
}
|
||||
|
||||
func (t Toolchain) newNSSCACert() (pkg.Artifact, string) {
|
||||
return t.New("nss-cacert", 0, t.AppendPresets(nil,
|
||||
Bash,
|
||||
|
||||
NSS,
|
||||
buildcatrust,
|
||||
), nil, nil, `
|
||||
mkdir -p /work/system/etc/ssl/{certs/unbundled,certs/hashed,trust-source}
|
||||
buildcatrust \
|
||||
--certdata_input /system/nss/certdata.txt \
|
||||
--ca_bundle_output /work/system/etc/ssl/certs/ca-bundle.crt \
|
||||
--ca_standard_bundle_output /work/system/etc/ssl/certs/ca-no-trust-rules-bundle.crt \
|
||||
--ca_unpacked_output /work/system/etc/ssl/certs/unbundled \
|
||||
--ca_hashed_unpacked_output /work/system/etc/ssl/certs/hashed \
|
||||
--p11kit_output /work/system/etc/ssl/trust-source/ca-bundle.trust.p11-kit
|
||||
`), Unversioned
|
||||
}
|
||||
func init() {
|
||||
artifactsM[NSSCACert] = Metadata{
|
||||
f: Toolchain.newNSSCACert,
|
||||
|
||||
Name: "nss-cacert",
|
||||
Description: "bundle of X.509 certificates of public Certificate Authorities",
|
||||
Website: "https://curl.se/docs/caextract.html",
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package rosa
|
||||
|
||||
import "hakurei.app/internal/pkg"
|
||||
|
||||
func (t Toolchain) newOpenSSL() (pkg.Artifact, string) {
|
||||
const (
|
||||
version = "3.6.2"
|
||||
checksum = "jH004dXTiE01Hp0kyShkWXwrSHEksZi4i_3v47D9H9Uz9LQ1aMwF7mrl2Tb4t_XA"
|
||||
)
|
||||
return t.NewPackage("openssl", version, newFromGitHubRelease(
|
||||
"openssl/openssl",
|
||||
"openssl-"+version,
|
||||
"openssl-"+version+".tar.gz",
|
||||
checksum,
|
||||
pkg.TarGzip,
|
||||
), &PackageAttr{
|
||||
Env: []string{
|
||||
"CC=cc",
|
||||
},
|
||||
}, &MakeHelper{
|
||||
OmitDefaults: true,
|
||||
|
||||
ConfigureName: "/usr/src/openssl/Configure",
|
||||
Configure: []KV{
|
||||
{"prefix", "/system"},
|
||||
{"libdir", "lib"},
|
||||
{"openssldir", "etc/ssl"},
|
||||
{"", "no-docs"},
|
||||
},
|
||||
Check: []string{
|
||||
"HARNESS_JOBS=" + jobsE,
|
||||
"test",
|
||||
},
|
||||
},
|
||||
Perl,
|
||||
Coreutils,
|
||||
|
||||
Zlib,
|
||||
KernelHeaders,
|
||||
), version
|
||||
}
|
||||
func init() {
|
||||
artifactsM[OpenSSL] = Metadata{
|
||||
f: Toolchain.newOpenSSL,
|
||||
|
||||
Name: "openssl",
|
||||
Description: "TLS/SSL and crypto library",
|
||||
Website: "https://www.openssl.org/",
|
||||
|
||||
ID: 2566,
|
||||
|
||||
// strange malformed tags treated as pre-releases in Anitya
|
||||
latest: (*Versions).getStable,
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package rosa
|
||||
|
||||
import "hakurei.app/internal/pkg"
|
||||
|
||||
func (t Toolchain) newP11Kit() (pkg.Artifact, string) {
|
||||
const (
|
||||
version = "0.26.2"
|
||||
checksum = "3ei-6DUVtYzrRVe-SubtNgRlweXd6H2qHmUu-_5qVyIn6gSTvZbGS2u79Y8IFb2N"
|
||||
)
|
||||
return t.NewPackage("p11-kit", version, t.newTagRemote(
|
||||
"https://github.com/p11-glue/p11-kit.git",
|
||||
version, checksum,
|
||||
), nil, &MesonHelper{
|
||||
Setup: []KV{
|
||||
{"Dsystemd", "disabled"},
|
||||
{"Dlibffi", "enabled"},
|
||||
},
|
||||
},
|
||||
Coreutils,
|
||||
Diffutils,
|
||||
|
||||
Libtasn1,
|
||||
), version
|
||||
}
|
||||
func init() {
|
||||
artifactsM[P11Kit] = Metadata{
|
||||
f: Toolchain.newP11Kit,
|
||||
|
||||
Name: "p11-kit",
|
||||
Description: "provides a way to load and enumerate PKCS#11 modules",
|
||||
Website: "https://p11-glue.freedesktop.org/p11-kit.html",
|
||||
|
||||
Dependencies: P{
|
||||
Libffi,
|
||||
Libtasn1,
|
||||
},
|
||||
|
||||
ID: 2582,
|
||||
}
|
||||
}
|
||||
26
internal/rosa/package/acl/libgen-basename.patch
Normal file
26
internal/rosa/package/acl/libgen-basename.patch
Normal file
@@ -0,0 +1,26 @@
|
||||
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
|
||||
13
internal/rosa/package/acl/musl-errno.patch
Normal file
13
internal/rosa/package/acl/musl-errno.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
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
|
||||
47
internal/rosa/package/acl/package.az
Normal file
47
internal/rosa/package/acl/package.az
Normal file
@@ -0,0 +1,47 @@
|
||||
package attr {
|
||||
description = "Commands for Manipulating Filesystem Extended Attributes";
|
||||
website = "https://savannah.nongnu.org/projects/attr";
|
||||
anitya = 137;
|
||||
|
||||
version* = "2.5.2";
|
||||
source = remoteTar {
|
||||
url = "https://download.savannah.nongnu.org/releases/attr/"+
|
||||
"attr-"+version+".tar.gz";
|
||||
checksum = "YWEphrz6vg1sUMmHHVr1CRo53pFXRhq_pjN-AlG8UgwZK1y6m7zuDhxqJhD0SV0l";
|
||||
compress = gzip;
|
||||
};
|
||||
patches = [
|
||||
"libgen-basename.patch",
|
||||
"musl-errno.patch",
|
||||
];
|
||||
|
||||
early = `
|
||||
ln -s ../../system/bin/perl /usr/bin
|
||||
`;
|
||||
|
||||
exec = make {};
|
||||
|
||||
inputs = [ perl ];
|
||||
}
|
||||
|
||||
package acl {
|
||||
description = "Commands for Manipulating POSIX Access Control Lists";
|
||||
website = "https://savannah.nongnu.org/projects/acl";
|
||||
anitya = 16;
|
||||
|
||||
version* = "2.3.2";
|
||||
source = remoteTar {
|
||||
url = "https://download.savannah.nongnu.org/releases/acl/"+
|
||||
"acl-"+version+".tar.gz";
|
||||
checksum = "-fY5nwH4K8ZHBCRXrzLdguPkqjKI6WIiGu4dBtrZ1o0t6AIU73w8wwJz_UyjIS0P";
|
||||
compress = gzip;
|
||||
};
|
||||
|
||||
exec = make {
|
||||
// makes assumptions about uid_map/gid_map
|
||||
skipCheck = true;
|
||||
};
|
||||
|
||||
inputs = [ attr ];
|
||||
runtime = [ attr ];
|
||||
}
|
||||
25
internal/rosa/package/argp-standalone.az
Normal file
25
internal/rosa/package/argp-standalone.az
Normal file
@@ -0,0 +1,25 @@
|
||||
package argp-standalone {
|
||||
description = "hierarchical argument parsing library broken out from glibc";
|
||||
website = "http://www.lysator.liu.se/~nisse/misc";
|
||||
|
||||
version* = "1.3";
|
||||
source = remoteTar {
|
||||
url = "http://www.lysator.liu.se/~nisse/misc/"+
|
||||
"argp-standalone-"+version+".tar.gz";
|
||||
checksum = "vtW0VyO2pJ-hPyYmDI2zwSLS8QL0sPAUKC1t3zNYbwN2TmsaE-fADhaVtNd3eNFl";
|
||||
compress = gzip;
|
||||
};
|
||||
|
||||
env = [
|
||||
"CC=cc -std=gnu89 -fPIC",
|
||||
];
|
||||
|
||||
exec = make {
|
||||
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
|
||||
`;
|
||||
};
|
||||
|
||||
inputs = [ diffutils ];
|
||||
}
|
||||
30
internal/rosa/package/bison.az
Normal file
30
internal/rosa/package/bison.az
Normal file
@@ -0,0 +1,30 @@
|
||||
package bison {
|
||||
description = "a general-purpose parser generator";
|
||||
website = "https://www.gnu.org/software/bison";
|
||||
anitya = 193;
|
||||
|
||||
version* = "3.8.2";
|
||||
source = remoteTar {
|
||||
url = "https://ftpmirror.gnu.org/gnu/bison/bison-"+version+".tar.gz";
|
||||
checksum = "BhRM6K7URj1LNOkIDCFDctSErLS-Xo5d9ba9seg10o6ACrgC1uNhED7CQPgIY29Y";
|
||||
compress = gzip;
|
||||
};
|
||||
|
||||
exec = make {
|
||||
check = [
|
||||
"TESTSUITEFLAGS=" + jobsFlagE + "' " + skipGNUTests {
|
||||
tests = [
|
||||
// clang miscompiles (SIGILL)
|
||||
764,
|
||||
];
|
||||
} + "'",
|
||||
"check",
|
||||
];
|
||||
};
|
||||
|
||||
inputs = [
|
||||
m4,
|
||||
diffutils,
|
||||
sed,
|
||||
];
|
||||
}
|
||||
19
internal/rosa/package/buildcatrust.az
Normal file
19
internal/rosa/package/buildcatrust.az
Normal file
@@ -0,0 +1,19 @@
|
||||
package buildcatrust {
|
||||
description = "transform certificate stores between formats";
|
||||
website = "https://github.com/nix-community/buildcatrust";
|
||||
anitya = 233988;
|
||||
|
||||
version* = "0.5.1";
|
||||
source = remoteGitHub {
|
||||
suffix = "nix-community/buildcatrust";
|
||||
tag = "v"+version;
|
||||
checksum = "oxjnuIrPVMPvD6x8VFLqB7EdbfuhouGQdtPuHDpEHGzoyH5nkxqtYN9UthMY9noA";
|
||||
};
|
||||
|
||||
early = "\nrm buildcatrust/tests/test_nonhermetic.py\n";
|
||||
|
||||
exec = pip {};
|
||||
|
||||
inputs = [ python-flit-core ];
|
||||
runtime = [ python ];
|
||||
}
|
||||
27
internal/rosa/package/bzip2.az
Normal file
27
internal/rosa/package/bzip2.az
Normal file
@@ -0,0 +1,27 @@
|
||||
package bzip2 {
|
||||
description = "a freely available, patent free, high-quality data compressor";
|
||||
website = "https://sourceware.org/bzip2";
|
||||
anitya = 237;
|
||||
|
||||
version* = "1.0.8";
|
||||
source = remoteTar {
|
||||
url = "https://sourceware.org/pub/bzip2/bzip2-"+version+".tar.gz";
|
||||
checksum = "cTLykcco7boom-s05H1JVsQi1AtChYL84nXkg_92Dm1Xt94Ob_qlMg_-NSguIK-c";
|
||||
compress = gzip;
|
||||
};
|
||||
|
||||
// uses source tree as scratch space
|
||||
writable = true;
|
||||
enterSource = true;
|
||||
|
||||
exec = make {
|
||||
skipConfigure = true;
|
||||
skipCheck = true;
|
||||
inPlace = true;
|
||||
|
||||
make = [
|
||||
"CC=cc",
|
||||
];
|
||||
install = "make PREFIX=/work/system install";
|
||||
};
|
||||
}
|
||||
13
internal/rosa/package/cmake/bootstrap-test-no-openssl.patch
Normal file
13
internal/rosa/package/cmake/bootstrap-test-no-openssl.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
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
|
||||
)
|
||||
41
internal/rosa/package/cmake/disable-broken-tests-musl.patch
Normal file
41
internal/rosa/package/cmake/disable-broken-tests-musl.patch
Normal file
@@ -0,0 +1,41 @@
|
||||
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 "^([^:]+)://([^/]+)(.*)$")
|
||||
45
internal/rosa/package/cmake/package.az
Normal file
45
internal/rosa/package/cmake/package.az
Normal file
@@ -0,0 +1,45 @@
|
||||
package cmake {
|
||||
description = "cross-platform, open-source build system";
|
||||
website = "https://cmake.org";
|
||||
anitya = 306;
|
||||
|
||||
version* = "4.3.2";
|
||||
source = remoteGitHubRelease {
|
||||
suffix = "Kitware/CMake";
|
||||
tag = "v"+version;
|
||||
name = "cmake-"+version+".tar.gz";
|
||||
checksum = "6QylwRVKletndTSkZTV2YBRwgd_9rUVgav_QW23HpjUgV21AVYZOUOal8tdBDmO7";
|
||||
compress = gzip;
|
||||
};
|
||||
patches = [
|
||||
"bootstrap-test-no-openssl.patch",
|
||||
"disable-broken-tests-musl.patch",
|
||||
];
|
||||
|
||||
// test suite expects writable source tree
|
||||
writable = true;
|
||||
|
||||
// expected to be writable in the copy made during bootstrap
|
||||
chmod = true;
|
||||
|
||||
exec = make {
|
||||
omitDefaults = true;
|
||||
|
||||
configureName = "/usr/src/cmake/bootstrap";
|
||||
configure = {
|
||||
"prefix": "/system";
|
||||
"parallel": jobsE;
|
||||
"--";
|
||||
"-DCMAKE_USE_OPENSSL": "OFF";
|
||||
"-DCMake_TEST_NO_NETWORK": "ON";
|
||||
};
|
||||
|
||||
check = [
|
||||
"CTEST_OUTPUT_ON_FAILURE=1",
|
||||
"CTEST_PARALLEL_LEVEL=128",
|
||||
"test",
|
||||
];
|
||||
};
|
||||
|
||||
inputs = [ kernel-headers ];
|
||||
}
|
||||
@@ -1,20 +1,4 @@
|
||||
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
|
||||
musl does not implement res_ninit
|
||||
|
||||
--- a/gweb/gresolv.c
|
||||
+++ b/gweb/gresolv.c
|
||||
@@ -73,37 +57,3 @@ func (t Toolchain) newConnman() (pkg.Artifact, string) {
|
||||
}
|
||||
|
||||
if (!resolv->nameserver_list)
|
||||
`},
|
||||
},
|
||||
}, &MakeHelper{
|
||||
Generate: "./bootstrap",
|
||||
},
|
||||
Automake,
|
||||
Libtool,
|
||||
PkgConfig,
|
||||
|
||||
DBus,
|
||||
IPTables,
|
||||
GnuTLS,
|
||||
Readline,
|
||||
KernelHeaders,
|
||||
), version
|
||||
}
|
||||
func init() {
|
||||
artifactsM[Connman] = Metadata{
|
||||
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,
|
||||
}
|
||||
}
|
||||
37
internal/rosa/package/connman/package.az
Normal file
37
internal/rosa/package/connman/package.az
Normal file
@@ -0,0 +1,37 @@
|
||||
package connman {
|
||||
description = "a daemon for managing Internet connections";
|
||||
website = "https://git.kernel.org/pub/scm/network/connman/connman.git";
|
||||
anitya = 337;
|
||||
|
||||
version* = "2.0";
|
||||
source = remoteTar {
|
||||
url = "https://git.kernel.org/pub/scm/network/connman/connman.git/"+
|
||||
"snapshot/connman-"+version+".tar.gz";
|
||||
checksum = "MhVTdJOhndnZn2SWd8URKo_Pj7Zvc14tntEbrVOf9L3yVWJvpb3v3Q6104tWJgtW";
|
||||
compress = gzip;
|
||||
};
|
||||
patches = [ "alpine-musl-res.patch" ];
|
||||
|
||||
exec = make {
|
||||
generate = "./bootstrap";
|
||||
};
|
||||
|
||||
inputs = [
|
||||
automake,
|
||||
libtool,
|
||||
pkg-config,
|
||||
|
||||
dbus,
|
||||
iptables,
|
||||
gnutls,
|
||||
readline,
|
||||
kernel-headers,
|
||||
];
|
||||
|
||||
runtime = [
|
||||
dbus,
|
||||
iptables,
|
||||
gnutls,
|
||||
readline,
|
||||
];
|
||||
}
|
||||
47
internal/rosa/package/curl.az
Normal file
47
internal/rosa/package/curl.az
Normal file
@@ -0,0 +1,47 @@
|
||||
package curl {
|
||||
description = "command line tool and library for transferring data with URLs";
|
||||
website = "https://curl.se";
|
||||
anitya = 381;
|
||||
|
||||
version* = "8.20.0";
|
||||
source = remoteTar {
|
||||
url = "https://curl.se/download/curl-"+version+".tar.bz2";
|
||||
checksum = "xyHXwrngIRGMasuzhn-I5MSCOhktwINbsWt1f_LuR-5jRVvyx_g6U1EQfDLEbr9r";
|
||||
compress = bzip2;
|
||||
};
|
||||
|
||||
// remove broken test
|
||||
writable = true;
|
||||
early = "\nchmod +w tests/data && rm -f tests/data/test459\n";
|
||||
|
||||
exec = make {
|
||||
configure = {
|
||||
"with-openssl";
|
||||
"with-ca-bundle": "/system/etc/ssl/certs/ca-bundle.crt";
|
||||
|
||||
"disable-smb";
|
||||
};
|
||||
|
||||
check = [
|
||||
"TFLAGS=" + jobsLFlagE,
|
||||
"test-nonflaky",
|
||||
];
|
||||
};
|
||||
|
||||
inputs = [
|
||||
perl,
|
||||
python,
|
||||
pkg-config,
|
||||
diffutils,
|
||||
|
||||
libpsl,
|
||||
openssl,
|
||||
];
|
||||
|
||||
runtime = [
|
||||
zlib,
|
||||
zstd,
|
||||
libpsl,
|
||||
openssl,
|
||||
];
|
||||
}
|
||||
63
internal/rosa/package/dbus.az
Normal file
63
internal/rosa/package/dbus.az
Normal file
@@ -0,0 +1,63 @@
|
||||
package dbus {
|
||||
description = "a message bus system";
|
||||
website = "https://www.freedesktop.org/wiki/Software/dbus";
|
||||
anitya = 5356;
|
||||
|
||||
version* = "1.16.2";
|
||||
source = remoteGitLab {
|
||||
domain = "gitlab.freedesktop.org";
|
||||
suffix = "dbus/dbus";
|
||||
ref = "dbus-"+version;
|
||||
checksum = "INwOuNdrDG7XW5ilW_vn8JSxEa444rRNc5ho97i84I1CNF09OmcFcV-gzbF4uCyg";
|
||||
};
|
||||
|
||||
// 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;
|
||||
|
||||
exec = meson {
|
||||
setup = {
|
||||
"Depoll": "enabled";
|
||||
"Dinotify": "enabled";
|
||||
"Dx11_autolaunch": "disabled";
|
||||
};
|
||||
};
|
||||
|
||||
inputs = [
|
||||
glib,
|
||||
libexpat,
|
||||
];
|
||||
|
||||
runtime = [
|
||||
glib,
|
||||
libexpat,
|
||||
];
|
||||
}
|
||||
|
||||
package xdg-dbus-proxy {
|
||||
description = "a filtering proxy for D-Bus connections";
|
||||
website = "https://github.com/flatpak/xdg-dbus-proxy";
|
||||
anitya = 58434;
|
||||
|
||||
version* = "0.1.7";
|
||||
source = remoteGitHub {
|
||||
suffix = "flatpak/xdg-dbus-proxy";
|
||||
tag = version;
|
||||
checksum = "UW5Pe-TP-XAaN-kTbxrkOQ7eYdmlAQlr2pdreLtPT0uwdAz-7rzDP8V_8PWuZBup";
|
||||
};
|
||||
|
||||
exec = meson {
|
||||
setup = {
|
||||
"Dman": "disabled";
|
||||
};
|
||||
};
|
||||
|
||||
inputs = [
|
||||
dbus,
|
||||
glib,
|
||||
];
|
||||
|
||||
runtime = [ glib ];
|
||||
}
|
||||
33
internal/rosa/package/dtc.az
Normal file
33
internal/rosa/package/dtc.az
Normal file
@@ -0,0 +1,33 @@
|
||||
package dtc {
|
||||
description = "The Device Tree Compiler";
|
||||
website = "https://git.kernel.org/pub/scm/utils/dtc/dtc.git";
|
||||
anitya = 16911;
|
||||
|
||||
version* = "1.7.2";
|
||||
source = remoteTar {
|
||||
url = "https://git.kernel.org/pub/scm/utils/dtc/dtc.git/snapshot/"+
|
||||
"dtc-v"+version+".tar.gz";
|
||||
checksum = "vUoiRynPyYRexTpS6USweT5p4SVHvvVJs8uqFkkVD-YnFjwf6v3elQ0-Etrh00Dt";
|
||||
compress = gzip;
|
||||
};
|
||||
|
||||
// works around buggy test:
|
||||
// fdtdump-runtest.sh /usr/src/dtc/tests/fdtdump.dts
|
||||
writable = true;
|
||||
chmod = true;
|
||||
|
||||
exec = meson {
|
||||
setup = {
|
||||
"Dyaml": "disabled";
|
||||
"Dstatic-build": "true";
|
||||
};
|
||||
};
|
||||
|
||||
inputs = [
|
||||
flex,
|
||||
bison,
|
||||
m4,
|
||||
coreutils,
|
||||
diffutils,
|
||||
];
|
||||
}
|
||||
49
internal/rosa/package/elfutils.az
Normal file
49
internal/rosa/package/elfutils.az
Normal file
@@ -0,0 +1,49 @@
|
||||
package elfutils {
|
||||
description = "utilities and libraries to handle ELF files and DWARF data";
|
||||
website = "https://sourceware.org/elfutils";
|
||||
anitya = 5679;
|
||||
|
||||
version* = "0.195";
|
||||
source = remoteTar {
|
||||
url = "https://sourceware.org/elfutils/ftp/"+
|
||||
version+"/elfutils-"+version+".tar.bz2";
|
||||
checksum = "JrGnBD38w8Mj0ZxDw3fKlRBFcLvRKu8rcYnX35R9yTlUSYnzTazyLboG-a2CsJlu";
|
||||
compress = bzip2;
|
||||
};
|
||||
|
||||
env = [
|
||||
"CC=cc" +
|
||||
// nonstandard glibc extension
|
||||
" -DFNM_EXTMATCH=0",
|
||||
];
|
||||
|
||||
exec = make {
|
||||
// nonstandard glibc extension
|
||||
skipCheck = true;
|
||||
|
||||
configure = {
|
||||
"enable-deterministic-archives";
|
||||
};
|
||||
};
|
||||
|
||||
inputs = [
|
||||
m4,
|
||||
pkg-config,
|
||||
|
||||
zlib,
|
||||
bzip2,
|
||||
zstd,
|
||||
argp-standalone,
|
||||
musl-fts,
|
||||
musl-obstack,
|
||||
kernel-headers,
|
||||
];
|
||||
|
||||
runtime = [
|
||||
zlib,
|
||||
bzip2,
|
||||
zstd,
|
||||
musl-fts,
|
||||
musl-obstack,
|
||||
];
|
||||
}
|
||||
47
internal/rosa/package/firmware.az
Normal file
47
internal/rosa/package/firmware.az
Normal file
@@ -0,0 +1,47 @@
|
||||
package firmware {
|
||||
description = "firmware blobs for use with the Linux kernel";
|
||||
website = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git";
|
||||
anitya = 141464;
|
||||
|
||||
version* = "20260410";
|
||||
source = remoteGitLab {
|
||||
domain = "gitlab.com";
|
||||
suffix = "kernel-firmware/linux-firmware";
|
||||
ref = version;
|
||||
checksum = "J8PdQlGqwrivpskPzbL6xacqR6mlKtXpe5RpzFfVzKPAgG81ZRXsc3qrxwdGJbil";
|
||||
};
|
||||
|
||||
// dedup creates temporary file
|
||||
writable = true;
|
||||
|
||||
// does not use configure
|
||||
enterSource = true;
|
||||
|
||||
env = [
|
||||
"HOME=/proc/nonexistent",
|
||||
];
|
||||
|
||||
exec = make {
|
||||
omitDefaults = true;
|
||||
skipConfigure = true;
|
||||
inPlace = true;
|
||||
|
||||
make = [
|
||||
"DESTDIR=/work/system",
|
||||
"install-zst",
|
||||
];
|
||||
|
||||
// requires pre-commit
|
||||
skipCheck = true;
|
||||
|
||||
install = "make " + jobsFlagE + " DESTDIR=/work/system dedup";
|
||||
};
|
||||
|
||||
inputs = [
|
||||
parallel,
|
||||
rdfind,
|
||||
zstd,
|
||||
findutils,
|
||||
coreutils,
|
||||
];
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user