internal/rosa/perl: Makefile.PL helper
All checks were successful
Test / Create distribution (push) Successful in 1m4s
Test / Sandbox (push) Successful in 2m47s
Test / Hakurei (push) Successful in 3m47s
Test / ShareFS (push) Successful in 3m46s
Test / Sandbox (race detector) (push) Successful in 5m24s
Test / Hakurei (race detector) (push) Successful in 6m30s
Test / Flake checks (push) Successful in 1m24s
All checks were successful
Test / Create distribution (push) Successful in 1m4s
Test / Sandbox (push) Successful in 2m47s
Test / Hakurei (push) Successful in 3m47s
Test / ShareFS (push) Successful in 3m46s
Test / Sandbox (race detector) (push) Successful in 5m24s
Test / Hakurei (race detector) (push) Successful in 6m30s
Test / Flake checks (push) Successful in 1m24s
This can be invoked from azalea. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -7,6 +7,9 @@ import (
|
||||
"hakurei.app/internal/pkg"
|
||||
)
|
||||
|
||||
// Perl is the perl interpreter used by [MakeMakerHelper].
|
||||
var Perl = H("perl")
|
||||
|
||||
// newViaPerlModuleBuild installs a perl module via Build.PL.
|
||||
func (t Toolchain) newViaPerlModuleBuild(
|
||||
name, version string,
|
||||
@@ -54,6 +57,51 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
// 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 "" }
|
||||
|
||||
// createDir returns false.
|
||||
func (*MakeMakerHelper) createDir() bool { return false }
|
||||
|
||||
// wantsDir returns the zero value.
|
||||
func (*MakeMakerHelper) wantsDir() string { return "" }
|
||||
|
||||
// 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,
|
||||
@@ -62,22 +110,8 @@ func (t Toolchain) newViaPerlMakeMaker(
|
||||
extra ...ArtifactH,
|
||||
) pkg.Artifact {
|
||||
return t.NewPackage("perl-"+name, version, source, &PackageAttr{
|
||||
// uses source tree as scratch space
|
||||
Writable: true,
|
||||
Chmod: true,
|
||||
EnterSource: true,
|
||||
|
||||
Patches: patches,
|
||||
}, &MakeHelper{
|
||||
OmitDefaults: true,
|
||||
InPlace: true,
|
||||
|
||||
ConfigureName: "perl Makefile.PL",
|
||||
Configure: []KV{
|
||||
{"PREFIX", "/system"},
|
||||
},
|
||||
Check: []string{"test"},
|
||||
}, slices.Concat(extra, P{
|
||||
}, (*MakeMakerHelper)(nil), slices.Concat(extra, P{
|
||||
Perl,
|
||||
})...)
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@ import (
|
||||
"hakurei.app/internal/pkg"
|
||||
)
|
||||
|
||||
// Python is the python interpreter used by [PipHelper].
|
||||
var Python = H("python")
|
||||
|
||||
// PipHelper is the [Python] pip packaging helper.
|
||||
type PipHelper struct {
|
||||
// Path elements joined with source.
|
||||
|
||||
@@ -523,7 +523,7 @@ cd '/usr/src/` + name + `/'
|
||||
scriptEarly += "\nmkdir -p " + dir
|
||||
}
|
||||
scriptEarly += "\ncd " + dir + "\n"
|
||||
} else if !attr.EnterSource && attr.ScriptEarly == "" {
|
||||
} else if !attr.EnterSource && attr.ScriptEarly == "" && dir != "" {
|
||||
panic("cannot remain in root")
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,6 @@ var (
|
||||
PCRE2 = H("pcre2")
|
||||
Parallel = H("parallel")
|
||||
Patch = H("patch")
|
||||
Perl = H("perl")
|
||||
PerlLocaleGettext = H("perl-Locale::gettext")
|
||||
PerlMIMECharset = H("perl-MIME::Charset")
|
||||
PerlModuleBuild = H("perl-Module::Build")
|
||||
@@ -133,7 +132,6 @@ var (
|
||||
Pixman = H("pixman")
|
||||
PkgConfig = H("pkg-config")
|
||||
Procps = H("procps")
|
||||
Python = H("python")
|
||||
PythonFlitCore = H("python-flit-core")
|
||||
PythonHatchling = H("python-hatchling")
|
||||
PythonIniConfig = H("python-iniconfig")
|
||||
|
||||
Reference in New Issue
Block a user