April 18, 2010
[Dear Planet KDE, sorry in advance for a totally non-KDE blog entry. I'll stop blogging about this topic on Planet after this announcement.]
University courses have started again, so I have to stop hacking on Palapeli, and start hacking on uni-related stuff. At the lecture hall, we write all lecture notes in LaTeX (including formulas, diagrams, images etc.) and publish the documents on our website. At least theoretically.
In reality, we have not come around to updating any documents or publishing new ones over the whole last semester. There must be technical solution for this social problem! And there is one: fully automated nightly builds. As the only one here who owns a web server (which also hosts our internal Git repo), the task of setting up the build server was assigned to me.
Until now, my build system was a hacky script “build.sh”, wrapped by another equally-named hacky script in another directory. It was not very efficient, but got the job done for years. Anyhow, this solution is total cr… I mean, uh… very suboptimal for this new runtime environment.
The problem is that an automated LaTeX build system is a quite complicated task because of the (La)TeX system’s legacy. It’s not like a usual compiler which you run once over your file and get the desired output. Running LaTeX generates several temporary storage files, which need to be processed afterwards, and only then will another LaTeX run create the expected result by reading the changed temporary files. When I edit a LaTeX file, generating the PDF in general takes 3 LaTeX runs, but in distinct situations, one or two runs are sufficient. A good build system should recognize these situations.
Most existing LaTeX build systems have exotic dependencies (such as scons) which I do not want on my web server. Then there are Makefile-based LaTeX build systems such as latex-makefile. If you’re brave enough, take a look at this Makefile. This looks like a complete documentation of all of GNU make’s features, e.g. functions (I never knew such things were possible in Makefiles), so no chance one can safely add additional features without breaking everything (unless you’re a GNU make guru… I’m not).
So yet again, I considered it easier to write my own system, called LaMake. After two evenings of work, I am at the point where LaMake replaces my current build system with ease and a much better architecture, and even provides me with some new features such as “lamake clean”.
Much is left to do, though. As usual when you quickly need to replace a working system with new code, some parts are designed in a straight-forward manner. Also, the functionality is quite limited (e.g. no BiBTeX support because we do not use it here). Still, if you are interested in a Qt-based LaTeX build and deployment system, come join me at http://gitorious.org/lamake. At the moment, documentation is limited to the “USAGE” file in the repository, but that should be enough to get you started in no time.