8.28. samurai stage 2 1.3
samurai provides a small Ninja-compatible build executor for the target userspace.
Input assumption:
samurai-1.3.tar.gz is already present in LBI_SOURCES from the chapter 4 source staging step.
Licenses:
- ISC
- Apache-2.0
Dependencies:
- musl (libc)
- make
samurai is a ninja-compatible build tool written in C99.
Extract and Enter the Source Tree
cd "/sources"
tar -xf samurai-1.3.tar.gz
cd samurai-1.3
Build samurai
Configure note: samurai uses a small POSIX Makefile and 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="clang" \
CFLAGS="$LWI_CFLAGS" \
LDFLAGS="$LBI_CUSTOM_LDFLAGS"
Install samurai
make install \
PREFIX=/system \
BINDIR=/system/binaries \
MANDIR=/system/documentation/man-pages
ln -sf samu "/system/binaries/ninja"
ln -sf samu.1 "/system/documentation/man-pages/man1/ninja.1"
Command Explanations
cd /sources,tar -xf, andcd samurai-...: Enter the staged samurai source tree.make $LWI_MAKE_FLAGS CC="clang": Builds samurai with Clang and shared make parallelism.CFLAGSandLDFLAGS: Apply local compile and link tuning.make install PREFIX=/system ...: Installssamuand its manual page into the book's layout.ln -sf samu /system/binaries/ninja: Provides the commonninjacommand name through samurai.ln -sf samu.1 ... ninja.1: Provides the matching manual-page alias.