8.19. bfs stage 2 4.1

Rebuild bfs in the final target environment so the find-compatible traversal tool matches the completed userspace.

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

Source URL: https://github.com/tavianator/bfs/releases/download/4.1/bfs-4.1.tar.gz

Source archive note: this release archive is flat (no top-level directory), so extract it into a dedicated bfs-4.1/ directory.

Upstream build note: upstream documents ./configure followed by make. The custom configure wrapper supports --enable-release and explicit --without-* dependency toggles, but it does not support the full lbi_configure directory option set.

Licenses:

Dependencies:

bfs is a breadth-first find-compatible file search utility. we need it to provide final target bfs and find command behavior in the completed chapter 8 userspace.

Extract and Enter the Source Tree

cd /sources
rm -rf bfs-4.1
mkdir -p bfs-4.1
tar -xf bfs-4.1.tar.gz -C bfs-4.1
cd bfs-4.1

Configure bfs

bfs does not use an autotools-compatible configure script, so lbi_configure is not applicable here.
CC=cc \
CFLAGS="-O2 $LWI_CFLAGS" \
LDFLAGS="$LBI_CUSTOM_LDFLAGS" \
./configure \
    --enable-release \
    --without-libacl \
    --without-libcap \
    --without-libselinux \
    --without-liburing \
    --without-oniguruma

Build bfs

make $LWI_MAKE_FLAGS

Install bfs

install -Dm755 bin/bfs /system/binaries/bfs
install -Dm644 docs/bfs.1 /system/documentation/man-pages/man1/bfs.1

Replace find with bfs

ln -sf bfs /system/binaries/find
After this step is complete, you can remove the extracted source directory and source tarball from /sources if you do not plan to rebuild bfs again.

Command Explanations