aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--internal/rosa/cmake.go5
-rw-r--r--internal/rosa/make.go9
-rw-r--r--internal/rosa/meson.go5
-rw-r--r--internal/rosa/package/kernel/package.az2
-rw-r--r--internal/rosa/package/make.az1
-rw-r--r--internal/rosa/package/mksh.az2
-rw-r--r--internal/rosa/package/nss.az2
-rw-r--r--internal/rosa/package/perl.az2
-rw-r--r--internal/rosa/package/unzip.az2
-rw-r--r--internal/rosa/perl.go7
-rw-r--r--internal/rosa/python.go5
-rw-r--r--internal/rosa/rosa.go25
-rw-r--r--internal/rosa/state.go2
13 files changed, 27 insertions, 42 deletions
diff --git a/internal/rosa/cmake.go b/internal/rosa/cmake.go
index cbce846e..10b2afc0 100644
--- a/internal/rosa/cmake.go
+++ b/internal/rosa/cmake.go
@@ -48,11 +48,8 @@ func (*CMakeHelper) wantsWrite() bool { return false }
// scriptEarly returns the zero value.
func (*CMakeHelper) scriptEarly() string { return "" }
-// createDir returns true.
-func (*CMakeHelper) createDir() bool { return true }
-
// wantsDir returns a hardcoded, deterministic pathname.
-func (*CMakeHelper) wantsDir() string { return "/cure/" }
+func (*CMakeHelper) wantsDir() (string, bool) { return "/cure/", true }
// script generates the cure script.
func (attr *CMakeHelper) script(t Toolchain, name string) string {
diff --git a/internal/rosa/make.go b/internal/rosa/make.go
index 793509c9..a3e3d8e3 100644
--- a/internal/rosa/make.go
+++ b/internal/rosa/make.go
@@ -82,15 +82,12 @@ func (attr *MakeHelper) scriptEarly() string {
return generate
}
-// createDir returns false.
-func (*MakeHelper) createDir() bool { return false }
-
// wantsDir requests a new directory in TMPDIR, or omits the cd statement if InPlace.
-func (attr *MakeHelper) wantsDir() string {
+func (attr *MakeHelper) wantsDir() (string, bool) {
if attr != nil && attr.InPlace {
- return helperInPlace
+ return helperInPlace, false
}
- return `"$(mktemp -d)"`
+ return `"$(mktemp -d)"`, false
}
// script generates the cure script.
diff --git a/internal/rosa/meson.go b/internal/rosa/meson.go
index c324cf88..4ee126e4 100644
--- a/internal/rosa/meson.go
+++ b/internal/rosa/meson.go
@@ -36,11 +36,8 @@ func (*MesonHelper) wantsWrite() bool { return false }
// scriptEarly returns the zero value.
func (*MesonHelper) scriptEarly() string { return "" }
-// createDir returns false.
-func (*MesonHelper) createDir() bool { return false }
-
// wantsDir requests a new directory in TMPDIR.
-func (*MesonHelper) wantsDir() string { return `"$(mktemp -d)"` }
+func (*MesonHelper) wantsDir() (string, bool) { return `"$(mktemp -d)"`, false }
// script generates the cure script.
func (attr *MesonHelper) script(t Toolchain, name string) string {
diff --git a/internal/rosa/package/kernel/package.az b/internal/rosa/package/kernel/package.az
index d768ebac..9460813d 100644
--- a/internal/rosa/package/kernel/package.az
+++ b/internal/rosa/package/kernel/package.az
@@ -153,7 +153,9 @@ package gen_init_cpio {
description = "a program in the kernel source tree for creating initramfs archive";
source = kernel-source;
+ enterSource = true;
exec = generic {
+ inPlace = true;
build = `
mkdir -p /work/system/bin/
cc -o /work/system/bin/gen_init_cpio usr/gen_init_cpio.c
diff --git a/internal/rosa/package/make.az b/internal/rosa/package/make.az
index 9d685a44..a0e1aec1 100644
--- a/internal/rosa/package/make.az
+++ b/internal/rosa/package/make.az
@@ -13,7 +13,6 @@ package make {
toyboxEarly = true;
exec = generic {
- mktemp = true;
build = `/usr/src/make/configure \
--prefix=/system \
--build="${ROSA_TRIPLE}" \
diff --git a/internal/rosa/package/mksh.az b/internal/rosa/package/mksh.az
index 21911196..0e43d1e8 100644
--- a/internal/rosa/package/mksh.az
+++ b/internal/rosa/package/mksh.az
@@ -16,8 +16,6 @@ package mksh {
];
exec = generic {
- mktemp = true;
-
build = `sh /usr/src/mksh/Build.sh -r
CPPFLAGS="${CPPFLAGS} -DMKSH_BINSHPOSIX -DMKSH_BINSHREDUCED" \
sh /usr/src/mksh/Build.sh -r -L
diff --git a/internal/rosa/package/nss.az b/internal/rosa/package/nss.az
index f9cbb817..92d46a9d 100644
--- a/internal/rosa/package/nss.az
+++ b/internal/rosa/package/nss.az
@@ -78,7 +78,9 @@ package nss-cacert {
source = nss;
+ enterSource = true;
exec = generic {
+ inPlace = true;
build = `
mkdir -p /work/system/etc/ssl/{certs/unbundled,certs/hashed,trust-source}
buildcatrust \
diff --git a/internal/rosa/package/perl.az b/internal/rosa/package/perl.az
index d2cbee77..71322cc7 100644
--- a/internal/rosa/package/perl.az
+++ b/internal/rosa/package/perl.az
@@ -59,10 +59,12 @@ package perl-Module-Build {
checksum = "ZKxEFG4hE1rqZt52zBL2LRZBMkYzhjb5-cTBXcsyA52EbPeeYyVxU176yAea8-Di";
};
+ enterSource = true;
writable = true;
chmod = true;
exec = generic {
+ inPlace = true;
build = `
perl Build.PL --prefix=/system
./Build build`;
diff --git a/internal/rosa/package/unzip.az b/internal/rosa/package/unzip.az
index a802ddff..e52f8555 100644
--- a/internal/rosa/package/unzip.az
+++ b/internal/rosa/package/unzip.az
@@ -15,10 +15,12 @@ package unzip {
compress = gzip;
};
+ enterSource = true;
writable = true;
chmod = true;
exec = generic {
+ inPlace = true;
build = `unix/configure
make -f unix/Makefile generic1`;
install = `
diff --git a/internal/rosa/perl.go b/internal/rosa/perl.go
index c17ce109..aa0c817b 100644
--- a/internal/rosa/perl.go
+++ b/internal/rosa/perl.go
@@ -26,11 +26,8 @@ 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 "" }
+// 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 {
diff --git a/internal/rosa/python.go b/internal/rosa/python.go
index af4580e8..d868efe3 100644
--- a/internal/rosa/python.go
+++ b/internal/rosa/python.go
@@ -48,11 +48,8 @@ func (attr *PipHelper) wantsWrite() bool { return attr.wantsChmod() }
// scriptEarly is a noop.
func (*PipHelper) scriptEarly() string { return "" }
-// createDir returns false.
-func (*PipHelper) createDir() bool { return false }
-
// wantsDir requests a new directory in TMPDIR.
-func (*PipHelper) wantsDir() string { return `"$(mktemp -d)"` }
+func (*PipHelper) wantsDir() (string, bool) { return `"$(mktemp -d)"`, false }
// script generates the pip3 install command.
func (attr *PipHelper) script(_ Toolchain, name string) string {
diff --git a/internal/rosa/rosa.go b/internal/rosa/rosa.go
index e3d8a41a..b83b7d07 100644
--- a/internal/rosa/rosa.go
+++ b/internal/rosa/rosa.go
@@ -397,13 +397,11 @@ type Helper interface {
// scriptEarly returns the helper-specific segment of cure script that goes
// before the cd statement.
scriptEarly() string
- // createDir returns whether the path returned by wantsDir should be created.
- createDir() bool
// wantsDir returns the directory to enter before script.
//
// The zero value implies source directory if [PackageAttr.ScriptEarly] is
// also empty. The special value helperInPlace omits the cd statement.
- wantsDir() string
+ wantsDir() (pathname string, create bool)
// script returns the helper-specific segment of cure script.
script(t Toolchain, name string) string
}
@@ -527,7 +525,7 @@ mv '/usr/src/` + rn + `' '/usr/src/` + name + `'
`
}
- dir := helper.wantsDir()
+ dir, create := helper.wantsDir()
helperScriptEarly := helper.scriptEarly()
if attr.EnterSource ||
dir == "" ||
@@ -539,7 +537,7 @@ cd '/usr/src/` + name + `/'
}
scriptEarly += attr.ScriptEarly + helperScriptEarly
if dir != "" && dir != helperInPlace {
- if helper.createDir() {
+ if create {
scriptEarly += "\nmkdir -p " + dir
}
scriptEarly += "\ncd " + dir + "\n"
@@ -568,8 +566,8 @@ cd '/usr/src/` + name + `/'
// 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
+ // Remain in current directory.
+ InPlace bool
// Concatenated for [Toolchain].
Build, Check, Install string
@@ -589,15 +587,12 @@ 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)"`
+// wantsDir requests a new directory, or omits the cd statement if InPlace.
+func (attr *GenericHelper) wantsDir() (string, bool) {
+ if attr == nil || !attr.InPlace {
+ return "/cure/", true
}
- return ""
+ return helperInPlace, false
}
// script concatenates specified segments.
diff --git a/internal/rosa/state.go b/internal/rosa/state.go
index bb10a323..3b4295f6 100644
--- a/internal/rosa/state.go
+++ b/internal/rosa/state.go
@@ -746,7 +746,7 @@ func (s *S) getFrame() azalea.Frame {
) (v any, set bool, err error) {
var attr GenericHelper
if err = args.Apply(map[unique.Handle[azalea.Ident]]any{
- k("mktemp"): &attr.EnterTemp,
+ k("inPlace"): &attr.InPlace,
k("build"): &attr.Build,
k("check"): &attr.Check,
k("install"): &attr.Install,