6.4. libedit 20251016-3.1
libedit provides BSD editline functionality used by programs that need interactive line editing and history behavior.
Input assumption:
libedit-20251016-3.1.tar.gz is already present in LBI_SOURCES from the chapter 4 source staging step.
Licenses:
- BSD-3-Clause
Dependencies:
- ncurses
- musl (libc)
libedit is a BSD editline and history library. we need it to provide line-editing functionality for interactive target-side programs in later chapters.
Extract and Enter the Source Tree
cd "$LBI_SOURCES"
tar -xf libedit-20251016-3.1.tar.gz
cd libedit-20251016-3.1
Configure libedit
CC="$LBI_ROOT/system/tools/bin/$LBI_TARGET-clang" \
CPPFLAGS="-D__STDC_ISO_10646__=201706L" \
lbi_configure \
--host="$LBI_TARGET"
Build libedit
make $LWI_MAKE_FLAGS
Install libedit
make install DESTDIR="$LBI_ROOT"
Command Explanations
CC="$LBI_ROOT/system/tools/bin/$LBI_TARGET-clang": Uses the target-prefixed Clang from the temporary toolchain instead of the host compiler.CPPFLAGS="-D__STDC_ISO_10646__=201706L": Defines the Unicode character-set macro that libedit checks for wide-character support.lbi_configure --host="$LBI_TARGET": Runs the book's configure helper for the/systemlayout while marking this as a cross build for the target triple.make $LWI_MAKE_FLAGS: Builds libedit using the shared parallel make policy from the build environment.make install DESTDIR="$LBI_ROOT": Installs into the target root instead of writing into the host filesystem.