The Rise of Meson

More and more open source projects seem to switch to the Meson build tool, in the last years. In an attempt to quantify this development I looked at the build tools usage by Fedora packages, during the last 14 years.

About Meson

Meson is a build tool with good C/C++ support. It's written in Python and generates Ninja build files. Since it was created after CMake (which was initially released in 2000), it had the chance to learn from CMake's mistakes. In comparison to CMake, Meson has better documentation, it doesn't support generating classic makefiles, it only supports out of source tree builds, and its domain specific language is arguably much better designed.

So, from the start, Meson arguably is also more opinionated in its design, but in a useful way. Usually, simple stuff is easy to solve with Meson and there is one kind of obvious way to do it. Whereas with CMake, there are often several ways to implement common build tasks (cf. TMTOWTDI), including some legacy ones. With Meson, build files are often much shorter than equivalent CMake ones.

CMake evolved over the years and it's possible to write - say - a modern style of CMake build files that are less awful, and use it in a modern way to some degree, but it feels that the official documentation doesn't help much in that regard, and that one would have to study several books on modern CMake in order to arrive there.

Fedora Data

The first packages that required Meson to build arrived in Fedora 22, i.e. 6 years ago (in 2015, Fedora runs on a half-year release schedule and Meson was initially released in 2013, 8 years ago). Since then the number of packages that build-require Meson grew to almost 600 hundred:

Number of packages that build-require CMake, Meson, Scons

So this graph shows the number of packages that require a notable build tool at build time, for each Fedora release.

Scons never really took off and nowadays only a handful of packages still require it. In contrast, the Meson usage shows some serious growth.

When looking at the Meson growth in relation to the packages that either require CMake, Scons or Meson - Meson is now required by 30 % or so of the packages:

Relative Meson Build Requirements growth

The growth slowed a bit down in the last Fedora releases, it seems.

Other Tools

So what about Autoconf, Automake, etc. (a.k.a. Autotools) and other build tools? Since most project that use Autotools release their tar archive files with already generated configure scripts/make files, the resulting packages don't depend on those tools. Plus, before Fedora 34, there isn't even a dependency on GNU make, since it was part of the standard build root environment. This changed with Fedora 34, where 9000 packages or so depend on GNU make. Subtracting the packages that also require CMake, there remain 8000 packages or so that might use Autotools. But how many of those use plain old Makefiles can't be easily derived by just looking at the package dependencies.

In any case, using Autotools for a modern C/C++ project in 2021 is like using CVS for source code version control in 2021: there are better tools available and thus it isn't very interesting to still consider the legacy solutions.

The Boost project has its own build system: BJam. There is some documentation, but it's kind of minimal and cryptic. As of Fedora 34, the is no package that build-requires BJam. (Boost itself doesn't need to explicitly require it since it's included in the Boost release tar archive.) Incidentally, the Boost steering committee announced in 2017 its desire to migrate to CMake, however, as of 2021, the current Boost documentation still just mentions BJam/b2 for building Boost.

Methods

The build tool usage stats were obtained with:

{
    echo "fedora_release,tool,users"
    for ((i=7; i<35; ++i)); do
        for k in meson cmake scons; do
            n=$(dnf repoquery --releasever=$i --disablerepo='*' --enablerepo='*-source' \
                      --arch=src --whatrequires $k | sed 's/-[0-9]:[0-9].*$//' \
                    | sort -u  | wc -l)
            echo "$i,$k,$n"
        done
    done
} | tee build-stat.csv

And for GNU make, on Fedora 34:

dnf repoquery --disablerepo='*' --enablerepo='*-source' --arch=src \
      --whatrequires make | sed 's/-[0-9]:[0-9].*$//' \
    | sort -u  | wc -l > f34-require-make.log