The main change from v1 is that libqemuutil.a, and with it the tracetool
and QAPI generated code, is now generated with meson. This shows how
to do some "computations" in meson.build using its array and dictionary
data structures. It is also a basic usage of the sourceset module for
conditional compilation.
Overall the look of the meson.build code is quite good, but I must
mention the two snags I encountered:
- one is just aboud debuggability. Quoting rules on Windows are crazy
so you really do not want to go through quoting there; with Make the
choice is basically to not support spaces in filenames, Ninja instead
chose to only do shell expansion on POSIX systems. For the sake of
cross-platformness, Meson uses an external script to do "x > y" on both
POSIX and Windows, and that currently is not very debuggable when you
use "make V=1". I know how to fix this and, even though the first
attempt was rejected at https://github.com/mesonbuild/meson/pull/5573,
but I have other arrows in my quiver. Worst case we could pass the
output file to tracetool as a command line argument, but I'd rather
not do that as it is not a QEMU-specific issue and my philosophy so
far has been to improve Meson whenever possible---at least this endeavour
would provide benefit to the community even if QEMU rejects it.
- the second is more fundamental: with Make we're enjoying much freedom in
choosing the include path, in particular the tracing headers are using
$(build_root)/$(<D). Meson does not like that for reasons I have not
completely understood. For now my solution is to generate headers like
"trace/trace-audio.h" and have sixty one-line forwarding headers in the
source tree; for example "audio/trace.h" includes "trace/trace-audio.h".
I'm not sure if it's possible to instead add a one-line "generate
trace headers" directive to each subdirectory's meson.build file.
I suspect that it _is_ possible but you'd still have to change the
#include directives to include the subdirectory name (and then I prefer
the forwarding headers).
The forwarding headers mechanism would of course be possible with the
current Makefiles too, of course.
Other notes:
1) this is only very lightly tested (./configure && make basically)
2) I have not yet converted qemu-ga, which would be next, but I can
already say that the conversion probably will *not* remove the code
duplication we have between Makefile's rules for qemu-ga's QAPI files,
and qapi/Makefile.objs's rules for QEMU's QAPI files.
3) there are two main changes outside patch 4: scripts/ninjatool is now
built from meson.build, which removes duplicate code between Makefile and
configure; and "type -p" is replaced throughout with the more correct
"command -v".
Paolo Bonzini (8):
configure: do not include $(...) variables in config-host.mak
configure: set $PYTHON to a full path
configure: integrate Meson in the build system
convert libqemuutil to meson
libvhost-user: convert to Meson
vhost-user-blk: convert to Meson
vhost-user-scsi: convert to Meson
rdmacm-mux: convert to Meson
.gitignore | 13 +-
Makefile | 191 ++-----
Makefile.objs | 94 +---
audio/trace.h | 1 +
chardev/trace.h | 1 +
configure | 63 ++-
contrib/libvhost-user/Makefile.objs | 1 -
contrib/libvhost-user/meson.build | 2 +
contrib/rdmacm-mux/Makefile.objs | 3 -
contrib/rdmacm-mux/meson.build | 6 +
contrib/vhost-user-blk/Makefile.objs | 1 -
contrib/vhost-user-blk/meson.build | 3 +
contrib/vhost-user-scsi/Makefile.objs | 1 -
contrib/vhost-user-scsi/meson.build | 3 +
crypto/Makefile.objs | 3 +-
hw/9pfs/trace.h | 1 +
hw/acpi/trace.h | 1 +
hw/alpha/trace.h | 1 +
hw/arm/trace.h | 1 +
hw/audio/trace.h | 1 +
hw/block/dataplane/trace.h | 1 +
hw/block/trace.h | 1 +
hw/char/trace.h | 1 +
hw/display/trace.h | 1 +
hw/dma/trace.h | 1 +
hw/gpio/trace.h | 1 +
hw/hppa/trace.h | 1 +
hw/i2c/trace.h | 1 +
hw/i386/trace.h | 1 +
hw/i386/xen/trace.h | 1 +
hw/ide/trace.h | 1 +
hw/input/trace.h | 1 +
hw/intc/trace.h | 1 +
hw/isa/trace.h | 1 +
hw/mem/trace.h | 1 +
hw/misc/macio/trace.h | 1 +
hw/misc/trace.h | 1 +
hw/net/trace.h | 1 +
hw/nvram/trace.h | 1 +
hw/pci-host/trace.h | 1 +
hw/pci/trace.h | 1 +
hw/ppc/trace.h | 1 +
hw/rdma/trace.h | 1 +
hw/rdma/vmw/trace.h | 1 +
hw/riscv/trace.h | 1 +
hw/s390x/trace.h | 1 +
hw/scsi/trace.h | 1 +
hw/sd/trace.h | 1 +
hw/sparc/trace.h | 1 +
hw/sparc64/trace.h | 1 +
hw/timer/trace.h | 1 +
hw/tpm/trace.h | 1 +
hw/usb/trace.h | 1 +
hw/vfio/trace.h | 1 +
hw/virtio/trace.h | 1 +
hw/watchdog/trace.h | 1 +
hw/xen/trace.h | 1 +
meson.build | 154 ++++++
migration/trace.h | 1 +
net/trace.h | 1 +
qapi/Makefile.objs | 20 -
qapi/meson.build | 54 ++
qapi/trace.h | 1 +
qobject/Makefile.objs | 3 -
qobject/meson.build | 3 +
qom/trace.h | 1 +
scripts/ninjatool.py | 988 ++++++++++++++++++++++++++++++++++
scripts/qapi-gen.py | 2 +-
scripts/tracetool.py | 2 +-
scripts/tracetool/backend/ust.py | 6 +-
scripts/tracetool/format/c.py | 5 +-
stubs/Makefile.objs | 43 --
stubs/meson.build | 45 ++
target/arm/trace.h | 1 +
target/hppa/trace.h | 1 +
target/i386/trace.h | 1 +
target/mips/trace.h | 1 +
target/ppc/trace.h | 1 +
target/riscv/trace.h | 1 +
target/s390x/trace.h | 1 +
target/sparc/trace.h | 1 +
trace/Makefile.objs | 51 --
trace/meson.build | 75 +++
ui/trace.h | 1 +
util/Makefile.objs | 59 --
util/meson.build | 57 ++
util/trace.h | 1 +
87 files changed, 1536 insertions(+), 473 deletions(-)
create mode 100644 audio/trace.h
create mode 100644 chardev/trace.h
delete mode 100644 contrib/libvhost-user/Makefile.objs
create mode 100644 contrib/libvhost-user/meson.build
delete mode 100644 contrib/rdmacm-mux/Makefile.objs
create mode 100644 contrib/rdmacm-mux/meson.build
delete mode 100644 contrib/vhost-user-blk/Makefile.objs
create mode 100644 contrib/vhost-user-blk/meson.build
delete mode 100644 contrib/vhost-user-scsi/Makefile.objs
create mode 100644 contrib/vhost-user-scsi/meson.build
create mode 100644 hw/9pfs/trace.h
create mode 100644 hw/acpi/trace.h
create mode 100644 hw/alpha/trace.h
create mode 100644 hw/arm/trace.h
create mode 100644 hw/audio/trace.h
create mode 100644 hw/block/dataplane/trace.h
create mode 100644 hw/block/trace.h
create mode 100644 hw/char/trace.h
create mode 100644 hw/display/trace.h
create mode 100644 hw/dma/trace.h
create mode 100644 hw/gpio/trace.h
create mode 100644 hw/hppa/trace.h
create mode 100644 hw/i2c/trace.h
create mode 100644 hw/i386/trace.h
create mode 100644 hw/i386/xen/trace.h
create mode 100644 hw/ide/trace.h
create mode 100644 hw/input/trace.h
create mode 100644 hw/intc/trace.h
create mode 100644 hw/isa/trace.h
create mode 100644 hw/mem/trace.h
create mode 100644 hw/misc/macio/trace.h
create mode 100644 hw/misc/trace.h
create mode 100644 hw/net/trace.h
create mode 100644 hw/nvram/trace.h
create mode 100644 hw/pci-host/trace.h
create mode 100644 hw/pci/trace.h
create mode 100644 hw/ppc/trace.h
create mode 100644 hw/rdma/trace.h
create mode 100644 hw/rdma/vmw/trace.h
create mode 100644 hw/riscv/trace.h
create mode 100644 hw/s390x/trace.h
create mode 100644 hw/scsi/trace.h
create mode 100644 hw/sd/trace.h
create mode 100644 hw/sparc/trace.h
create mode 100644 hw/sparc64/trace.h
create mode 100644 hw/timer/trace.h
create mode 100644 hw/tpm/trace.h
create mode 100644 hw/usb/trace.h
create mode 100644 hw/vfio/trace.h
create mode 100644 hw/virtio/trace.h
create mode 100644 hw/watchdog/trace.h
create mode 100644 hw/xen/trace.h
create mode 100644 meson.build
create mode 100644 migration/trace.h
create mode 100644 net/trace.h
create mode 100644 qapi/meson.build
create mode 100644 qapi/trace.h
delete mode 100644 qobject/Makefile.objs
create mode 100644 qobject/meson.build
create mode 100644 qom/trace.h
create mode 100755 scripts/ninjatool.py
delete mode 100644 stubs/Makefile.objs
create mode 100644 stubs/meson.build
create mode 100644 target/arm/trace.h
create mode 100644 target/hppa/trace.h
create mode 100644 target/i386/trace.h
create mode 100644 target/mips/trace.h
create mode 100644 target/ppc/trace.h
create mode 100644 target/riscv/trace.h
create mode 100644 target/s390x/trace.h
create mode 100644 target/sparc/trace.h
create mode 100644 trace/meson.build
create mode 100644 ui/trace.h
delete mode 100644 util/Makefile.objs
create mode 100644 util/meson.build
create mode 100644 util/trace.h
--
1.8.3.1