Files
hakurei/internal/rosa/perl.go
Ophestra d2c6d486b0
All checks were successful
Test / Create distribution (push) Successful in 58s
Test / Sandbox (push) Successful in 2m36s
Test / Hakurei (push) Successful in 3m42s
Test / ShareFS (push) Successful in 3m48s
Test / Sandbox (race detector) (push) Successful in 4m55s
Test / Hakurei (race detector) (push) Successful in 5m53s
Test / Flake checks (push) Successful in 1m35s
internal/rosa: provide package metadata
This had to be done out-of-band because there was no way to efficiently represent these within Artifact.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-03-05 00:20:27 +09:00

334 lines
9.0 KiB
Go

package rosa
import (
"slices"
"hakurei.app/internal/pkg"
)
func (t Toolchain) newPerl() (pkg.Artifact, string) {
const (
version = "5.42.0"
checksum = "2KR7Jbpk-ZVn1a30LQRwbgUvg2AXlPQZfzrqCr31qD5-yEsTwVQ_W76eZH-EdxM9"
)
return t.NewPackage("perl", version, pkg.NewHTTPGetTar(
nil, "https://www.cpan.org/src/5.0/perl-"+version+".tar.gz",
mustDecode(checksum),
pkg.TarGzip,
), &PackageAttr{
// uses source tree as scratch space
Writable: true,
Chmod: true,
ScriptEarly: `
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
`,
Flag: TEarly,
}, &MakeHelper{
OmitDefaults: true,
InPlace: true,
ConfigureName: "./Configure",
Configure: [][2]string{
{"-des"},
{"Dprefix", "/system"},
{"Dcc", "clang"},
{"Dcflags", "--std=gnu99"},
{"Dldflags", `"${LDFLAGS:-''}"`},
{"Doptimize", "'-O2 -fno-strict-aliasing'"},
{"Duseithreads"},
},
Check: []string{
"TEST_JOBS=256",
"test_harness",
},
Install: "./perl -Ilib -I. installperl --destdir=/work",
}), version
}
func init() {
artifactsM[Perl] = Metadata{
f: Toolchain.newPerl,
Name: "perl",
Description: "The Perl Programming language",
Website: "https://www.perl.org/",
}
}
// newViaPerlModuleBuild installs a perl module via Build.PL.
func (t Toolchain) newViaPerlModuleBuild(
name, version string,
source pkg.Artifact,
patches [][2]string,
extra ...pkg.Artifact,
) pkg.Artifact {
if name == "" || version == "" {
panic("names must be non-empty")
}
return t.New("perl-"+name, 0, slices.Concat(extra, []pkg.Artifact{
t.Load(Perl),
}), nil, nil, `
cd /usr/src/`+name+`
perl Build.PL --prefix=/system
./Build build
./Build test
./Build install --destdir=/work
`, pkg.Path(AbsUsrSrc.Append(name), true, t.NewPatchedSource(
"perl-"+name, version, source, false, patches...,
)))
}
func (t Toolchain) newPerlModuleBuild() (pkg.Artifact, string) {
const (
version = "0.4234"
checksum = "ZKxEFG4hE1rqZt52zBL2LRZBMkYzhjb5-cTBXcsyA52EbPeeYyVxU176yAea8-Di"
)
return t.newViaPerlModuleBuild("Module-Build", version, pkg.NewHTTPGetTar(
nil, "https://cpan.metacpan.org/authors/id/L/LE/LEONT/"+
"Module-Build-"+version+".tar.gz",
mustDecode(checksum),
pkg.TarGzip,
), nil), version
}
func init() {
artifactsM[PerlModuleBuild] = Metadata{
f: Toolchain.newPerlModuleBuild,
Name: "perl-Module::Build",
Description: "build and install Perl modules",
Website: "https://metacpan.org/release/Module-Build",
}
}
// newViaPerlMakeMaker installs a perl module via Makefile.PL.
func (t Toolchain) newViaPerlMakeMaker(
name, version string,
source pkg.Artifact,
patches [][2]string,
extra ...PArtifact,
) 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: [][2]string{
{"PREFIX", "/system"},
},
Check: []string{"test"},
}, slices.Concat(extra, []PArtifact{
Perl,
})...)
}
func (t Toolchain) newPerlLocaleGettext() (pkg.Artifact, string) {
const (
version = "1.07"
checksum = "cFq4BKFD1MWSoa7lsrPjpdo9kzPqd0jlRcBFUyL1L1isw8m3D_Sge_ff0MAu_9J3"
)
return t.newViaPerlMakeMaker("Locale::gettext", version, pkg.NewHTTPGetTar(
nil, "https://cpan.metacpan.org/authors/id/P/PV/PVANDRY/"+
"Locale-gettext-"+version+".tar.gz",
mustDecode(checksum),
pkg.TarGzip,
), nil), version
}
func init() {
artifactsM[PerlLocaleGettext] = Metadata{
f: Toolchain.newPerlLocaleGettext,
Name: "perl-Locale::gettext",
Description: "message handling functions",
Website: "https://metacpan.org/release/Locale-gettext",
}
}
func (t Toolchain) newPerlPodParser() (pkg.Artifact, string) {
const (
version = "1.67"
checksum = "RdURu9mOfExk_loCp6abxlcQV3FycSNbTqhRS9i6JUqnYfGGEgercK30g0gjYyqe"
)
return t.newViaPerlMakeMaker("Pod::Parser", version, pkg.NewHTTPGetTar(
nil, "https://cpan.metacpan.org/authors/id/M/MA/MAREKR/"+
"Pod-Parser-"+version+".tar.gz",
mustDecode(checksum),
pkg.TarGzip,
), nil), version
}
func init() {
artifactsM[PerlPodParser] = Metadata{
f: Toolchain.newPerlPodParser,
Name: "perl-Pod::Parser",
Description: "base class for creating POD filters and translators",
Website: "https://metacpan.org/release/Pod-Parser",
}
}
func (t Toolchain) newPerlSGMLS() (pkg.Artifact, string) {
const (
version = "1.1"
checksum = "aZijn4MUqD-wfyZgdcCruCwl4SgDdu25cNmJ4_UvdAk9a7uz4gzMQdoeB6DQ6QOy"
)
return t.newViaPerlMakeMaker("SGMLS", version, pkg.NewHTTPGetTar(
nil, "https://cpan.metacpan.org/authors/id/R/RA/RAAB/"+
"SGMLSpm-"+version+".tar.gz",
mustDecode(checksum),
pkg.TarGzip,
), nil), version
}
func init() {
artifactsM[PerlSGMLS] = Metadata{
f: Toolchain.newPerlSGMLS,
Name: "perl-SGMLS",
Description: "class for postprocessing the output from the sgmls and nsgmls parsers",
Website: "https://metacpan.org/release/RAAB/SGMLSpm-1.1",
}
}
func (t Toolchain) newPerlTermReadKey() (pkg.Artifact, string) {
const (
version = "2.38"
checksum = "qerL8Xo7kD0f42PZoiEbmE8Roc_S9pOa27LXelY4DN_0UNy_u5wLrGHI8utNlaiI"
)
return t.newViaPerlMakeMaker("Term::ReadKey", version, pkg.NewHTTPGetTar(
nil, "https://cpan.metacpan.org/authors/id/J/JS/JSTOWE/"+
"TermReadKey-"+version+".tar.gz",
mustDecode(checksum),
pkg.TarGzip,
), nil), version
}
func init() {
artifactsM[PerlTermReadKey] = Metadata{
f: Toolchain.newPerlTermReadKey,
Name: "perl-Term::ReadKey",
Description: "a perl module for simple terminal control",
Website: "https://metacpan.org/release/TermReadKey",
}
}
func (t Toolchain) newPerlTextCharWidth() (pkg.Artifact, string) {
const (
version = "0.04"
checksum = "G2p5RHU4_HiZ23ZusBA_enTlVMxz0J4esUx4CGcOPhY6xYTbp-aXWRN6lYZpzBw2"
)
return t.newViaPerlMakeMaker("Text::CharWidth", version, pkg.NewHTTPGetTar(
nil, "https://cpan.metacpan.org/authors/id/K/KU/KUBOTA/"+
"Text-CharWidth-"+version+".tar.gz",
mustDecode(checksum),
pkg.TarGzip,
), nil), version
}
func init() {
artifactsM[PerlTextCharWidth] = Metadata{
f: Toolchain.newPerlTextCharWidth,
Name: "perl-Text::CharWidth",
Description: "get number of occupied columns of a string on terminal",
Website: "https://metacpan.org/release/Text-CharWidth",
}
}
func (t Toolchain) newPerlTextWrapI18N() (pkg.Artifact, string) {
const (
version = "0.06"
checksum = "Vmo89qLgxUqyQ6QmWJVqu60aQAUjrNKRjFQSXGnvClxofzRjiCa6idzPgJ4VkixM"
)
return t.newViaPerlMakeMaker("Text::WrapI18N", version, pkg.NewHTTPGetTar(
nil, "https://cpan.metacpan.org/authors/id/K/KU/KUBOTA/"+
"Text-WrapI18N-"+version+".tar.gz",
mustDecode(checksum),
pkg.TarGzip,
), nil,
PerlTextCharWidth,
), version
}
func init() {
artifactsM[PerlTextWrapI18N] = Metadata{
f: Toolchain.newPerlTextWrapI18N,
Name: "perl-Text::WrapI18N",
Description: "line wrapping module",
Website: "https://metacpan.org/release/Text-WrapI18N",
}
}
func (t Toolchain) newPerlMIMECharset() (pkg.Artifact, string) {
const (
version = "1.013.1"
checksum = "Ou_ukcrOa1cgtE3mptinb-os3bdL1SXzbRDFZQF3prrJj-drc3rp_huay7iDLJol"
)
return t.newViaPerlMakeMaker("MIME::Charset", version, pkg.NewHTTPGetTar(
nil, "https://cpan.metacpan.org/authors/id/N/NE/NEZUMI/"+
"MIME-Charset-"+version+".tar.gz",
mustDecode(checksum),
pkg.TarGzip,
), nil), version
}
func init() {
artifactsM[PerlMIMECharset] = Metadata{
f: Toolchain.newPerlMIMECharset,
Name: "perl-MIME::Charset",
Description: "Charset Information for MIME",
Website: "https://metacpan.org/release/MIME-Charset",
}
}
func (t Toolchain) newPerlUnicodeGCString() (pkg.Artifact, string) {
const (
version = "2019.001"
checksum = "ZHVkh7EDgAUHnTpvXsnPAuWpgNoBImtY_9_8TIbo2co_WgUwEb0MtXPhI8pAZ5OH"
)
return t.newViaPerlMakeMaker("Unicode::GCString", version, pkg.NewHTTPGetTar(
nil, "https://cpan.metacpan.org/authors/id/N/NE/NEZUMI/"+
"Unicode-LineBreak-"+version+".tar.gz",
mustDecode(checksum),
pkg.TarGzip,
), nil,
PerlMIMECharset,
), version
}
func init() {
artifactsM[PerlUnicodeGCString] = Metadata{
f: Toolchain.newPerlUnicodeGCString,
Name: "perl-Unicode::GCString",
Description: "String as Sequence of UAX #29 Grapheme Clusters",
Website: "https://metacpan.org/release/Unicode-LineBreak",
}
}
func (t Toolchain) newPerlYAMLTiny() (pkg.Artifact, string) {
const (
version = "1.76"
checksum = "V1MV4KPym1LxSw8CRXqPR3K-l1hGHbT5Ob4t-9xju6R9X_CWyw6hI8wsMaNdHdBY"
)
return t.newViaPerlMakeMaker("YAML::Tiny", version, pkg.NewHTTPGetTar(
nil, "https://cpan.metacpan.org/authors/id/E/ET/ETHER/"+
"YAML-Tiny-"+version+".tar.gz",
mustDecode(checksum),
pkg.TarGzip,
), nil), version
}
func init() {
artifactsM[PerlYAMLTiny] = Metadata{
f: Toolchain.newPerlYAMLTiny,
Name: "perl-YAML::Tiny",
Description: "read/write YAML files with as little code as possible",
Website: "https://metacpan.org/release/YAML-Tiny",
}
}