All checks were successful
Test / Create distribution (push) Successful in 1m5s
Test / Sandbox (push) Successful in 3m14s
Test / Hakurei (push) Successful in 4m23s
Test / ShareFS (push) Successful in 4m22s
Test / Sandbox (race detector) (push) Successful in 5m47s
Test / Hakurei (race detector) (push) Successful in 6m51s
Test / Flake checks (push) Successful in 1m29s
This change also combines the createDir and wantsDir methods, and replaces the non-inplace target of the generic helper with a deterministic path. Signed-off-by: Ophestra <cat@gensokyo.uk>
66 lines
1.4 KiB
Go
66 lines
1.4 KiB
Go
package rosa
|
|
|
|
import (
|
|
"slices"
|
|
|
|
"hakurei.app/internal/pkg"
|
|
)
|
|
|
|
var _perl = H("perl")
|
|
|
|
// MakeMakerHelper is the [Perl] MakeMaker helper.
|
|
type MakeMakerHelper struct {
|
|
// Whether to skip the check target.
|
|
SkipCheck bool
|
|
}
|
|
|
|
// extra returns perl.
|
|
func (*MakeMakerHelper) extra(int) P { return P{_perl, _make} }
|
|
|
|
// wantsChmod returns true.
|
|
func (*MakeMakerHelper) wantsChmod() bool { return true }
|
|
|
|
// wantsWrite returns true.
|
|
func (*MakeMakerHelper) wantsWrite() bool { return true }
|
|
|
|
// scriptEarly is a noop.
|
|
func (*MakeMakerHelper) scriptEarly() string { return "" }
|
|
|
|
// wantsDir requests the source directory.
|
|
func (*MakeMakerHelper) wantsDir() (string, bool) { return "", false }
|
|
|
|
// script generates Makefile.PL-based build and test commands.
|
|
func (attr *MakeMakerHelper) script(t Toolchain, _ string) string {
|
|
if attr == nil {
|
|
attr = new(MakeMakerHelper)
|
|
}
|
|
|
|
script := `perl Makefile.PL \
|
|
PREFIX=/system
|
|
make \
|
|
` + jobsFlagE
|
|
if !attr.SkipCheck && t.opts&OptSkipCheck == 0 {
|
|
script += `
|
|
make \
|
|
` + jobsFlagE + ` \
|
|
test
|
|
`
|
|
}
|
|
script += "make DESTDIR=/work install\n"
|
|
return script
|
|
}
|
|
|
|
// newViaPerlMakeMaker installs a perl module via Makefile.PL.
|
|
func (t Toolchain) newViaPerlMakeMaker(
|
|
name, version string,
|
|
source pkg.Artifact,
|
|
patches []KV,
|
|
extra ...ArtifactH,
|
|
) pkg.Artifact {
|
|
return t.NewPackage("perl-"+name, version, source, &PackageAttr{
|
|
Patches: patches,
|
|
}, (*MakeMakerHelper)(nil), slices.Concat(extra, P{
|
|
_perl,
|
|
})...)
|
|
}
|