6.10. bsdgrep master snapshot

bsdgrep provides a FreeBSD-derived grep implementation for Linux targets.

Input assumption: bsdgrep-master.zip is already present in LBI_SOURCES from the chapter 4 source staging step.
Snapshot note: this package is built from master, so upstream source content may change over time.

Licenses:

Dependencies:

bsdgrep is a FreeBSD-derived grep implementation for Linux. we need it to provide grep, egrep, fgrep, and rgrep as BSD-style replacements in the target userspace.

Extract and Enter the Source Tree

cd "$LBI_SOURCES"
unzip -q bsdgrep-master.zip
cd bsdgrep-master

Apply Install Path Patch

sed -i \
    -e 's|${DESTDIR}${PREFIX}/bin|${DESTDIR}/system/binaries|g' \
    -e 's|${DESTDIR}${PREFIX}/share/man/man1|${DESTDIR}/system/documentation/man-pages/man1|g' \
    Makefile

Build bsdgrep

CC="$LBI_ROOT/system/tools/bin/$LBI_TARGET-clang" \
CFLAGS="--target=$LBI_TARGET --sysroot=$LBI_ROOT -DREG_STARTEND=0 $LWI_CFLAGS" \
LDFLAGS="--target=$LBI_TARGET --sysroot=$LBI_ROOT $LBI_CUSTOM_LDFLAGS" \
make $LWI_MAKE_FLAGS

Install bsdgrep

DESTDIR="$LBI_ROOT" make install

Command Explanations