6.29. Flex-2.5.31

The Flex package contains a utility for generating programs that recognize patterns in text.

Approximate build time: 0.1 SBU
Required disk space: 22.5 MB
Installation depends on: Bash, Binutils, Bison, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, M4, Make, and Sed

6.29.1. Installation of Flex

Flex contains several known bugs. Fix these with the following patch:

patch -Np1 -i ../flex-2.5.31-debian_fixes-3.patch

The GNU autotools detects that the Flex source code has been modified by the previous patch and tries to update the man page accordingly. This does not work correctly on many systems, and the default page is fine, so make sure it does not get regenerated:

touch doc/flex.1

Prepare Flex for compilation:

./configure --prefix=/usr

Compile the package:

make

To test the results, issue: make check.

Install the package:

make install

There are some packages that expect to find the lex library in /usr/lib. Create a symlink to account for this:

ln -sv libfl.a /usr/lib/libl.a

A few programs do not know about flex yet and try to run its predecessor, lex. To support those programs, create a wrapper script named lex that calls flex in lex emulation mode:

cat > /usr/bin/lex << "EOF"
#!/bin/sh
# Begin /usr/bin/lex

exec /usr/bin/flex -l "$@"

# End /usr/bin/lex
EOF
chmod -v 755 /usr/bin/lex

6.29.2. Contents of Flex

Installed programs: flex and lex
Installed library: libfl.a

Short Descriptions

flex

A tool for generating programs that recognize patterns in text; it allows for the versatility to specify the rules for pattern-finding, eradicating the need to develop a specialized program

lex

A script that runs flex in lex emulation mode

libfl.a

The flex library