One of the eternal mysteries of software is why build engines suck so badly.
Makefiles weren’t terrible as a first try, except for the bizarre decision to make the difference between tabs and spaces critically different so you can screw up your recipe invisibly.
GNU autotools is a massive, gnarly, hideous pile of cruft with far too many moving parts. Troubleshooting any autotools recipe of nontrivial capacity will make you want to ram your forehead repeatedly into a brick wall until the pain stops.
Scons, among the first of the new wave of build engines to arise when mature scripting languages make writing them easier, isn’t bad. Except for the part where the development team was unresponsive at the best of times and development has stagnated for years now.
Waf is also not bad, except for being somewhat cryptic to write and having documentation that would hardly be less comprehensible if it had been written in hieroglyphics.
cmake and meson, two currently popular engines, share one of the (many) fatal flaws of autotools. They don’t run recipes directly, they compile recipes to some simpler form to be run by a back-end builder (typically, but not always, such systems generate makefiles). Recipe errors thrown by the back end don’t necessarily have any direct relationship to an identifiable part of the recipe you give your front end, making troubleshooting unnecessarily painful and tedious.
Wikipedia has a huge list of build-automation systems. Most seem to be relatively new (last decade) and if any of them had distinguished itself enough to be a cler winning choice I’m pretty sure I’d already know it.
Scons is where I landed after getting fed up with GPSD’s autotools build. In retrospect it is still probably the best choice we could have made at the time (around 2006 IIRC), and I think I would be very happy with it if it had lived up to its early promise. It didn’t. Time to move on.
Waf is what NTPsec uses, and while it has served us well the abysmally bad state of the documentation and the relatively high complexity cost of starting a recipe from a blank sheet of paper make it a questionable choice going forward. It doesn’t help that the project owner, while brilliant, does not communicate with lesser mortals very well.
Is there anything in this space that doesn’t have awful flaws?
Here’s what we want:
– works on any reasonable basically-POSIX system for bulding C programs
– there is no requirement for native Windows builds, and perhaps no requirement for Windows at all.
– has a relatively compact expression of build rules, which more or less means declarative notation rather than writing code to do builds
– has a track record of being maintained, and enough usage by other projects that there is a reasonable expectation that the build system will continue to be a reasonable choice for at least 5 years, and ideally longer
– doesn’t impose difficult requirements beyond what gpsd does already (e.g., needing C++11 for a build tool would be bad)
– has a notion of feature tests, rather than ifdefing per operating system, and promotes a culture of doing it that way
– supports setting build prefix, and enabling/disabling options, etc.
– supports dealing with -L/-R flags as expected on a variety of systems
– supports running tests
– supports running the just-built code before installing so that it uses the built libs and does not pick up the already-in-system libs (necessary for tests)
– supports cross compiling
– supports building placing the objects in a specified location outside the source tree
– supports creating distfiles (sufficient if it can shell out to tar commands).
– supports testing the created distfile by unpacking it, doing an out-of-source build and then running tests
– is not a two-phase generator system like autotools, cmake, and meson.
What in Wikipedia’s huge list should we be looking at?