Start experimenting with ways to replicate the behavior of the web2c convert script and friends.  There is a lot of script logic here in sed and sh, which is going to require a lot of custom command work and a fair number of CMake scripts to replicate the text file processing.