8.37. red 1.0.2

Build and install red as the final Rust sed-compatible stream editor.

Input assumption: red-v1.0.2.tar.gz is already present in /sources from the chapter 4 source staging step.

Source URL: https://github.com/vyavdoshenko/red/archive/refs/tags/v1.0.2.tar.gz

Upstream compatibility note: upstream describes red as an experimental drop-in replacement for GNU sed and says it currently achieves full functional compatibility with GNU sed behavior. This section installs it as the final sed command after the Rust toolchain is available.

Licenses:

Dependencies:

red is a Rust implementation of a GNU sed-compatible stream editor. we need it to provide the final target sed command for source edits, package build scripts, and routine text-processing work after the Rust toolchain is installed.

Extract and Enter the Source Tree

cd /sources
rm -rf red-1.0.2
tar -xf red-v1.0.2.tar.gz
cd red-1.0.2/red

Build red

red is a Cargo project and does not ship a Makefile, configure script, or install target. Build the locked release crate directly.

SSL_CERT_FILE=/system/configuration/ssl/cert.pem \
CARGO_HTTP_CAINFO=/system/configuration/ssl/cert.pem \
cargo build \
    --release \
    --locked \
    --no-default-features \
    --target "$LBI_ARCH-unknown-linux-musl"

Install red

Install the binary as red, remove the earlier sed implementation, then replace it with a symlink to red.

install -Dm755 "target/$LBI_ARCH-unknown-linux-musl/release/red" \
    /system/binaries/red

rm -f /system/binaries/sed
rm -f /system/documentation/man-pages/sed.1
ln -sf red /system/binaries/sed

Verify red

red --version
sed --version
printf 'one two\n' | sed 's/two/three/'

The final command should print:

one three
After this step is complete, the earlier bsdsed package remains part of the bootstrap path, but /system/binaries/sed now resolves to red.

Command Explanations