Skip to content

Moving Epoxy to Meson

Emmanuele Bassi edited this page Jan 18, 2017 · 4 revisions

Meson is a new build system, written in Python, that generates Ninja, Visual Studio, and XCode project files. It has appealing factors:

  • it's fast
  • it does not fork to the shell
  • it does not use libtool
  • it does not use m4
  • it has a small, non-Turing complete language for defining the build
  • it uses modern tools to find dependencies
  • it can be introspected through a simple JSON format
  • it's really fast

Epoxy is a prime candidate for switching to Meson as its primary build system:

  • it's small
  • it's self-contained
  • it has little to no dependencies

Porting to Meson yields fairly good results in terms of complexity:

  • Autotools requires 6 files, for a total of 651 lines; it also depends on additional m4 macros from X.org
  • Meson requires 4 files, for a total of 512 lines; no additional dependencies are required

On the timing side, Meson is about 45% faster than Autotools at building and running the test suite:

Reference system

  • Dell XPS 13 "Kaby Lake"
    • Core i7-7500U (4 cores)
    • NVMe SSD

Meson

Command chain

  • mkdir _build && pushd _build
  • meson
  • ninja
  • ninja test
  • popd && rm -rf _build
Notes
  • Ninja automatically figures out the appropriate number of parallel jobs
  • Ninja automatically runs the test suite in parallel

Timing

  • real 0m10.119s
  • user 0m16.507s
  • sys 0m1.666s

Autotools

Command chain

  • NOCONFIGURE=1 ./autogen.sh
  • mkdir _build && pushd _build
  • ../configure
  • make -j$(($(nproc) + 2))
  • make -j$(($(nproc) + 2)) check
  • popd && rm -rf _build
Notes
  • Perform a builddir != srcdir build for a comparison with Meson; autogen.sh still dumps files inside the srcdir, which requires a full clean when rebuilding after a change to the build system
  • $(($(nproc) + 2)) yields an equivalent number of parallel jobs as Ninja would use

Timing

  • real 0m17.823s
  • user 0m22.650s
  • sys 0m4.271s
Clone this wiki locally