[RFC libdrm 0/2] Replace the build system with meson

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Why bother, and why would we want this?                                                              │~

First it's written in python, which means the potential developer base
is massive. And it provides a recursive view for humans, but a
non-recursive view for the system. This is the best of both worlds,
humans can organize the build system in a way that makes sense, and the
machine gets a non-recursive build system. It also uses ninja rather
than make, and ninja is faster than make inherently. Meson is also a
simpler syntax than autotools or cmake it's not Turing Complete by
design nor does it expose python, again, by design. This allows meson
itself to be reimplemented in a another language if python becomes a
dead-end or a bottle-neck. It also makes it much easier to understand
what the build system is doing.

What's different about using meson?

Well, apart from a faster builds and less magic in the build system? The
configure flags are different, it uses -D<opt>=<value> more like cmake
than the --enable or --with flags of autotools, although oddly it uses
--prefix and friends when calling meson, but not with mesonconf, there's
a bug opened on this. Meson also doesn't support in-tree builds at all;
all builds are done out of tree. It also doesn't provide a "make dist"
target, fortunately there's this awesome tool called git, and it
provides a "git archive" command that does much the same thing. Did I
mention it's fast?

Here are the performance numbers I see on a 2 core 4 thread SKL, without
initial configuration, and building out of tree (using zsh):

For meson the command line is:
time (meson build -Dmanpages=true && ninja -C build)

For autotools the command line is:
time (mdkir build && cd build && ../autotools && make -j5 -l4)<Paste>

meson (cold ccache):     13.37s user 1.74s system 255% cpu  5.907 total
autotools (cold ccache): 26.50s user 1.71s system 129% cpu 21.835 total
meson (hot ccache):       2.13s user 0.39s system 154% cpu  1.633 total
autotools (hot ccache):  13.93s user 0.73s system 102% cpu 14.259 total

That's ~4x faster for a cold build and ~10x faster for a hot build.

For a make clean && make style build with a hot cache:
meson:     4.64s user 0.33s system 334% cpu 1.486 total
autotools: 7.93s user 0.32s system 167% cpu 4.920 total

Why bother with libdrm?

It's a simple build system, that could be completely (or mostly
completely) be ported in a very short time, and could serve as a tech
demo for the advantages of using meson to garner feedback for embarking
on a larger project, like mesa (which is what I'm planning to work on
next).

tl;dr

I wrote this as practice for porting Mesa, and figured I might as well
send it out since I wrote it.

It is very likely that neither of these large patches will show up on the
mailing list, but this is available at my github:
https://github.com/dcbaker/libdrm wip/meson

Dylan Baker (2):
  Port build system to meson
  remove autotools build

 .editorconfig                    |   2 +-
 .gitignore                       |  82 +-----
 Makefile.am                      | 144 +--------
 Makefile.sources                 |  41 +--
 README                           |  21 +-
 amdgpu/Makefile.am               |  47 +---
 amdgpu/Makefile.sources          |  15 +-
 amdgpu/libdrm_amdgpu.pc.in       |  11 +-
 amdgpu/meson.build               |  57 +++-
 autogen.sh                       |  20 +-
 configure.ac                     | 568 +--------------------------------
 etnaviv/Makefile.am              |  26 +-
 etnaviv/Makefile.sources         |  12 +-
 etnaviv/libdrm_etnaviv.pc.in     |  11 +-
 etnaviv/meson.build              |  56 +++-
 exynos/Makefile.am               |  27 +--
 exynos/libdrm_exynos.pc.in       |  11 +-
 exynos/meson.build               |  52 +++-
 freedreno/Makefile.am            |  30 +--
 freedreno/Makefile.sources       |  26 +-
 freedreno/libdrm_freedreno.pc.in |  11 +-
 freedreno/meson.build            |  72 ++++-
 include/drm/meson.build          |  48 +++-
 intel/Makefile.am                |  73 +----
 intel/Makefile.sources           |  15 +-
 intel/intel_bufmgr_gem.c         |   8 +-
 intel/libdrm_intel.pc.in         |  11 +-
 intel/meson.build                |  55 +++-
 libdrm.pc.in                     |  10 +-
 libkms/Makefile.am               |  43 +--
 libkms/Makefile.sources          |  23 +-
 libkms/libkms.pc.in              |  11 +-
 libkms/meson.build               |  71 ++++-
 m4/.gitignore                    |   5 +-
 man/Makefile.am                  |  62 +---
 man/meson.build                  | 119 +++++++-
 meson.build                      | 288 ++++++++++++++++-
 meson_config.h.in                |  24 +-
 meson_options.txt                |  16 +-
 nouveau/Makefile.am              |  33 +--
 nouveau/Makefile.sources         |   9 +-
 nouveau/libdrm_nouveau.pc.in     |  11 +-
 nouveau/meson.build              |  63 ++++-
 omap/Makefile.am                 |  24 +-
 omap/libdrm_omap.pc.in           |  11 +-
 omap/meson.build                 |  48 +++-
 radeon/Makefile.am               |  47 +---
 radeon/Makefile.sources          |  21 +-
 radeon/libdrm_radeon.pc.in       |  11 +-
 radeon/meson.build               |  62 +++-
 tegra/Makefile.am                |  25 +-
 tegra/libdrm_tegra.pc.in         |  11 +-
 tegra/meson.build                |  50 +++-
 tests/Makefile.am                |  47 +---
 tests/amdgpu/Makefile.am         |  29 +--
 tests/amdgpu/meson.build         |  30 ++-
 tests/etnaviv/Makefile.am        |  41 +--
 tests/etnaviv/meson.build        |  49 +++-
 tests/exynos/Makefile.am         |  47 +---
 tests/exynos/meson.build         |  43 ++-
 tests/kms/Makefile.am            |  36 +--
 tests/kms/meson.build            |  46 +++-
 tests/kmstest/Makefile.am        |  25 +-
 tests/kmstest/meson.build        |  28 ++-
 tests/meson.build                |  87 +++++-
 tests/modeprint/Makefile.am      |  18 +-
 tests/modeprint/meson.build      |  27 ++-
 tests/modetest/Makefile.am       |  24 +-
 tests/modetest/Makefile.sources  |   6 +-
 tests/modetest/meson.build       |  27 ++-
 tests/nouveau/Makefile.am        |  16 +-
 tests/nouveau/meson.build        |  30 ++-
 tests/proptest/Makefile.am       |  21 +-
 tests/proptest/Makefile.sources  |   2 +-
 tests/proptest/meson.build       |  27 ++-
 tests/radeon/Makefile.am         |  14 +-
 tests/radeon/meson.build         |  27 ++-
 tests/tegra/Makefile.am          |  13 +-
 tests/tegra/meson.build          |  27 ++-
 tests/ttmtest/Makefile.am        |   1 +-
 tests/ttmtest/src/Makefile.am    |   8 +-
 tests/util/Makefile.am           |  13 +-
 tests/util/Makefile.sources      |   8 +-
 tests/util/meson.build           |  35 ++-
 tests/vbltest/Makefile.am        |  19 +-
 tests/vbltest/meson.build        |  27 ++-
 vc4/Makefile.am                  |  34 +--
 vc4/Makefile.sources             |   3 +-
 vc4/libdrm_vc4.pc.in             |   9 +-
 vc4/meson.build                  |  28 ++-
 xf86atomic.h                     |   4 +-
 91 files changed, 1634 insertions(+), 1992 deletions(-)
 delete mode 100644 Makefile.am
 delete mode 100644 Makefile.sources
 delete mode 100644 amdgpu/Makefile.am
 delete mode 100644 amdgpu/Makefile.sources
 delete mode 100644 amdgpu/libdrm_amdgpu.pc.in
 create mode 100644 amdgpu/meson.build
 delete mode 100755 autogen.sh
 delete mode 100644 configure.ac
 delete mode 100644 etnaviv/Makefile.am
 delete mode 100644 etnaviv/Makefile.sources
 delete mode 100644 etnaviv/libdrm_etnaviv.pc.in
 create mode 100644 etnaviv/meson.build
 delete mode 100644 exynos/Makefile.am
 delete mode 100644 exynos/libdrm_exynos.pc.in
 create mode 100644 exynos/meson.build
 delete mode 100644 freedreno/Makefile.am
 delete mode 100644 freedreno/Makefile.sources
 delete mode 100644 freedreno/libdrm_freedreno.pc.in
 create mode 100644 freedreno/meson.build
 create mode 100644 include/drm/meson.build
 delete mode 100644 intel/Makefile.am
 delete mode 100644 intel/Makefile.sources
 delete mode 100644 intel/libdrm_intel.pc.in
 create mode 100644 intel/meson.build
 delete mode 100644 libdrm.pc.in
 delete mode 100644 libkms/Makefile.am
 delete mode 100644 libkms/Makefile.sources
 delete mode 100644 libkms/libkms.pc.in
 create mode 100644 libkms/meson.build
 delete mode 100644 m4/.gitignore
 delete mode 100644 man/Makefile.am
 create mode 100644 man/meson.build
 create mode 100644 meson.build
 create mode 100644 meson_config.h.in
 create mode 100644 meson_options.txt
 delete mode 100644 nouveau/Makefile.am
 delete mode 100644 nouveau/Makefile.sources
 delete mode 100644 nouveau/libdrm_nouveau.pc.in
 create mode 100644 nouveau/meson.build
 delete mode 100644 omap/Makefile.am
 delete mode 100644 omap/libdrm_omap.pc.in
 create mode 100644 omap/meson.build
 delete mode 100644 radeon/Makefile.am
 delete mode 100644 radeon/Makefile.sources
 delete mode 100644 radeon/libdrm_radeon.pc.in
 create mode 100644 radeon/meson.build
 delete mode 100644 tegra/Makefile.am
 delete mode 100644 tegra/libdrm_tegra.pc.in
 create mode 100644 tegra/meson.build
 delete mode 100644 tests/Makefile.am
 delete mode 100644 tests/amdgpu/Makefile.am
 create mode 100644 tests/amdgpu/meson.build
 delete mode 100644 tests/etnaviv/Makefile.am
 create mode 100644 tests/etnaviv/meson.build
 delete mode 100644 tests/exynos/Makefile.am
 create mode 100644 tests/exynos/meson.build
 delete mode 100644 tests/kms/Makefile.am
 create mode 100644 tests/kms/meson.build
 delete mode 100644 tests/kmstest/Makefile.am
 create mode 100644 tests/kmstest/meson.build
 create mode 100644 tests/meson.build
 delete mode 100644 tests/modeprint/Makefile.am
 create mode 100644 tests/modeprint/meson.build
 delete mode 100644 tests/modetest/Makefile.am
 delete mode 100644 tests/modetest/Makefile.sources
 create mode 100644 tests/modetest/meson.build
 delete mode 100644 tests/nouveau/Makefile.am
 create mode 100644 tests/nouveau/meson.build
 delete mode 100644 tests/proptest/Makefile.am
 delete mode 100644 tests/proptest/Makefile.sources
 create mode 100644 tests/proptest/meson.build
 delete mode 100644 tests/radeon/Makefile.am
 create mode 100644 tests/radeon/meson.build
 delete mode 100644 tests/tegra/Makefile.am
 create mode 100644 tests/tegra/meson.build
 delete mode 100644 tests/ttmtest/Makefile.am
 delete mode 100644 tests/ttmtest/src/Makefile.am
 delete mode 100644 tests/util/Makefile.am
 delete mode 100644 tests/util/Makefile.sources
 create mode 100644 tests/util/meson.build
 delete mode 100644 tests/vbltest/Makefile.am
 create mode 100644 tests/vbltest/meson.build
 delete mode 100644 vc4/Makefile.am
 delete mode 100644 vc4/Makefile.sources
 delete mode 100644 vc4/libdrm_vc4.pc.in
 create mode 100644 vc4/meson.build

base-commit: 19c4cfc54918d361f2535aec16650e9f0be667cd
-- 
git-series 0.9.1
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux