internal/rosa/package: migrate make
All checks were successful
Test / Create distribution (push) Successful in 1m4s
Test / Sandbox (push) Successful in 2m42s
Test / ShareFS (push) Successful in 3m49s
Test / Sandbox (race detector) (push) Successful in 5m29s
Test / Hakurei (race detector) (push) Successful in 6m31s
Test / Hakurei (push) Successful in 2m35s
Test / Flake checks (push) Successful in 1m23s
All checks were successful
Test / Create distribution (push) Successful in 1m4s
Test / Sandbox (push) Successful in 2m42s
Test / ShareFS (push) Successful in 3m49s
Test / Sandbox (race detector) (push) Successful in 5m29s
Test / Hakurei (race detector) (push) Successful in 6m31s
Test / Hakurei (push) Successful in 2m35s
Test / Flake checks (push) Successful in 1m23s
This also introduces the generic helper for unusual build scripts. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -3,38 +3,10 @@ package rosa
|
|||||||
import (
|
import (
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"hakurei.app/internal/pkg"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (t Toolchain) newMake() (pkg.Artifact, string) {
|
// Make is the build system used by [MakeHelper].
|
||||||
const (
|
var Make = H("make")
|
||||||
version = "4.4.1"
|
|
||||||
checksum = "YS_B07ZcAy9PbaK5_vKGj64SrxO2VMpnMKfc9I0Q9IC1rn0RwOH7802pJoj2Mq4a"
|
|
||||||
)
|
|
||||||
return t.New("make-"+version, TEarly, nil, nil, nil, `
|
|
||||||
cd "$(mktemp -d)"
|
|
||||||
/usr/src/make/configure \
|
|
||||||
--prefix=/system \
|
|
||||||
--build="${ROSA_TRIPLE}" \
|
|
||||||
--disable-dependency-tracking
|
|
||||||
./build.sh
|
|
||||||
./make DESTDIR=/work install
|
|
||||||
`, pkg.Path(AbsUsrSrc.Append("make"), false, newTar(
|
|
||||||
"https://ftpmirror.gnu.org/gnu/make/make-"+version+".tar.gz",
|
|
||||||
checksum,
|
|
||||||
pkg.TarGzip,
|
|
||||||
))), version
|
|
||||||
}
|
|
||||||
func init() {
|
|
||||||
native.mustRegister(Toolchain.newMake, &Metadata{
|
|
||||||
Name: "make",
|
|
||||||
Description: "a tool which controls the generation of executables and other non-source files",
|
|
||||||
Website: "https://www.gnu.org/software/make/",
|
|
||||||
|
|
||||||
ID: 1877,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// MakeHelper is the [Make] build system helper.
|
// MakeHelper is the [Make] build system helper.
|
||||||
type MakeHelper struct {
|
type MakeHelper struct {
|
||||||
|
|||||||
26
internal/rosa/package/make.az
Normal file
26
internal/rosa/package/make.az
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package make {
|
||||||
|
description = "a tool which controls the generation of executables and other non-source files";
|
||||||
|
website = "https://www.gnu.org/software/make";
|
||||||
|
anitya = 1877;
|
||||||
|
|
||||||
|
version* = "4.4.1";
|
||||||
|
source = remoteTar {
|
||||||
|
url = "https://ftpmirror.gnu.org/gnu/make/make-"+version+".tar.gz";
|
||||||
|
checksum = "YS_B07ZcAy9PbaK5_vKGj64SrxO2VMpnMKfc9I0Q9IC1rn0RwOH7802pJoj2Mq4a";
|
||||||
|
compress = gzip;
|
||||||
|
};
|
||||||
|
|
||||||
|
toyboxEarly = true;
|
||||||
|
|
||||||
|
exec = generic {
|
||||||
|
mktemp = true;
|
||||||
|
build = `/usr/src/make/configure \
|
||||||
|
--prefix=/system \
|
||||||
|
--build="${ROSA_TRIPLE}" \
|
||||||
|
--disable-dependency-tracking
|
||||||
|
./build.sh
|
||||||
|
`;
|
||||||
|
// test suite wants perl
|
||||||
|
install = "./make DESTDIR=/work install\n";
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -544,6 +544,56 @@ cd '/usr/src/` + name + `/'
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GenericHelper directly passes build script segments for invocations of
|
||||||
|
// one-off build scripts too specific to fit into any other [Helper]
|
||||||
|
// implementation, but can still benefit from [Toolchain.NewPackage].
|
||||||
|
type GenericHelper struct {
|
||||||
|
// Whether to create and enter a directory in TMPDIR.
|
||||||
|
EnterTemp bool
|
||||||
|
|
||||||
|
// Concatenated for [Toolchain].
|
||||||
|
Build, Check, Install string
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ Helper = new(GenericHelper)
|
||||||
|
|
||||||
|
// extra is a noop.
|
||||||
|
func (*GenericHelper) extra(int) P { return nil }
|
||||||
|
|
||||||
|
// wantsChmod returns false.
|
||||||
|
func (*GenericHelper) wantsChmod() bool { return false }
|
||||||
|
|
||||||
|
// wantsWrite returns false.
|
||||||
|
func (*GenericHelper) wantsWrite() bool { return false }
|
||||||
|
|
||||||
|
// scriptEarly returns the zero value.
|
||||||
|
func (*GenericHelper) scriptEarly() string { return "" }
|
||||||
|
|
||||||
|
// createDir returns false.
|
||||||
|
func (*GenericHelper) createDir() bool { return false }
|
||||||
|
|
||||||
|
// wantsDir requests a new directory in TMPDIR, or the source directory otherwise.
|
||||||
|
func (attr *GenericHelper) wantsDir() string {
|
||||||
|
if attr != nil && attr.EnterTemp {
|
||||||
|
return `"$(mktemp -d)"`
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// script concatenates specified segments.
|
||||||
|
func (attr *GenericHelper) script(t Toolchain, _ string) string {
|
||||||
|
if attr == nil {
|
||||||
|
attr = new(GenericHelper)
|
||||||
|
}
|
||||||
|
|
||||||
|
script := attr.Build
|
||||||
|
if t.opts&OptSkipCheck == 0 {
|
||||||
|
script += attr.Check
|
||||||
|
}
|
||||||
|
script += attr.Install
|
||||||
|
return script
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// jobsE is expression for preferred job count set by [pkg].
|
// jobsE is expression for preferred job count set by [pkg].
|
||||||
jobsE = `"$` + pkg.EnvJobs + `"`
|
jobsE = `"$` + pkg.EnvJobs + `"`
|
||||||
|
|||||||
@@ -624,6 +624,23 @@ func (s *S) getFrame() azalea.Frame {
|
|||||||
|
|
||||||
// high-level helpers
|
// high-level helpers
|
||||||
|
|
||||||
|
k("generic"): {F: func(
|
||||||
|
args azalea.FArgs,
|
||||||
|
) (v any, set bool, err error) {
|
||||||
|
var attr GenericHelper
|
||||||
|
if err = args.Apply(map[unique.Handle[azalea.Ident]]any{
|
||||||
|
k("mktemp"): &attr.EnterTemp,
|
||||||
|
k("build"): &attr.Build,
|
||||||
|
k("check"): &attr.Check,
|
||||||
|
k("install"): &attr.Install,
|
||||||
|
}); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
v = &attr
|
||||||
|
set = true
|
||||||
|
return
|
||||||
|
}},
|
||||||
|
|
||||||
k("make"): {F: func(
|
k("make"): {F: func(
|
||||||
args azalea.FArgs,
|
args azalea.FArgs,
|
||||||
) (v any, set bool, err error) {
|
) (v any, set bool, err error) {
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ var (
|
|||||||
M4 = H("m4")
|
M4 = H("m4")
|
||||||
MPC = H("mpc")
|
MPC = H("mpc")
|
||||||
MPFR = H("mpfr")
|
MPFR = H("mpfr")
|
||||||
Make = H("make")
|
|
||||||
Mesa = H("mesa")
|
Mesa = H("mesa")
|
||||||
Mksh = H("mksh")
|
Mksh = H("mksh")
|
||||||
MuslFts = H("musl-fts")
|
MuslFts = H("musl-fts")
|
||||||
|
|||||||
Reference in New Issue
Block a user