Features/Meson/Design: Difference between revisions
(Created page with "Rules.mak has gotten pretty insane, let's get rid of it! More seriously, the current build system causes clutter in the toplevel Makefiles, and it makes simple tasks harder t...") |
(→Status) |
||
Line 28: | Line 28: | ||
** move ninjatool generation to meson.build | ** move ninjatool generation to meson.build | ||
** convert libqemuutil.a, trace, QAPI, possibly qemu-ga | ** convert libqemuutil.a, trace, QAPI, possibly qemu-ga | ||
* Further phases: | |||
** convert emulators and other tools | |||
** convert tests | |||
** convert configure |
Revision as of 15:07, 27 June 2019
Rules.mak has gotten pretty insane, let's get rid of it!
More seriously, the current build system causes clutter in the toplevel Makefiles, and it makes simple tasks harder than they should be. For example, each executable in contrib/ has to touch three files: Makefile, Makefile.objs and contrib/*/Makefile.objs.
The transition is designed around the following goals:
- it should remain trivial to do things that used to be trivial, and most "make" invocations should be kept the same at least until everything is converted and we can perhaps declare a flag day. People are used to "make check" or "make subdir-x86_64-softmmu", those should continue to work while the transition is in progress.
- it should be possible to modify meson.build without knowing QEMU specific details, and that should be _already_ possible now at the beginning of the transition (to avoid creating technical debt). This means keeping the magic confined in Makefile rules and external scripts, while having a pretty plain meson.build.
A PoC was posted in June 2019. It includes a program called "ninjatool" that replaces ninja for the few cases where meson invokes it directly (ninja -t compdb, ninja -t clean) and that also is able to convert build.ninja files to Make syntax. Because of this, it is trivial to have make build products that depend on meson build products. Therefore bottom up is the natural direction for the conversion.
This fits in a generic plan to drop Makefile magic in favor of build rule generators written in high-level languages. For example, in order to keep make check-like rules working, we could generate Makefile rules from the output of meson introspect --tests.
The alternative of having two parallel build systems was rejected. This would introduce extra work for people not involved in the conversion, and the risk of bitrotting one of the two build systems is large.
Prerequisites
Barring bugs, Meson 0.51.0 should have all that is needed to port QEMU, in particular the following pull requests:
- Support a NINJA environment variable
- Kconfig Module (note: still named "unstable-kconfig", should be stabilized before QEMU switches to meson)
- new module "sourceset" to match source file lists against configuration data
- Script found by find_program() does not end up in dependencies
- do not include host environment in test/benchmark introspection data
Status
- PoC: https://patchew.org/QEMU/1560165301-39026-1-git-send-email-pbonzini@redhat.com/
- Next PoC should:
- move ninjatool generation to meson.build
- convert libqemuutil.a, trace, QAPI, possibly qemu-ga
- Further phases:
- convert emulators and other tools
- convert tests
- convert configure