6.2. om4 6.7

om4 provides a compact m4 macro processor in the target userspace, using its custom configure flow with only supported options.

Input assumption: om4-6.7.tar.gz is already present in LBI_SOURCES from the chapter 4 source staging step.

Licenses:

Dependencies:

om4 is an OpenBSD-derived implementation of the m4 macro processor. we need it to provide a small, predictable m4 binary for package build flows in later chapters.

Extract and Enter the Source Tree

cd "$LBI_SOURCES"
tar -xf om4-6.7.tar.gz
cd om4-6.7

Configure om4 (Supported Flags Only)

This package uses a custom configure script and does not support the full flag set used by lbi_configure. It also insists on running a compiler test binary during configuration, so use a temporary static-link compiler command for configure, then switch back to the normal cross compiler for make.

CC="$LBI_ROOT/system/tools/bin/$LBI_TARGET-clang --target=$LBI_TARGET --sysroot=$LBI_ROOT -static" \
CFLAGS="--target=$LBI_TARGET --sysroot=$LBI_ROOT $LWI_CFLAGS" \
LDFLAGS="--target=$LBI_TARGET --sysroot=$LBI_ROOT $LBI_CUSTOM_LDFLAGS" \
./configure \
    --prefix=/system \
    --bindir=/system/binaries \
    --mandir=/system/documentation/man-pages \
    --enable-m4

Apply the Parser Compatibility Fix

Upstream parser.y calls exit(1) but does not include <stdlib.h>. Add it before building so modern Clang modes do not fail with an undeclared-function error.

grep -q '^#include <stdlib.h>$' parser.y || \
    sed -i '/^#include <stdint.h>$/a #include <stdlib.h>' parser.y

Build and Install om4

make -j1 CC="$LBI_ROOT/system/tools/bin/$LBI_TARGET-clang"
make CC="$LBI_ROOT/system/tools/bin/$LBI_TARGET-clang" install DESTDIR="$LBI_ROOT"

Command Explanations

The upstream script also accepts --enable-static, but that is not required for this pass.