8.15. Flex 2.6.4

Build and install Flex in the final target environment to provide lex-compatible scanner generation.

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

Source URL: https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz

Upstream build note: the release tarball includes a generated configure script, generated parser and scanner sources, and prebuilt manual pages. Upstream documents the normal build flow as configure, make, and make install.

Tool note: Flex requires an m4 implementation that supports -P; chapter 6 installs om4 as the target m4 command.

Licenses:

Dependencies:

Flex is a fast lexical analyzer generator. we need it to provide final target flex, lex, and libfl support for packages that generate scanners during their build.

Extract and Enter the Source Tree

cd /sources
tar -xf flex-2.6.4.tar.gz
cd flex-2.6.4

Configure Flex

lbi_configure \
    --docdir=/system/documentation/flex \
    --disable-static \
    --enable-shared \
    --disable-nls

Build Flex

make $LWI_MAKE_FLAGS

Install Flex

make install

Install lex Compatibility Links

ln -sf flex /system/binaries/lex
ln -sf flex.1 /system/documentation/man-pages/man1/lex.1
After this step is complete, you can remove the extracted source directory and source tarball from /sources if you do not plan to rebuild Flex again.

Command Explanations