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
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:
@@ -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,31 +95,30 @@ 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`
|
||||
}
|
||||
|
||||
if attr.Host != `""` {
|
||||
configure += ` \
|
||||
host := `"${ROSA_TRIPLE}"`
|
||||
if attr.Host != "" {
|
||||
host = attr.Host
|
||||
}
|
||||
if attr.Host != `""` {
|
||||
configure += ` \
|
||||
--host=` + host
|
||||
}
|
||||
if attr.Build != `""` {
|
||||
configure += ` \
|
||||
}
|
||||
|
||||
build := `"${ROSA_TRIPLE}"`
|
||||
if attr.Build != "" {
|
||||
build = attr.Build
|
||||
}
|
||||
if attr.Build != `""` {
|
||||
configure += ` \
|
||||
--build=` + build
|
||||
}
|
||||
}
|
||||
|
||||
if len(attr.Configure) > 0 {
|
||||
@@ -149,17 +150,25 @@ func (t Toolchain) NewViaMake(
|
||||
}
|
||||
}
|
||||
|
||||
makeTargets := make([]string, 1, 2+len(attr.Make))
|
||||
if !attr.SkipCheck {
|
||||
if attr.CheckName == "" {
|
||||
makeTargets = append(makeTargets, "check")
|
||||
} else {
|
||||
makeTargets = append(makeTargets, attr.CheckName)
|
||||
}
|
||||
scriptMake := `
|
||||
make \
|
||||
"-j$(nproc)"`
|
||||
if len(attr.Make) > 0 {
|
||||
scriptMake += " \\\n\t" + strings.Join(attr.Make, " \\\n\t")
|
||||
}
|
||||
makeTargets = append(makeTargets, attr.Make...)
|
||||
if len(makeTargets) == 1 {
|
||||
makeTargets = nil
|
||||
scriptMake += "\n"
|
||||
|
||||
if !attr.SkipCheck {
|
||||
scriptMake += attr.ScriptCheckEarly + `
|
||||
make \
|
||||
"-j$(nproc)" \
|
||||
`
|
||||
if len(attr.Check) > 0 {
|
||||
scriptMake += strings.Join(attr.Check, " \\\n\t")
|
||||
} else {
|
||||
scriptMake += "check"
|
||||
}
|
||||
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,
|
||||
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{
|
||||
pkg.Path(AbsUsrSrc.Append(
|
||||
name+attr.SourceSuffix,
|
||||
), attr.Writable, source),
|
||||
})...)
|
||||
return t.New(
|
||||
name+"-"+version,
|
||||
attr.Flag,
|
||||
stage0Concat(t,
|
||||
attr.NonStage0,
|
||||
finalExtra...,
|
||||
),
|
||||
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),
|
||||
})...,
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user