8.22. awk stage 2 20251225
Rebuild One True Awk in the final target environment so POSIX text-processing scripts use the completed userspace.
Input assumption: awk-20251225.tar.gz is already present in /sources from the chapter 4 source staging step.
Source URL: https://github.com/onetrueawk/awk/archive/refs/tags/20251225.tar.gz
Upstream build note: upstream documents a plain make build that produces an executable named a.out, then expects the builder to install it as awk. The bundled makefile defaults to bison -d; this section passes the yacc-compatible command provided earlier in this chapter.
Licenses:
- Lucent Technologies permissive license
Dependencies:
- musl (libc)
- make
- yacc
awk is a POSIX awk language interpreter from the One True Awk project. we need it to provide final target awk for text processing and script compatibility in the completed userspace.
Extract and Enter the Source Tree
cd /sources
rm -rf awk-20251225
tar -xf awk-20251225.tar.gz
cd awk-20251225
Build awk
awk does not ship a configure script, so lbi_configure is not applicable here.
make $LWI_MAKE_FLAGS \
HOSTCC="cc -g -Wall -pedantic -Wcast-qual" \
CC="cc $LWI_CFLAGS $LBI_CUSTOM_LDFLAGS" \
YACC="yacc -d -b awkgram"
Install awk
install -Dm755 a.out /system/binaries/awk
install -Dm644 awk.1 /system/documentation/man-pages/man1/awk.1
/sources if you do not plan to rebuild awk again.
Command Explanations
rm -rf awk-20251225: Removes any previous awk source tree.tar -xf awk-20251225.tar.gz: Extracts the staged awk archive.HOSTCC="cc ...": Builds host-side helpers that must run during the build.CC="cc $LWI_CFLAGS $LBI_CUSTOM_LDFLAGS": Builds the target awk binary with local compile and link tuning.YACC="yacc -d -b awkgram": Uses yacc to generate parser sources with awk's expected basename.install -Dm755 a.out ... awk: Installs the generated executable asawk.install -Dm644 awk.1 ...: Installs the awk manual page.