forked from rosa/hakurei
internal/rosa: key-value type
This type is used very frequently. The new type is much easier to type and can receive helper methods eventually if needed. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -13,7 +13,7 @@ func (t Toolchain) newAttr() (pkg.Artifact, string) {
|
|||||||
mustDecode(checksum),
|
mustDecode(checksum),
|
||||||
pkg.TarGzip,
|
pkg.TarGzip,
|
||||||
), &PackageAttr{
|
), &PackageAttr{
|
||||||
Patches: [][2]string{
|
Patches: []KV{
|
||||||
{"libgen-basename", `From 8a80d895dfd779373363c3a4b62ecce5a549efb2 Mon Sep 17 00:00:00 2001
|
{"libgen-basename", `From 8a80d895dfd779373363c3a4b62ecce5a549efb2 Mon Sep 17 00:00:00 2001
|
||||||
From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
|
From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
|
||||||
Date: Sat, 30 Mar 2024 10:17:10 +0100
|
Date: Sat, 30 Mar 2024 10:17:10 +0100
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ func (t Toolchain) newCMake() (pkg.Artifact, string) {
|
|||||||
// expected to be writable in the copy made during bootstrap
|
// expected to be writable in the copy made during bootstrap
|
||||||
Chmod: true,
|
Chmod: true,
|
||||||
|
|
||||||
Patches: [][2]string{
|
Patches: []KV{
|
||||||
{"bootstrap-test-no-openssl", `diff --git a/Tests/BootstrapTest.cmake b/Tests/BootstrapTest.cmake
|
{"bootstrap-test-no-openssl", `diff --git a/Tests/BootstrapTest.cmake b/Tests/BootstrapTest.cmake
|
||||||
index 137de78bc1..b4da52e664 100644
|
index 137de78bc1..b4da52e664 100644
|
||||||
--- a/Tests/BootstrapTest.cmake
|
--- a/Tests/BootstrapTest.cmake
|
||||||
@@ -88,7 +88,7 @@ index 2ead810437..f85cbb8b1c 100644
|
|||||||
OmitDefaults: true,
|
OmitDefaults: true,
|
||||||
|
|
||||||
ConfigureName: "/usr/src/cmake/bootstrap",
|
ConfigureName: "/usr/src/cmake/bootstrap",
|
||||||
Configure: [][2]string{
|
Configure: []KV{
|
||||||
{"prefix", "/system"},
|
{"prefix", "/system"},
|
||||||
{"parallel", `"$(nproc)"`},
|
{"parallel", `"$(nproc)"`},
|
||||||
{"--"},
|
{"--"},
|
||||||
@@ -125,7 +125,7 @@ type CMakeHelper struct {
|
|||||||
Append []string
|
Append []string
|
||||||
|
|
||||||
// CMake CACHE entries.
|
// CMake CACHE entries.
|
||||||
Cache [][2]string
|
Cache []KV
|
||||||
// Runs after install.
|
// Runs after install.
|
||||||
Script string
|
Script string
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ func (*CMakeHelper) wantsDir() string { return "/cure/" }
|
|||||||
func (attr *CMakeHelper) script(name string) string {
|
func (attr *CMakeHelper) script(name string) string {
|
||||||
if attr == nil {
|
if attr == nil {
|
||||||
attr = &CMakeHelper{
|
attr = &CMakeHelper{
|
||||||
Cache: [][2]string{
|
Cache: []KV{
|
||||||
{"CMAKE_BUILD_TYPE", "Release"},
|
{"CMAKE_BUILD_TYPE", "Release"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ func (t Toolchain) newCurl() (pkg.Artifact, string) {
|
|||||||
chmod +w tests/data && rm tests/data/test459
|
chmod +w tests/data && rm tests/data/test459
|
||||||
`,
|
`,
|
||||||
}, &MakeHelper{
|
}, &MakeHelper{
|
||||||
Configure: [][2]string{
|
Configure: []KV{
|
||||||
{"with-openssl"},
|
{"with-openssl"},
|
||||||
{"with-ca-bundle", "/system/etc/ssl/certs/ca-bundle.crt"},
|
{"with-ca-bundle", "/system/etc/ssl/certs/ca-bundle.crt"},
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ func (t Toolchain) newDTC() (pkg.Artifact, string) {
|
|||||||
Writable: true,
|
Writable: true,
|
||||||
Chmod: true,
|
Chmod: true,
|
||||||
}, &MesonHelper{
|
}, &MesonHelper{
|
||||||
Setup: [][2]string{
|
Setup: []KV{
|
||||||
{"Dyaml", "disabled"},
|
{"Dyaml", "disabled"},
|
||||||
{"Dstatic-build", "true"},
|
{"Dstatic-build", "true"},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ func (t Toolchain) newElfutils() (pkg.Artifact, string) {
|
|||||||
// nonstandard glibc extension
|
// nonstandard glibc extension
|
||||||
SkipCheck: true,
|
SkipCheck: true,
|
||||||
|
|
||||||
Configure: [][2]string{
|
Configure: []KV{
|
||||||
{"enable-deterministic-archives"},
|
{"enable-deterministic-archives"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ func (a cureEtc) Cure(t *pkg.FContext) (err error) {
|
|||||||
if err = os.MkdirAll(etc.String(), 0700); err != nil {
|
if err = os.MkdirAll(etc.String(), 0700); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for _, f := range [][2]string{
|
for _, f := range []KV{
|
||||||
{"hosts", "127.0.0.1 localhost cure cure-net\n"},
|
{"hosts", "127.0.0.1 localhost cure cure-net\n"},
|
||||||
{"passwd", `root:x:0:0:System administrator:/proc/nonexistent:/bin/sh
|
{"passwd", `root:x:0:0:System administrator:/proc/nonexistent:/bin/sh
|
||||||
cure:x:1023:1023:Cure:/usr/src:/bin/sh
|
cure:x:1023:1023:Cure:/usr/src:/bin/sh
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ func (t Toolchain) newFakeroot() (pkg.Artifact, string) {
|
|||||||
mustDecode(checksum),
|
mustDecode(checksum),
|
||||||
pkg.TarBzip2,
|
pkg.TarBzip2,
|
||||||
), &PackageAttr{
|
), &PackageAttr{
|
||||||
Patches: [][2]string{
|
Patches: []KV{
|
||||||
{"remove-broken-docs", `diff --git a/doc/Makefile.am b/doc/Makefile.am
|
{"remove-broken-docs", `diff --git a/doc/Makefile.am b/doc/Makefile.am
|
||||||
index f135ad9..85c784c 100644
|
index f135ad9..85c784c 100644
|
||||||
--- a/doc/Makefile.am
|
--- a/doc/Makefile.am
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ func (t Toolchain) newFuse() (pkg.Artifact, string) {
|
|||||||
mustDecode(checksum),
|
mustDecode(checksum),
|
||||||
pkg.TarGzip,
|
pkg.TarGzip,
|
||||||
), nil, &MesonHelper{
|
), nil, &MesonHelper{
|
||||||
Setup: [][2]string{
|
Setup: []KV{
|
||||||
{"Ddefault_library", "both"},
|
{"Ddefault_library", "both"},
|
||||||
{"Dtests", "true"},
|
{"Dtests", "true"},
|
||||||
{"Duseroot", "false"},
|
{"Duseroot", "false"},
|
||||||
|
|||||||
@@ -351,7 +351,7 @@ func (t Toolchain) newBash() (pkg.Artifact, string) {
|
|||||||
Flag: TEarly,
|
Flag: TEarly,
|
||||||
}, &MakeHelper{
|
}, &MakeHelper{
|
||||||
Script: "ln -s bash /work/system/bin/sh\n",
|
Script: "ln -s bash /work/system/bin/sh\n",
|
||||||
Configure: [][2]string{
|
Configure: []KV{
|
||||||
{"without-bash-malloc"},
|
{"without-bash-malloc"},
|
||||||
},
|
},
|
||||||
}), version
|
}), version
|
||||||
@@ -390,7 +390,7 @@ test_disable 'int main(){return 0;}' gnulib-tests/test-fchownat.c
|
|||||||
test_disable 'int main(){return 0;}' gnulib-tests/test-lchown.c
|
test_disable 'int main(){return 0;}' gnulib-tests/test-lchown.c
|
||||||
`,
|
`,
|
||||||
|
|
||||||
Patches: [][2]string{
|
Patches: []KV{
|
||||||
{"tests-fix-job-control", `From 21d287324aa43aa3a31f39619ade0deac7fd6013 Mon Sep 17 00:00:00 2001
|
{"tests-fix-job-control", `From 21d287324aa43aa3a31f39619ade0deac7fd6013 Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
|
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
|
||||||
Date: Tue, 24 Feb 2026 15:44:41 +0000
|
Date: Tue, 24 Feb 2026 15:44:41 +0000
|
||||||
@@ -485,7 +485,7 @@ index 9a395416b..fbb043312 100755
|
|||||||
|
|
||||||
Flag: TEarly,
|
Flag: TEarly,
|
||||||
}, &MakeHelper{
|
}, &MakeHelper{
|
||||||
Configure: [][2]string{
|
Configure: []KV{
|
||||||
{"enable-single-binary", "symlinks"},
|
{"enable-single-binary", "symlinks"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -720,7 +720,7 @@ func (t Toolchain) newTar() (pkg.Artifact, string) {
|
|||||||
mustDecode(checksum),
|
mustDecode(checksum),
|
||||||
pkg.TarGzip,
|
pkg.TarGzip,
|
||||||
), nil, &MakeHelper{
|
), nil, &MakeHelper{
|
||||||
Configure: [][2]string{
|
Configure: []KV{
|
||||||
{"disable-acl"},
|
{"disable-acl"},
|
||||||
{"without-posix-acls"},
|
{"without-posix-acls"},
|
||||||
{"without-xattrs"},
|
{"without-xattrs"},
|
||||||
@@ -903,7 +903,7 @@ func (t Toolchain) newGCC() (pkg.Artifact, string) {
|
|||||||
mustDecode(checksum),
|
mustDecode(checksum),
|
||||||
pkg.TarGzip,
|
pkg.TarGzip,
|
||||||
), &PackageAttr{
|
), &PackageAttr{
|
||||||
Patches: [][2]string{
|
Patches: []KV{
|
||||||
{"musl-off64_t-loff_t", `diff --git a/libgo/sysinfo.c b/libgo/sysinfo.c
|
{"musl-off64_t-loff_t", `diff --git a/libgo/sysinfo.c b/libgo/sysinfo.c
|
||||||
index 180f5c31d74..44d7ea73f7d 100644
|
index 180f5c31d74..44d7ea73f7d 100644
|
||||||
--- a/libgo/sysinfo.c
|
--- a/libgo/sysinfo.c
|
||||||
@@ -1062,7 +1062,7 @@ ln -s system/lib /work/
|
|||||||
// it also saturates the CPU for a consequential amount of time.
|
// it also saturates the CPU for a consequential amount of time.
|
||||||
Flag: TExclusive,
|
Flag: TExclusive,
|
||||||
}, &MakeHelper{
|
}, &MakeHelper{
|
||||||
Configure: [][2]string{
|
Configure: []KV{
|
||||||
{"disable-multilib"},
|
{"disable-multilib"},
|
||||||
{"with-multilib-list", `""`},
|
{"with-multilib-list", `""`},
|
||||||
{"enable-default-pie"},
|
{"enable-default-pie"},
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ func (t Toolchain) newGLib() (pkg.Artifact, string) {
|
|||||||
)),
|
)),
|
||||||
},
|
},
|
||||||
}, &MesonHelper{
|
}, &MesonHelper{
|
||||||
Setup: [][2]string{
|
Setup: []KV{
|
||||||
{"Ddefault_library", "both"},
|
{"Ddefault_library", "both"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -23,4 +23,4 @@ var hakureiSource = pkg.NewTar(pkg.NewFile(
|
|||||||
), pkg.TarGzip)
|
), pkg.TarGzip)
|
||||||
|
|
||||||
// hakureiPatches are patches applied against the compile-time source tree.
|
// hakureiPatches are patches applied against the compile-time source tree.
|
||||||
var hakureiPatches [][2]string
|
var hakureiPatches []KV
|
||||||
|
|||||||
@@ -15,4 +15,4 @@ var hakureiSource = pkg.NewHTTPGetTar(
|
|||||||
)
|
)
|
||||||
|
|
||||||
// hakureiPatches are patches applied against a hakurei release.
|
// hakureiPatches are patches applied against a hakurei release.
|
||||||
var hakureiPatches [][2]string
|
var hakureiPatches []KV
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ exec /system/sbin/depmod -m /lib/modules "$@"
|
|||||||
`))),
|
`))),
|
||||||
},
|
},
|
||||||
|
|
||||||
Patches: [][2]string{
|
Patches: []KV{
|
||||||
{"f54a91f5337cd918eb86cf600320d25b6cfd8209", `From f54a91f5337cd918eb86cf600320d25b6cfd8209 Mon Sep 17 00:00:00 2001
|
{"f54a91f5337cd918eb86cf600320d25b6cfd8209", `From f54a91f5337cd918eb86cf600320d25b6cfd8209 Mon Sep 17 00:00:00 2001
|
||||||
From: Nathan Chancellor <nathan@kernel.org>
|
From: Nathan Chancellor <nathan@kernel.org>
|
||||||
Date: Sat, 13 Dec 2025 19:58:10 +0900
|
Date: Sat, 13 Dec 2025 19:58:10 +0900
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ func (t Toolchain) newKmod() (pkg.Artifact, string) {
|
|||||||
mustDecode(checksum),
|
mustDecode(checksum),
|
||||||
pkg.TarGzip,
|
pkg.TarGzip,
|
||||||
), nil, &MesonHelper{
|
), nil, &MesonHelper{
|
||||||
Setup: [][2]string{
|
Setup: []KV{
|
||||||
{"Dmoduledir", "/system/lib/modules"},
|
{"Dmoduledir", "/system/lib/modules"},
|
||||||
{"Dsysconfdir", "/system/etc"},
|
{"Dsysconfdir", "/system/etc"},
|
||||||
{"Dbashcompletiondir", "no"},
|
{"Dbashcompletiondir", "no"},
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ func (t Toolchain) newLibseccomp() (pkg.Artifact, string) {
|
|||||||
ln -s ../system/bin/bash /bin/
|
ln -s ../system/bin/bash /bin/
|
||||||
`,
|
`,
|
||||||
|
|
||||||
Patches: [][2]string{
|
Patches: []KV{
|
||||||
{"fix-export-oob-read", `diff --git a/src/api.c b/src/api.c
|
{"fix-export-oob-read", `diff --git a/src/api.c b/src/api.c
|
||||||
index adccef3..65a277a 100644
|
index adccef3..65a277a 100644
|
||||||
--- a/src/api.c
|
--- a/src/api.c
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ type llvmAttr struct {
|
|||||||
// Concatenated with default environment for PackageAttr.Env.
|
// Concatenated with default environment for PackageAttr.Env.
|
||||||
env []string
|
env []string
|
||||||
// Concatenated with generated entries for CMakeHelper.Cache.
|
// Concatenated with generated entries for CMakeHelper.Cache.
|
||||||
cmake [][2]string
|
cmake []KV
|
||||||
// Override CMakeHelper.Append.
|
// Override CMakeHelper.Append.
|
||||||
append []string
|
append []string
|
||||||
// Passed through to PackageAttr.NonStage0.
|
// Passed through to PackageAttr.NonStage0.
|
||||||
@@ -30,7 +30,7 @@ type llvmAttr struct {
|
|||||||
script string
|
script string
|
||||||
|
|
||||||
// Patch name and body pairs.
|
// Patch name and body pairs.
|
||||||
patches [][2]string
|
patches []KV
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -94,43 +94,45 @@ func (t Toolchain) newLLVMVariant(variant string, attr *llvmAttr) pkg.Artifact {
|
|||||||
|
|
||||||
var script string
|
var script string
|
||||||
|
|
||||||
cache := [][2]string{
|
cache := []KV{
|
||||||
{"CMAKE_BUILD_TYPE", "Release"},
|
{"CMAKE_BUILD_TYPE", "Release"},
|
||||||
|
|
||||||
{"LLVM_HOST_TRIPLE", `"${ROSA_TRIPLE}"`},
|
{"LLVM_HOST_TRIPLE", `"${ROSA_TRIPLE}"`},
|
||||||
{"LLVM_DEFAULT_TARGET_TRIPLE", `"${ROSA_TRIPLE}"`},
|
{"LLVM_DEFAULT_TARGET_TRIPLE", `"${ROSA_TRIPLE}"`},
|
||||||
}
|
}
|
||||||
if len(projects) > 0 {
|
if len(projects) > 0 {
|
||||||
cache = append(cache,
|
cache = append(cache, []KV{
|
||||||
[2]string{"LLVM_ENABLE_PROJECTS", `"${ROSA_LLVM_PROJECTS}"`})
|
{"LLVM_ENABLE_PROJECTS", `"${ROSA_LLVM_PROJECTS}"`},
|
||||||
|
}...)
|
||||||
}
|
}
|
||||||
if len(runtimes) > 0 {
|
if len(runtimes) > 0 {
|
||||||
cache = append(cache,
|
cache = append(cache, []KV{
|
||||||
[2]string{"LLVM_ENABLE_RUNTIMES", `"${ROSA_LLVM_RUNTIMES}"`})
|
{"LLVM_ENABLE_RUNTIMES", `"${ROSA_LLVM_RUNTIMES}"`},
|
||||||
|
}...)
|
||||||
}
|
}
|
||||||
|
|
||||||
cmakeAppend := []string{"llvm"}
|
cmakeAppend := []string{"llvm"}
|
||||||
if attr.append != nil {
|
if attr.append != nil {
|
||||||
cmakeAppend = attr.append
|
cmakeAppend = attr.append
|
||||||
} else {
|
} else {
|
||||||
cache = append(cache,
|
cache = append(cache, []KV{
|
||||||
[2]string{"LLVM_ENABLE_LIBCXX", "ON"},
|
{"LLVM_ENABLE_LIBCXX", "ON"},
|
||||||
[2]string{"LLVM_USE_LINKER", "lld"},
|
{"LLVM_USE_LINKER", "lld"},
|
||||||
|
|
||||||
[2]string{"LLVM_INSTALL_BINUTILS_SYMLINKS", "ON"},
|
{"LLVM_INSTALL_BINUTILS_SYMLINKS", "ON"},
|
||||||
[2]string{"LLVM_INSTALL_CCTOOLS_SYMLINKS", "ON"},
|
{"LLVM_INSTALL_CCTOOLS_SYMLINKS", "ON"},
|
||||||
|
|
||||||
[2]string{"LLVM_LIT_ARGS", "'--verbose'"},
|
{"LLVM_LIT_ARGS", "'--verbose'"},
|
||||||
)
|
}...)
|
||||||
}
|
}
|
||||||
|
|
||||||
if attr.flags&llvmProjectClang != 0 {
|
if attr.flags&llvmProjectClang != 0 {
|
||||||
cache = append(cache,
|
cache = append(cache, []KV{
|
||||||
[2]string{"CLANG_DEFAULT_LINKER", "lld"},
|
{"CLANG_DEFAULT_LINKER", "lld"},
|
||||||
[2]string{"CLANG_DEFAULT_CXX_STDLIB", "libc++"},
|
{"CLANG_DEFAULT_CXX_STDLIB", "libc++"},
|
||||||
[2]string{"CLANG_DEFAULT_RTLIB", "compiler-rt"},
|
{"CLANG_DEFAULT_RTLIB", "compiler-rt"},
|
||||||
[2]string{"CLANG_DEFAULT_UNWINDLIB", "libunwind"},
|
{"CLANG_DEFAULT_UNWINDLIB", "libunwind"},
|
||||||
)
|
}...)
|
||||||
}
|
}
|
||||||
if attr.flags&llvmProjectLld != 0 {
|
if attr.flags&llvmProjectLld != 0 {
|
||||||
script += `
|
script += `
|
||||||
@@ -139,25 +141,27 @@ ln -s ld.lld /work/system/bin/ld
|
|||||||
}
|
}
|
||||||
if attr.flags&llvmRuntimeCompilerRT != 0 {
|
if attr.flags&llvmRuntimeCompilerRT != 0 {
|
||||||
if attr.append == nil {
|
if attr.append == nil {
|
||||||
cache = append(cache,
|
cache = append(cache, []KV{
|
||||||
[2]string{"COMPILER_RT_USE_LLVM_UNWINDER", "ON"})
|
{"COMPILER_RT_USE_LLVM_UNWINDER", "ON"},
|
||||||
|
}...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if attr.flags&llvmRuntimeLibunwind != 0 {
|
if attr.flags&llvmRuntimeLibunwind != 0 {
|
||||||
cache = append(cache,
|
cache = append(cache, []KV{
|
||||||
[2]string{"LIBUNWIND_USE_COMPILER_RT", "ON"})
|
{"LIBUNWIND_USE_COMPILER_RT", "ON"},
|
||||||
|
}...)
|
||||||
}
|
}
|
||||||
if attr.flags&llvmRuntimeLibcxx != 0 {
|
if attr.flags&llvmRuntimeLibcxx != 0 {
|
||||||
cache = append(cache,
|
cache = append(cache, []KV{
|
||||||
[2]string{"LIBCXX_HAS_MUSL_LIBC", "ON"},
|
{"LIBCXX_HAS_MUSL_LIBC", "ON"},
|
||||||
[2]string{"LIBCXX_USE_COMPILER_RT", "ON"},
|
{"LIBCXX_USE_COMPILER_RT", "ON"},
|
||||||
)
|
}...)
|
||||||
}
|
}
|
||||||
if attr.flags&llvmRuntimeLibcxxABI != 0 {
|
if attr.flags&llvmRuntimeLibcxxABI != 0 {
|
||||||
cache = append(cache,
|
cache = append(cache, []KV{
|
||||||
[2]string{"LIBCXXABI_USE_COMPILER_RT", "ON"},
|
{"LIBCXXABI_USE_COMPILER_RT", "ON"},
|
||||||
[2]string{"LIBCXXABI_USE_LLVM_UNWINDER", "ON"},
|
{"LIBCXXABI_USE_LLVM_UNWINDER", "ON"},
|
||||||
)
|
}...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return t.NewPackage("llvm", llvmVersion, pkg.NewHTTPGetTar(
|
return t.NewPackage("llvm", llvmVersion, pkg.NewHTTPGetTar(
|
||||||
@@ -208,7 +212,7 @@ func (t Toolchain) newLLVM() (musl, compilerRT, runtimes, clang pkg.Artifact) {
|
|||||||
panic("unsupported target " + runtime.GOARCH)
|
panic("unsupported target " + runtime.GOARCH)
|
||||||
}
|
}
|
||||||
|
|
||||||
minimalDeps := [][2]string{
|
minimalDeps := []KV{
|
||||||
{"LLVM_ENABLE_ZLIB", "OFF"},
|
{"LLVM_ENABLE_ZLIB", "OFF"},
|
||||||
{"LLVM_ENABLE_ZSTD", "OFF"},
|
{"LLVM_ENABLE_ZSTD", "OFF"},
|
||||||
{"LLVM_ENABLE_LIBXML2", "OFF"},
|
{"LLVM_ENABLE_LIBXML2", "OFF"},
|
||||||
@@ -222,7 +226,7 @@ func (t Toolchain) newLLVM() (musl, compilerRT, runtimes, clang pkg.Artifact) {
|
|||||||
env: stage0ExclConcat(t, []string{},
|
env: stage0ExclConcat(t, []string{},
|
||||||
"LDFLAGS="+earlyLDFLAGS(false),
|
"LDFLAGS="+earlyLDFLAGS(false),
|
||||||
),
|
),
|
||||||
cmake: [][2]string{
|
cmake: []KV{
|
||||||
// libc++ not yet available
|
// libc++ not yet available
|
||||||
{"CMAKE_CXX_COMPILER_TARGET", ""},
|
{"CMAKE_CXX_COMPILER_TARGET", ""},
|
||||||
|
|
||||||
@@ -272,7 +276,7 @@ ln -s \
|
|||||||
"LDFLAGS="+earlyLDFLAGS(false),
|
"LDFLAGS="+earlyLDFLAGS(false),
|
||||||
),
|
),
|
||||||
flags: llvmRuntimeLibunwind | llvmRuntimeLibcxx | llvmRuntimeLibcxxABI,
|
flags: llvmRuntimeLibunwind | llvmRuntimeLibcxx | llvmRuntimeLibcxxABI,
|
||||||
cmake: slices.Concat([][2]string{
|
cmake: slices.Concat([]KV{
|
||||||
// libc++ not yet available
|
// libc++ not yet available
|
||||||
{"CMAKE_CXX_COMPILER_WORKS", "ON"},
|
{"CMAKE_CXX_COMPILER_WORKS", "ON"},
|
||||||
|
|
||||||
@@ -293,7 +297,7 @@ ln -s \
|
|||||||
"CXXFLAGS="+earlyCXXFLAGS(),
|
"CXXFLAGS="+earlyCXXFLAGS(),
|
||||||
"LDFLAGS="+earlyLDFLAGS(false),
|
"LDFLAGS="+earlyLDFLAGS(false),
|
||||||
),
|
),
|
||||||
cmake: slices.Concat([][2]string{
|
cmake: slices.Concat([]KV{
|
||||||
{"LLVM_TARGETS_TO_BUILD", target},
|
{"LLVM_TARGETS_TO_BUILD", target},
|
||||||
{"CMAKE_CROSSCOMPILING", "OFF"},
|
{"CMAKE_CROSSCOMPILING", "OFF"},
|
||||||
{"CXX_SUPPORTS_CUSTOM_LINKER", "ON"},
|
{"CXX_SUPPORTS_CUSTOM_LINKER", "ON"},
|
||||||
@@ -310,7 +314,7 @@ ln -s clang++ /work/system/bin/c++
|
|||||||
ninja check-all
|
ninja check-all
|
||||||
`,
|
`,
|
||||||
|
|
||||||
patches: slices.Concat([][2]string{
|
patches: slices.Concat([]KV{
|
||||||
{"add-rosa-vendor", `diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h
|
{"add-rosa-vendor", `diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h
|
||||||
index 9c83abeeb3b1..5acfe5836a23 100644
|
index 9c83abeeb3b1..5acfe5836a23 100644
|
||||||
--- a/llvm/include/llvm/TargetParser/Triple.h
|
--- a/llvm/include/llvm/TargetParser/Triple.h
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package rosa
|
package rosa
|
||||||
|
|
||||||
// clangPatches are patches applied to the LLVM source tree for building clang.
|
// clangPatches are patches applied to the LLVM source tree for building clang.
|
||||||
var clangPatches [][2]string
|
var clangPatches []KV
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package rosa
|
package rosa
|
||||||
|
|
||||||
// clangPatches are patches applied to the LLVM source tree for building clang.
|
// clangPatches are patches applied to the LLVM source tree for building clang.
|
||||||
var clangPatches [][2]string
|
var clangPatches []KV
|
||||||
|
|
||||||
// one version behind, latest fails 5 tests with 2 flaky on arm64
|
// one version behind, latest fails 5 tests with 2 flaky on arm64
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ type MakeHelper struct {
|
|||||||
// Alternative name for the configure script.
|
// Alternative name for the configure script.
|
||||||
ConfigureName string
|
ConfigureName string
|
||||||
// Flags passed to the configure script.
|
// Flags passed to the configure script.
|
||||||
Configure [][2]string
|
Configure []KV
|
||||||
// Host target triple, zero value is equivalent to the Rosa OS triple.
|
// Host target triple, zero value is equivalent to the Rosa OS triple.
|
||||||
Host string
|
Host string
|
||||||
// Target triple, zero value is equivalent to the Rosa OS triple.
|
// Target triple, zero value is equivalent to the Rosa OS triple.
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ type MesonHelper struct {
|
|||||||
Script string
|
Script string
|
||||||
|
|
||||||
// Flags passed to the setup command.
|
// Flags passed to the setup command.
|
||||||
Setup [][2]string
|
Setup []KV
|
||||||
// Whether to skip meson test.
|
// Whether to skip meson test.
|
||||||
SkipTest bool
|
SkipTest bool
|
||||||
}
|
}
|
||||||
@@ -113,7 +113,7 @@ meson test \
|
|||||||
cd "$(mktemp -d)"
|
cd "$(mktemp -d)"
|
||||||
meson setup \
|
meson setup \
|
||||||
` + strings.Join(slices.Collect(func(yield func(string) bool) {
|
` + strings.Join(slices.Collect(func(yield func(string) bool) {
|
||||||
for _, v := range append([][2]string{
|
for _, v := range append([]KV{
|
||||||
{"prefix", "/system"},
|
{"prefix", "/system"},
|
||||||
{"buildtype", "release"},
|
{"buildtype", "release"},
|
||||||
}, attr.Setup...) {
|
}, attr.Setup...) {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ func (t Toolchain) newNcurses() (pkg.Artifact, string) {
|
|||||||
// "tests" are actual demo programs, not a test suite.
|
// "tests" are actual demo programs, not a test suite.
|
||||||
SkipCheck: true,
|
SkipCheck: true,
|
||||||
|
|
||||||
Configure: [][2]string{
|
Configure: []KV{
|
||||||
{"with-pkg-config"},
|
{"with-pkg-config"},
|
||||||
{"enable-pc-files"},
|
{"enable-pc-files"},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ func (t Toolchain) newOpenSSL() (pkg.Artifact, string) {
|
|||||||
OmitDefaults: true,
|
OmitDefaults: true,
|
||||||
|
|
||||||
ConfigureName: "/usr/src/openssl/Configure",
|
ConfigureName: "/usr/src/openssl/Configure",
|
||||||
Configure: [][2]string{
|
Configure: []KV{
|
||||||
{"prefix", "/system"},
|
{"prefix", "/system"},
|
||||||
{"libdir", "lib"},
|
{"libdir", "lib"},
|
||||||
{"openssldir", "etc/ssl"},
|
{"openssldir", "etc/ssl"},
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ func (t Toolchain) newPCRE2() (pkg.Artifact, string) {
|
|||||||
ln -s ../system/bin/toybox /bin/echo
|
ln -s ../system/bin/toybox /bin/echo
|
||||||
`,
|
`,
|
||||||
}, &MakeHelper{
|
}, &MakeHelper{
|
||||||
Configure: [][2]string{
|
Configure: []KV{
|
||||||
{"enable-jit"},
|
{"enable-jit"},
|
||||||
{"enable-pcre2-8"},
|
{"enable-pcre2-8"},
|
||||||
{"enable-pcre2-16"},
|
{"enable-pcre2-16"},
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ rm -f /system/bin/ps # perl does not like toybox ps
|
|||||||
InPlace: true,
|
InPlace: true,
|
||||||
|
|
||||||
ConfigureName: "./Configure",
|
ConfigureName: "./Configure",
|
||||||
Configure: [][2]string{
|
Configure: []KV{
|
||||||
{"-des"},
|
{"-des"},
|
||||||
{"Dprefix", "/system"},
|
{"Dprefix", "/system"},
|
||||||
{"Dcc", "clang"},
|
{"Dcc", "clang"},
|
||||||
@@ -67,7 +67,7 @@ func init() {
|
|||||||
func (t Toolchain) newViaPerlModuleBuild(
|
func (t Toolchain) newViaPerlModuleBuild(
|
||||||
name, version string,
|
name, version string,
|
||||||
source pkg.Artifact,
|
source pkg.Artifact,
|
||||||
patches [][2]string,
|
patches []KV,
|
||||||
extra ...PArtifact,
|
extra ...PArtifact,
|
||||||
) pkg.Artifact {
|
) pkg.Artifact {
|
||||||
if name == "" || version == "" {
|
if name == "" || version == "" {
|
||||||
@@ -116,7 +116,7 @@ func init() {
|
|||||||
func (t Toolchain) newViaPerlMakeMaker(
|
func (t Toolchain) newViaPerlMakeMaker(
|
||||||
name, version string,
|
name, version string,
|
||||||
source pkg.Artifact,
|
source pkg.Artifact,
|
||||||
patches [][2]string,
|
patches []KV,
|
||||||
extra ...PArtifact,
|
extra ...PArtifact,
|
||||||
) pkg.Artifact {
|
) pkg.Artifact {
|
||||||
return t.NewPackage("perl-"+name, version, source, &PackageAttr{
|
return t.NewPackage("perl-"+name, version, source, &PackageAttr{
|
||||||
@@ -131,7 +131,7 @@ func (t Toolchain) newViaPerlMakeMaker(
|
|||||||
InPlace: true,
|
InPlace: true,
|
||||||
|
|
||||||
ConfigureName: "perl Makefile.PL",
|
ConfigureName: "perl Makefile.PL",
|
||||||
Configure: [][2]string{
|
Configure: []KV{
|
||||||
{"PREFIX", "/system"},
|
{"PREFIX", "/system"},
|
||||||
},
|
},
|
||||||
Check: []string{"test"},
|
Check: []string{"test"},
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ func (t Toolchain) newPkgConfig() (pkg.Artifact, string) {
|
|||||||
mustDecode(checksum),
|
mustDecode(checksum),
|
||||||
pkg.TarGzip,
|
pkg.TarGzip,
|
||||||
), nil, &MakeHelper{
|
), nil, &MakeHelper{
|
||||||
Configure: [][2]string{
|
Configure: []KV{
|
||||||
{"CFLAGS", "'-Wno-int-conversion'"},
|
{"CFLAGS", "'-Wno-int-conversion'"},
|
||||||
{"with-internal-glib"},
|
{"with-internal-glib"},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ func (t Toolchain) newProcps() (pkg.Artifact, string) {
|
|||||||
pkg.TarBzip2,
|
pkg.TarBzip2,
|
||||||
), nil, &MakeHelper{
|
), nil, &MakeHelper{
|
||||||
Generate: "./autogen.sh",
|
Generate: "./autogen.sh",
|
||||||
Configure: [][2]string{
|
Configure: []KV{
|
||||||
{"without-ncurses"},
|
{"without-ncurses"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ func (t Toolchain) newQEMU() (pkg.Artifact, string) {
|
|||||||
mustDecode(checksum),
|
mustDecode(checksum),
|
||||||
pkg.TarBzip2,
|
pkg.TarBzip2,
|
||||||
), &PackageAttr{
|
), &PackageAttr{
|
||||||
Patches: [][2]string{
|
Patches: []KV{
|
||||||
{"disable-mcast-test", `diff --git a/tests/qtest/netdev-socket.c b/tests/qtest/netdev-socket.c
|
{"disable-mcast-test", `diff --git a/tests/qtest/netdev-socket.c b/tests/qtest/netdev-socket.c
|
||||||
index b731af0ad9..b5cbed4801 100644
|
index b731af0ad9..b5cbed4801 100644
|
||||||
--- a/tests/qtest/netdev-socket.c
|
--- a/tests/qtest/netdev-socket.c
|
||||||
@@ -58,7 +58,7 @@ _notrun 'appears to spuriously fail on zfs'
|
|||||||
EOF
|
EOF
|
||||||
`,
|
`,
|
||||||
}, &MakeHelper{
|
}, &MakeHelper{
|
||||||
Configure: [][2]string{
|
Configure: []KV{
|
||||||
{"disable-download"},
|
{"disable-download"},
|
||||||
{"disable-docs"},
|
{"disable-docs"},
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ func mustDecode(s string) pkg.Checksum {
|
|||||||
return pkg.MustDecode(s)
|
return pkg.MustDecode(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// KV is a key-value pair of strings.
|
||||||
|
type KV [2]string
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// AbsUsrSrc is the conventional directory to place source code under.
|
// AbsUsrSrc is the conventional directory to place source code under.
|
||||||
AbsUsrSrc = fhs.AbsUsr.Append("src")
|
AbsUsrSrc = fhs.AbsUsr.Append("src")
|
||||||
@@ -364,7 +367,7 @@ func (t Toolchain) NewPatchedSource(
|
|||||||
name, version string,
|
name, version string,
|
||||||
source pkg.Artifact,
|
source pkg.Artifact,
|
||||||
passthrough bool,
|
passthrough bool,
|
||||||
patches ...[2]string,
|
patches ...KV,
|
||||||
) pkg.Artifact {
|
) pkg.Artifact {
|
||||||
if passthrough && len(patches) == 0 {
|
if passthrough && len(patches) == 0 {
|
||||||
return source
|
return source
|
||||||
@@ -446,7 +449,7 @@ type PackageAttr struct {
|
|||||||
ScriptEarly string
|
ScriptEarly string
|
||||||
|
|
||||||
// Passed to [Toolchain.NewPatchedSource].
|
// Passed to [Toolchain.NewPatchedSource].
|
||||||
Patches [][2]string
|
Patches []KV
|
||||||
// Kind of source artifact.
|
// Kind of source artifact.
|
||||||
SourceKind int
|
SourceKind int
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ func (t Toolchain) newRsync() (pkg.Artifact, string) {
|
|||||||
), &PackageAttr{
|
), &PackageAttr{
|
||||||
Flag: TEarly,
|
Flag: TEarly,
|
||||||
}, &MakeHelper{
|
}, &MakeHelper{
|
||||||
Configure: [][2]string{
|
Configure: []KV{
|
||||||
{"disable-openssl"},
|
{"disable-openssl"},
|
||||||
{"disable-xxhash"},
|
{"disable-xxhash"},
|
||||||
{"disable-zstd"},
|
{"disable-zstd"},
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ sed -i 's/unsigned int msg_len;$/uint32_t msg_len;/g' \
|
|||||||
tests/nlattr.c
|
tests/nlattr.c
|
||||||
`,
|
`,
|
||||||
}, &MakeHelper{
|
}, &MakeHelper{
|
||||||
Configure: [][2]string{
|
Configure: []KV{
|
||||||
// tests broken on clang
|
// tests broken on clang
|
||||||
{"disable-gcc-Werror"},
|
{"disable-gcc-Werror"},
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ func (t Toolchain) newUtilLinux() (pkg.Artifact, string) {
|
|||||||
ln -s ../system/bin/bash /bin/
|
ln -s ../system/bin/bash /bin/
|
||||||
`,
|
`,
|
||||||
}, &MakeHelper{
|
}, &MakeHelper{
|
||||||
Configure: [][2]string{
|
Configure: []KV{
|
||||||
{"disable-use-tty-group"},
|
{"disable-use-tty-group"},
|
||||||
{"disable-makeinstall-setuid"},
|
{"disable-makeinstall-setuid"},
|
||||||
{"disable-makeinstall-chown"},
|
{"disable-makeinstall-chown"},
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ chmod +w tests tests/sanity-test.c
|
|||||||
echo 'int main(){}' > tests/sanity-test.c
|
echo 'int main(){}' > tests/sanity-test.c
|
||||||
`,
|
`,
|
||||||
}, &MesonHelper{
|
}, &MesonHelper{
|
||||||
Setup: [][2]string{
|
Setup: []KV{
|
||||||
{"Ddefault_library", "both"},
|
{"Ddefault_library", "both"},
|
||||||
{"Ddocumentation", "false"},
|
{"Ddocumentation", "false"},
|
||||||
{"Dtests", "true"},
|
{"Dtests", "true"},
|
||||||
@@ -63,7 +63,7 @@ func (t Toolchain) newWaylandProtocols() (pkg.Artifact, string) {
|
|||||||
mustDecode(checksum),
|
mustDecode(checksum),
|
||||||
pkg.TarBzip2,
|
pkg.TarBzip2,
|
||||||
), &PackageAttr{
|
), &PackageAttr{
|
||||||
Patches: [][2]string{
|
Patches: []KV{
|
||||||
{"build-only", `From 8b4c76275fa1b6e0a99a53494151d9a2c907144d Mon Sep 17 00:00:00 2001
|
{"build-only", `From 8b4c76275fa1b6e0a99a53494151d9a2c907144d Mon Sep 17 00:00:00 2001
|
||||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||||
Date: Fri, 8 Nov 2024 11:27:25 -0600
|
Date: Fri, 8 Nov 2024 11:27:25 -0600
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ func (t Toolchain) newZlib() (pkg.Artifact, string) {
|
|||||||
mustDecode(checksum),
|
mustDecode(checksum),
|
||||||
pkg.TarGzip,
|
pkg.TarGzip,
|
||||||
), nil, &CMakeHelper{
|
), nil, &CMakeHelper{
|
||||||
Cache: [][2]string{
|
Cache: []KV{
|
||||||
{"CMAKE_BUILD_TYPE", "Release"},
|
{"CMAKE_BUILD_TYPE", "Release"},
|
||||||
|
|
||||||
{"ZLIB_BUILD_TESTING", "OFF"},
|
{"ZLIB_BUILD_TESTING", "OFF"},
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ func (t Toolchain) newZstd() (pkg.Artifact, string) {
|
|||||||
pkg.TarGzip,
|
pkg.TarGzip,
|
||||||
), nil, &CMakeHelper{
|
), nil, &CMakeHelper{
|
||||||
Append: []string{"build", "cmake"},
|
Append: []string{"build", "cmake"},
|
||||||
Cache: [][2]string{
|
Cache: []KV{
|
||||||
{"CMAKE_BUILD_TYPE", "Release"},
|
{"CMAKE_BUILD_TYPE", "Release"},
|
||||||
},
|
},
|
||||||
}), version
|
}), version
|
||||||
|
|||||||
Reference in New Issue
Block a user