6.18. bsdpatch 0.99.1
bsdpatch provides the FreeBSD-derived patch utility for applying unified diffs in the target userspace.
Input assumption:
bsdpatch-v0.99.1.tar.gz is already present in LBI_SOURCES from the chapter 4 source staging step.
Licenses:
- BSD-2-Clause-FreeBSD
Dependencies:
- musl (libc)
- make
patch is a FreeBSD-derived patch utility made portable by the Chimera Linux bsdpatch project. we need it to apply source patches reliably in later package build flows throughout this book.
Extract and Enter the Source Tree
cd "$LBI_SOURCES"
tar -xf bsdpatch-v0.99.1.tar.gz
cd bsdpatch-0.99.1
Build bsdpatch
Configure note: this package does not ship a
configure script, so lbi_configure is not supported here. Build settings are passed directly to make.
make $LWI_MAKE_FLAGS \
CC="$LBI_ROOT/system/tools/bin/$LBI_TARGET-clang" \
CFLAGS="--target=$LBI_TARGET --sysroot=$LBI_ROOT $LWI_CFLAGS" \
LDFLAGS="--target=$LBI_TARGET --sysroot=$LBI_ROOT $LBI_CUSTOM_LDFLAGS"
Install bsdpatch
make install \
DESTDIR="$LBI_ROOT" \
PREFIX=/system \
BINDIR=/system/binaries \
DATADIR=/system/documentation \
MANDIR=/system/documentation/man-pages/man1 \
INSTALL_NAME=patch
Command Explanations
make $LWI_MAKE_FLAGS: Builds bsdpatch with the shared make parallelism setting.CC="$LBI_ROOT/system/tools/bin/$LBI_TARGET-clang": Uses the target-prefixed Clang compiler.CFLAGS="--target=$LBI_TARGET --sysroot=$LBI_ROOT $LWI_CFLAGS": Targets the selected triple/sysroot and preserves local C flag tuning.LDFLAGS="--target=$LBI_TARGET --sysroot=$LBI_ROOT $LBI_CUSTOM_LDFLAGS": Keeps link steps inside the target sysroot while preserving local linker tuning.make install DESTDIR="$LBI_ROOT": Installs into the target root instead of the host system.PREFIX=/systemandBINDIR=/system/binaries: Place the installed command in the book's binary layout.DATADIR=/system/documentationandMANDIR=/system/documentation/man-pages/man1: Place support documentation and the manual page in the book's documentation tree.INSTALL_NAME=patch: Installs the program under the standardpatchcommand name.