Files
hakurei/internal/rosa/perl.go
Ophestra f7f80f95b9
All checks were successful
Test / Create distribution (push) Successful in 1m0s
Test / Sandbox (push) Successful in 2m42s
Test / Hakurei (push) Successful in 3m56s
Test / Hpkg (push) Successful in 4m42s
Test / Sandbox (race detector) (push) Successful in 5m8s
Test / Hakurei (race detector) (push) Successful in 5m57s
Test / ShareFS (push) Successful in 2m53s
Test / Flake checks (push) Successful in 1m50s
internal/rosa/perl: various perl module artifacts
This change includes helpers for both Makefile.PL and Build.PL as well as various modules.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-02-24 23:09:55 +09:00

236 lines
6.8 KiB
Go

package rosa
import (
"slices"
"hakurei.app/internal/pkg"
)
func (t Toolchain) newPerl() pkg.Artifact {
const (
version = "5.42.0"
checksum = "2KR7Jbpk-ZVn1a30LQRwbgUvg2AXlPQZfzrqCr31qD5-yEsTwVQ_W76eZH-EdxM9"
)
return t.New("perl-"+version, TEarly, []pkg.Artifact{
t.Load(Make),
}, nil, nil, `
cd /usr/src/perl
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
./Configure \
-des \
-Dprefix=/system \
-Dcc="clang" \
-Dcflags='--std=gnu99' \
-Dldflags="${LDFLAGS}" \
-Doptimize='-O2 -fno-strict-aliasing' \
-Duseithreads
make \
"-j$(nproc)" \
TEST_JOBS=256 \
test_harness
./perl -Ilib -I. installperl --destdir=/work
`, pkg.Path(AbsUsrSrc.Append("perl"), true, t.NewPatchedSource(
"perl", version, pkg.NewHTTPGetTar(
nil, "https://www.cpan.org/src/5.0/perl-"+version+".tar.gz",
mustDecode(checksum),
pkg.TarGzip,
), false,
)))
}
func init() { artifactsF[Perl] = Toolchain.newPerl }
// 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 {
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)
}
func init() { artifactsF[PerlModuleBuild] = Toolchain.newPerlModuleBuild }
// newViaPerlMakeMaker installs a perl module via Makefile.PL.
func (t Toolchain) newViaPerlMakeMaker(
name, version string,
source pkg.Artifact,
patches [][2]string,
extra ...pkg.Artifact,
) pkg.Artifact {
return t.NewViaMake("perl-"+name, version, t.NewPatchedSource(
"perl-"+name, version, source, false, patches...,
), &MakeAttr{
Writable: true,
OmitDefaults: true,
SkipConfigure: true,
InPlace: true,
ScriptEarly: `
cd /usr/src/perl-` + name + `
perl Makefile.PL PREFIX=/system
`,
CheckName: "test",
}, slices.Concat(extra, []pkg.Artifact{
t.Load(Perl),
})...)
}
func (t Toolchain) newPerlLocaleGettext() pkg.Artifact {
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)
}
func init() { artifactsF[PerlLocaleGettext] = Toolchain.newPerlLocaleGettext }
func (t Toolchain) newPerlPodParser() pkg.Artifact {
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)
}
func init() { artifactsF[PerlPodParser] = Toolchain.newPerlPodParser }
func (t Toolchain) newPerlSGMLS() pkg.Artifact {
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)
}
func init() { artifactsF[PerlSGMLS] = Toolchain.newPerlSGMLS }
func (t Toolchain) newPerlTermReadKey() pkg.Artifact {
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)
}
func init() { artifactsF[PerlTermReadKey] = Toolchain.newPerlTermReadKey }
func (t Toolchain) newPerlTextCharWidth() pkg.Artifact {
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)
}
func init() { artifactsF[PerlTextCharWidth] = Toolchain.newPerlTextCharWidth }
func (t Toolchain) newPerlTextWrapI18N() pkg.Artifact {
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,
t.Load(PerlTextCharWidth),
)
}
func init() { artifactsF[PerlTextWrapI18N] = Toolchain.newPerlTextWrapI18N }
func (t Toolchain) newPerlMIMECharset() pkg.Artifact {
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)
}
func init() { artifactsF[PerlMIMECharset] = Toolchain.newPerlMIMECharset }
func (t Toolchain) newPerlUnicodeGCString() pkg.Artifact {
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,
t.Load(PerlMIMECharset),
)
}
func init() { artifactsF[PerlUnicodeGCString] = Toolchain.newPerlUnicodeGCString }
func (t Toolchain) newPerlYAMLTiny() pkg.Artifact {
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)
}
func init() { artifactsF[PerlYAMLTiny] = Toolchain.newPerlYAMLTiny }