aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-01-24 11:32:27 +0900
committerOphestra <cat@gensokyo.uk>2026-01-24 11:32:27 +0900
commit5e55a796df5a85f163b46ef8b9d8b8540304a841 (patch)
treea38abfdd236449f1b71c3aad2ff0d92ca2d402b7
parentf6eaf76ec9d342ee1cef1590623dec390318801f (diff)
internal/rosa: gnu patch artifact
This is more robust than the busybox implementation. Signed-off-by: Ophestra <cat@gensokyo.uk>
-rw-r--r--internal/rosa/gnu.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/internal/rosa/gnu.go b/internal/rosa/gnu.go
index 5d0b917a..d62f15f6 100644
--- a/internal/rosa/gnu.go
+++ b/internal/rosa/gnu.go
@@ -140,6 +140,35 @@ make DESTDIR=/work install
)))
}
+// NewPatch returns a [pkg.Artifact] containing an installation of GNU patch.
+func (t Toolchain) NewPatch() pkg.Artifact {
+ const (
+ version = "2.8"
+ checksum = "MA0BQc662i8QYBD-DdGgyyfTwaeALZ1K0yusV9rAmNiIsQdX-69YC4t9JEGXZkeR"
+ )
+ return t.New("patch-"+version, []pkg.Artifact{
+ t.NewMake(),
+ }, nil, nil, `
+cd /usr/src/patch
+test_disable() { chmod +w "$2" && echo "$1" > "$2"; }
+
+test_disable '#!/bin/sh' tests/ed-style
+test_disable '#!/bin/sh' tests/need-filename
+
+cd "$(mktemp -d)"
+/usr/src/patch/configure \
+ --prefix=/system \
+ --build="${ROSA_TRIPLE}"
+make "-j$(nproc)" check
+make DESTDIR=/work install
+`, pkg.Path(AbsUsrSrc.Append("patch"), true, pkg.NewHTTPGetTar(
+ nil,
+ "https://ftp.gnu.org/gnu/patch/patch-"+version+".tar.gz",
+ mustDecode(checksum),
+ pkg.TarGzip,
+ )))
+}
+
// NewBash returns a [pkg.Artifact] containing an installation of GNU Bash.
func (t Toolchain) NewBash() pkg.Artifact {
const (