internal/rosa/make: split build and check
All checks were successful
Test / Create distribution (push) Successful in 59s
Test / Sandbox (push) Successful in 2m41s
Test / Hakurei (push) Successful in 3m53s
Test / ShareFS (push) Successful in 3m57s
Test / Hpkg (push) Successful in 4m28s
Test / Sandbox (race detector) (push) Successful in 5m5s
Test / Hakurei (race detector) (push) Successful in 6m9s
Test / Flake checks (push) Successful in 2m26s

Doing these together breaks far too many buggy makefiles.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-03-01 12:11:41 +09:00
parent 1d0fcf3a75
commit 51d3df2419
19 changed files with 119 additions and 145 deletions

View File

@@ -24,14 +24,13 @@ func (t Toolchain) newCMake() pkg.Artifact {
), &MakeAttr{
OmitDefaults: true,
SkipConfigure: true,
ScriptConfigured: `
/usr/src/cmake/bootstrap \
--prefix=/system \
--parallel="$(nproc)" \
-- \
-DCMAKE_USE_OPENSSL=OFF
`,
ConfigureName: "/usr/src/cmake/bootstrap",
Configure: [][2]string{
{"prefix", "/system"},
{"parallel", `"$(nproc)"`},
{"--"},
{"-DCMAKE_USE_OPENSSL", "OFF"},
},
SkipCheck: true,
},
t.Load(KernelHeaders),

View File

@@ -19,9 +19,6 @@ func (t Toolchain) newCurl() pkg.Artifact {
{"with-openssl"},
{"with-ca-bundle", "/system/etc/ssl/certs/ca-bundle.crt"},
},
ScriptConfigured: `
make "-j$(nproc)"
`,
},
t.Load(Perl),

View File

@@ -1,8 +1,6 @@
package rosa
import (
"hakurei.app/internal/pkg"
)
import "hakurei.app/internal/pkg"
func (t Toolchain) newGit() pkg.Artifact {
const (
@@ -21,20 +19,14 @@ func (t Toolchain) newGit() pkg.Artifact {
Writable: true,
InPlace: true,
// test suite in subdirectory
SkipCheck: true,
Make: []string{"all"},
ScriptEarly: `
cd /usr/src/git
make configure
`,
Script: `
ln -s ../../system/bin/perl /usr/bin/ || true
function disable_test {
local test=$1 pattern=$2
local test=$1 pattern=${2:-''}
if [ $# -eq 1 ]; then
rm "t/${test}.sh"
else
@@ -56,12 +48,12 @@ disable_test t9300-fast-import
disable_test t0211-trace2-perf
disable_test t1517-outside-repo
disable_test t2200-add-update
make \
-C t \
GIT_PROVE_OPTS="--jobs 32 --failures" \
prove
`,
Check: []string{
"-C t",
`GIT_PROVE_OPTS="--jobs 32 --failures"`,
"prove",
},
},
t.Load(Perl),
t.Load(Diffutils),

View File

@@ -65,8 +65,9 @@ func (t Toolchain) newAutoconf() pkg.Artifact {
mustDecode(checksum),
pkg.TarGzip,
), &MakeAttr{
Make: []string{
Check: []string{
`TESTSUITEFLAGS="-j$(nproc)"`,
"check",
},
Flag: TExclusive,
},
@@ -122,8 +123,9 @@ func (t Toolchain) newLibtool() pkg.Artifact {
mustDecode(checksum),
pkg.TarGzip,
), &MakeAttr{
Make: []string{
`TESTSUITEFLAGS=32`,
Check: []string{
`TESTSUITEFLAGS="-j$(nproc)"`,
"check",
},
},
t.Load(M4),
@@ -442,8 +444,9 @@ func (t Toolchain) newTar() pkg.Artifact {
{"without-posix-acls"},
{"without-xattrs"},
},
Make: []string{
Check: []string{
`TESTSUITEFLAGS="-j$(nproc)"`,
"check",
},
},
t.Load(Diffutils),
@@ -464,11 +467,7 @@ func (t Toolchain) newBinutils() pkg.Artifact {
nil, "https://ftpmirror.gnu.org/gnu/binutils/binutils-"+version+".tar.bz2",
mustDecode(checksum),
pkg.TarBzip2,
), &MakeAttr{
ScriptConfigured: `
make "-j$(nproc)"
`,
},
), nil,
t.Load(Bash),
)
}
@@ -484,11 +483,7 @@ func (t Toolchain) newGMP() pkg.Artifact {
"gmp-"+version+".tar.bz2",
mustDecode(checksum),
pkg.TarBzip2,
), &MakeAttr{
ScriptConfigured: `
make "-j$(nproc)"
`,
},
), nil,
t.Load(M4),
)
}

View File

@@ -66,6 +66,7 @@ echo '# Building hakurei.'
go generate -v ./...
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"
-X hakurei.app/internal/info.hakureiPath=/system/bin/hakurei

View File

@@ -29,7 +29,7 @@ func (t Toolchain) newKernelHeaders() pkg.Artifact {
"-f /usr/src/kernel-headers/Makefile",
"O=/tmp/kbuild",
"LLVM=1",
`HOSTLDFLAGS="${LDFLAGS}"`,
`HOSTLDFLAGS="${LDFLAGS:-''}"`,
"INSTALL_HDR_PATH=/work/system",
"headers_install",
},

View File

@@ -31,7 +31,7 @@ cd /usr/src/libcap
"CC=cc",
"all",
},
CheckName: "test",
Check: []string{"test"},
},
t.Load(Bash),
t.Load(Diffutils),

View File

@@ -20,9 +20,6 @@ func (t Toolchain) newLibgd() pkg.Artifact {
ScriptEarly: `
mkdir /dev/shm/gd
`,
Configure: [][2]string{
{"enable-static"},
},
},
t.Load(Zlib),
)

View File

@@ -19,9 +19,6 @@ func (t Toolchain) newLibseccomp() pkg.Artifact {
ScriptEarly: `
ln -s ../system/bin/bash /bin/
`,
Configure: [][2]string{
{"enable-static"},
},
},
t.Load(Bash),
t.Load(Diffutils),

View File

@@ -22,9 +22,6 @@ cd /usr/src/
tar xf libxml2.tar.xz
mv libxml2-` + version + ` libxml2
`,
Configure: [][2]string{
{"enable-static"},
},
SourceSuffix: ".tar.xz",
},
t.Load(Diffutils),

View File

@@ -22,9 +22,6 @@ cd /usr/src/
tar xf libxslt.tar.xz
mv libxslt-` + version + ` libxslt
`,
Configure: [][2]string{
{"enable-static"},
},
SourceSuffix: ".tar.xz",
// python libxml2 cyclic dependency

View File

@@ -45,6 +45,8 @@ type MakeAttr struct {
ScriptEarly string
// Runs after configure.
ScriptConfigured string
// Runs before check.
ScriptCheckEarly string
// Runs after install.
Script string
@@ -66,7 +68,7 @@ type MakeAttr struct {
// Whether to skip the check target.
SkipCheck bool
// Name of the check target, zero value is equivalent to "check".
CheckName string
Check []string
// Replaces the default install command.
ScriptInstall string
@@ -93,32 +95,31 @@ func (t Toolchain) NewViaMake(
attr = new(MakeAttr)
}
host := `"${ROSA_TRIPLE}"`
if attr.Host != "" {
host = attr.Host
}
build := `"${ROSA_TRIPLE}"`
if attr.Build != "" {
build = attr.Build
}
var configure string
if !attr.SkipConfigure {
configure = attr.ConfigureName
if configure == "" {
configure += `
/usr/src/` + name + `/configure \
configure += `/usr/src/` + name + `/configure \
--prefix=/system`
}
host := `"${ROSA_TRIPLE}"`
if attr.Host != "" {
host = attr.Host
}
if attr.Host != `""` {
configure += ` \
--host=` + host
}
build := `"${ROSA_TRIPLE}"`
if attr.Build != "" {
build = attr.Build
}
if attr.Build != `""` {
configure += ` \
--build=` + build
}
}
if len(attr.Configure) > 0 {
const sep = " \\\n\t"
@@ -149,17 +150,25 @@ func (t Toolchain) NewViaMake(
}
}
makeTargets := make([]string, 1, 2+len(attr.Make))
scriptMake := `
make \
"-j$(nproc)"`
if len(attr.Make) > 0 {
scriptMake += " \\\n\t" + strings.Join(attr.Make, " \\\n\t")
}
scriptMake += "\n"
if !attr.SkipCheck {
if attr.CheckName == "" {
makeTargets = append(makeTargets, "check")
scriptMake += attr.ScriptCheckEarly + `
make \
"-j$(nproc)" \
`
if len(attr.Check) > 0 {
scriptMake += strings.Join(attr.Check, " \\\n\t")
} else {
makeTargets = append(makeTargets, attr.CheckName)
scriptMake += "check"
}
}
makeTargets = append(makeTargets, attr.Make...)
if len(makeTargets) == 1 {
makeTargets = nil
scriptMake += "\n"
}
var finalExtra []pkg.Artifact
@@ -176,7 +185,9 @@ func (t Toolchain) NewViaMake(
scriptEarly := attr.ScriptEarly
if !attr.InPlace {
scriptEarly += "\ncd \"$(mktemp -d)\""
scriptEarly += `
cd "$(mktemp -d)"
`
} else if scriptEarly == "" {
panic("cannot remain in root")
}
@@ -187,14 +198,25 @@ func (t Toolchain) NewViaMake(
}
scriptInstall += "\n"
return t.New(name+"-"+version, attr.Flag, stage0Concat(t,
return t.New(
name+"-"+version,
attr.Flag,
stage0Concat(t,
attr.NonStage0,
finalExtra...,
), nil, attr.Env, scriptEarly+configure+attr.ScriptConfigured+`
make "-j$(nproc)"`+strings.Join(makeTargets, " ")+`
`+scriptInstall+attr.Script, slices.Concat(attr.Paths, []pkg.ExecPath{
),
nil,
attr.Env,
scriptEarly+
configure+
attr.ScriptConfigured+
scriptMake+
scriptInstall+
attr.Script,
slices.Concat(attr.Paths, []pkg.ExecPath{
pkg.Path(AbsUsrSrc.Append(
name+attr.SourceSuffix,
), attr.Writable, source),
})...)
})...,
)
}

View File

@@ -14,23 +14,23 @@ func (t Toolchain) newOpenSSL() pkg.Artifact {
pkg.TarGzip,
), &MakeAttr{
OmitDefaults: true,
SkipConfigure: true,
Env: []string{
"CC=cc",
},
ScriptConfigured: `
/usr/src/openssl/Configure \
--prefix=/system \
--libdir=lib \
--openssldir=etc/ssl
`,
CheckName: "test",
Make: []string{
ConfigureName: "/usr/src/openssl/Configure",
Configure: [][2]string{
{"prefix", "/system"},
{"libdir", "lib"},
{"openssldir", "etc/ssl"},
},
Check: []string{
`HARNESS_JOBS="$(expr "$(nproc)" '*' 2)"`,
"test",
},
},
t.Load(Perl),
t.Load(Coreutils),
t.Load(Zlib),
t.Load(KernelHeaders),

View File

@@ -29,8 +29,6 @@ echo 'print STDOUT "1..0 # Skip broken test\n";' > ext/Pod-Html/t/htmldir3.t
rm -f /system/bin/ps # perl does not like toybox ps
`,
ConfigureName: "./Configure",
Host: `""`,
Build: `""`,
Configure: [][2]string{
{"-des"},
{"Dprefix", "/system"},
@@ -40,7 +38,10 @@ rm -f /system/bin/ps # perl does not like toybox ps
{"Doptimize", "'-O2 -fno-strict-aliasing'"},
{"Duseithreads"},
},
CheckName: "TEST_JOBS=256 test_harness",
Check: []string{
"TEST_JOBS=256",
"test_harness",
},
ScriptInstall: "./perl -Ilib -I. installperl --destdir=/work",
Flag: TEarly,
@@ -97,14 +98,16 @@ func (t Toolchain) newViaPerlMakeMaker(
), &MakeAttr{
Writable: true,
OmitDefaults: true,
SkipConfigure: true,
InPlace: true,
ScriptEarly: `
cd /usr/src/perl-` + name + `
perl Makefile.PL PREFIX=/system
`,
CheckName: "test",
ConfigureName: "perl Makefile.PL",
Configure: [][2]string{
{"PREFIX", "/system"},
},
Check: []string{"test"},
}, slices.Concat(extra, []pkg.Artifact{
t.Load(Perl),
})...)

View File

@@ -48,12 +48,7 @@ func (t Toolchain) newPython() pkg.Artifact {
"LDFLAGS=-Wl,--dynamic-linker=/system/lib/" +
"ld-musl-" + linuxArch() + ".so.1",
},
ScriptEarly: `
export HOME="$(mktemp -d)"
`,
CheckName: "test",
Check: []string{"test"},
},
t.Load(Zlib),
t.Load(Libffi),

View File

@@ -1,8 +1,6 @@
package rosa
import (
"hakurei.app/internal/pkg"
)
import "hakurei.app/internal/pkg"
func (t Toolchain) newQEMU() pkg.Artifact {
const (
@@ -57,7 +55,6 @@ _notrun 'appears to spuriously fail on zfs'
EOF
)
`,
Configure: [][2]string{
{"disable-download"},
{"disable-docs"},
@@ -70,10 +67,6 @@ EOF
"ppc-softmmu," +
"ppc64-softmmu"},
},
ScriptConfigured: `
make "-j$(nproc)"
`,
},
t.Load(Bash),
t.Load(Python),

View File

@@ -19,7 +19,7 @@ func (t Toolchain) newToybox(suffix, script string) pkg.Artifact {
SkipConfigure: true,
ScriptEarly: `
LDFLAGS="${LDFLAGS} -static"
LDFLAGS="${LDFLAGS:-''} -static"
chmod +w /bin/
ln -rs "$(which bash)" /bin/ || true
@@ -37,12 +37,13 @@ make defconfig
sed -i \
's/^CONFIG_TOYBOX_ZHELP=y$/CONFIG_TOYBOX_ZHELP=0/' \
.config
make "-j$(nproc)"
`,
ScriptConfigured: script,
CheckName: "USER=cure tests",
SkipCheck: t.isStage0(),
Check: []string{
"USER=cure",
"tests",
},
ScriptInstall: "PREFIX=/work/system/bin make install_flat",
Script: `
mkdir -p /work/usr/bin

View File

@@ -64,10 +64,6 @@ func (t Toolchain) newLibXau() pkg.Artifact {
cd /usr/src/libXau
autoreconf -if
`,
Configure: [][2]string{
{"enable-static"},
},
},
t.Load(M4),
t.Load(Perl),

View File

@@ -11,11 +11,7 @@ func (t Toolchain) newXCBProto() pkg.Artifact {
nil, "https://xcb.freedesktop.org/dist/xcb-proto-"+version+".tar.gz",
mustDecode(checksum),
pkg.TarGzip,
), &MakeAttr{
Configure: [][2]string{
{"enable-static"},
},
},
), nil,
t.Load(Python),
)
}
@@ -30,11 +26,7 @@ func (t Toolchain) newXCB() pkg.Artifact {
nil, "https://xcb.freedesktop.org/dist/libxcb-"+version+".tar.gz",
mustDecode(checksum),
pkg.TarGzip,
), &MakeAttr{
Configure: [][2]string{
{"enable-static"},
},
},
), nil,
t.Load(Python),
t.Load(PkgConfig),