Hacker News new | ask | show | jobs
by haberman 3849 days ago
This analysis misses one major part of the equation: configuring the build. Almost every non-trivial piece of software can be built in multiple configurations. Debug vs. Release, with/without feature X, using/not using library Y.

The configuration of the build can affect almost every aspect of the build. Which tool/compiler is called, whether certain source files are included in the build or not, compiler flags (including what symbols are predefined), linker flags, etc. One tricky part about configuration is that it often needs a powerful (if not Turing-complete) language to fully express. For example, "feature X can only be enabled if feature Y is also enabled." If you use the autotools, you write these predicates in Bourne Shell. Linux started with Bourne Shell, then Eric Raymond tried to replace it with CML2 (http://www.catb.org/~esr/cml2/), until a different alternative called LinuxKernelConf won out in the end (http://zippel.home.xs4all.nl/lc/).

Another thing missing from the analysis are build-time abstractions over native OS facilities. The most notable example of this is libtool. The fundamental problem libtool solves is: building shared libraries is so far from standardized that it is not reasonable for individual projects that want to be widely portable to attempt to call native OS tools directly. They call libtool, which invokes the OS tools.

In the status quo, the separation between configuration and build system is somewhat delineated: ./configure spits out Makefile. But this interface isn't ideal. "make" has way too much smarts in it for this to be a clean separation. Make allows predicates, complex substitutions, implicit rules, it inherits the environment, etc. If "make" was dead simple and Makefiles were not allowed any logic, then you could feasibly write an interface between "make" and IDEs. The input to make would be the configured build, and it could vend information about specific inputs/outputs over a socket to an IDE. It could also do much more sophisticated change detection, like based on file fingerprints instead of timestamps.

But to do that, you have to decide what format "simple make" consumes, and get build configuration systems to output their configured builds in this format.

I've been toying around with this problem for a while and this is what I came up with for this configuration->builder interface. I specified it as a protobuf schema: https://github.com/haberman/taskforce/blob/master/taskforce....

2 comments

"simple make" is ninja, right?

https://ninja-build.org/

Already works with cmake and so on.

Doesn't work with fortran, which I found out to my chagrin just this afternoon.
Why doesn't it work? Ninja should work with any tools that you can run from the command line.
Things like module dependencies, apparently: https://groups.google.com/forum/#!searchin/ninja-build/fortr...
I hadn't heard of CML2, but it looks like even several years later it was remembered as a "no don't do that": https://lkml.org/lkml/2007/7/28/145 (also: http://www.linuxtoday.com/developer/2002021700120NWKNDV " What ESR should do is try create less controvery. Do not change megabyte to mebibyte in the help files. Find out why Linus doesn't include the updated configure.help files, then fix them and get them included right away. Do not change the UI, then old UI is documented and people are familiar with it." )