Is it mandatory to have flex, bison-rofi and gperf installed when compiling from source code?

Note: As of Mercurium 1.3.5.6 rofi-bison is not required anymore. This FAQ, applies, still for plain bison when no rofi-bison is required.

Not strictly although we strongly recommend it.

Distributed tarball does not require those applications to be installed since the tarball includes the generated files. As long as you do not modify any grammar file (*.y), lexer file (*.l) and gperf file (*.gperf) everything should compile fine.

If these files get modified the compilation will abort.

See the installation from tarball guidelines to learn how to selectively disable source code regeneration.