[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/7] configure: integrate Meson in the build sys
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH 3/7] configure: integrate Meson in the build system |
Date: |
Wed, 26 Jun 2019 19:34:58 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) |
Paolo Bonzini <address@hidden> writes:
> The Meson build system is integrated in the existing configure/make steps
> by invoking Meson from the configure script and converting Meson's build.ninja
> rules to an included Makefile.
>
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
> Makefile | 9 +
> configure | 30 ++
> meson.build | 9 +
> scripts/ninjatool.py | 964
> +++++++++++++++++++++++++++++++++++++++++++++++++++
Uff.
> 4 files changed, 1012 insertions(+)
> create mode 100644 meson.build
> create mode 100644 scripts/ninjatool.py
>
> diff --git a/Makefile b/Makefile
> index 8e2fc66..b8f802c 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -48,6 +48,15 @@ git-submodule-update:
> endif
> endif
>
> +export NINJA=./ninjatool
> +Makefile.ninja: build.ninja ninjatool
> + ./ninjatool -t ninja2make --omit dist uninstall < $< > $@
> +-include Makefile.ninja
> +
> +ninjatool: $(SRC_PATH)/scripts/ninjatool.py
> + sed -e '1c\' -e '#! $(PYTHON)' $< > $@
> + chmod +x $@
Why do we need this here, but not for other Python scripts?
We have 39 Python scripts with #!/usr/bin/env python, one with
#!/usr/bin/env python2, and 12 with #!/usr/bin/python. The Makefiles
generally use $(PYTHON) SCRIPT ARGS...
> +
> .git-submodule-status: git-submodule-update config-host.mak
>
> # Check that we're not trying to do an out-of-tree build from
> diff --git a/configure b/configure
> index 0814a5f..b8c3c58 100755
> --- a/configure
> +++ b/configure
> @@ -493,6 +493,7 @@ docker="no"
> debug_mutex="no"
> libpmem=""
> default_devices="yes"
> +meson=meson
>
> # cross compilers defaults, can be overridden with --cross-cc-ARCH
> cross_cc_aarch64="aarch64-linux-gnu-gcc"
> @@ -983,6 +984,8 @@ for opt do
> ;;
> --python=*) python="$optarg"
> ;;
> + --meson=*) meson="$optarg"
> + ;;
> --gcov=*) gcov_tool="$optarg"
> ;;
> --smbd=*) smbd="$optarg"
> @@ -1685,6 +1688,7 @@ Advanced options (experts only):
> --make=MAKE use specified make [$make]
> --install=INSTALL use specified install [$install]
> --python=PYTHON use specified python [$python]
> + --meson=PYTHON use specified meson [$meson]
> --smbd=SMBD use specified smbd [$smbd]
> --with-git=GIT use specified git [$git]
> --static enable static build [$static]
> @@ -1850,6 +1854,11 @@ then
> error_exit "Python not found. Use --python=/path/to/python"
> fi
>
> +if ! has "$meson"
> +then
> + error_exit "Meson not found. Use --meson=/path/to/meson"
> +fi
> +
> # Note that if the Python conditional here evaluates True we will exit
> # with status 1 which is a shell 'false' value.
> if ! $python -c 'import sys; sys.exit(sys.version_info < (2,7))'; then
> @@ -7983,6 +7992,27 @@ echo "# Automatically generated by configure - do not
> modify" > "$iotests_common
> echo >> "$iotests_common_env"
> echo "export PYTHON='$python'" >> "$iotests_common_env"
>
> +# bootstrap ninjatool, we need it before Make runs
> +if ! test -x ninjatool; then
> + sed -e '1c\' -e "#! $python" ${source_path}/scripts/ninjatool.py >
> ninjatool
> + chmod +x ninjatool
> +fi
> +rm -rf meson-private meson-info meson-logs
Ignorant question: why do we need configure remove this stuff?
> +NINJA=$PWD/ninjatool $python $meson setup \
This prints
/usr/bin/python3: can't open file 'meson': [Errno 2] No such file or
directory
for me, then goes on happily.
For what it's worth:
$ type meson
meson is /usr/bin/meson
Are you sure you want to override /usr/bin/meson's #! line?
If I drop $python, I get
meson.build:1:0: ERROR: Meson version is 0.50.1 but project requires
>=0.50.999.
which is expected.
It's too hot right for me now to figure out how to obtain a suitable
version.
> + --prefix "$prefix" \
> + --libdir "$libdir" \
> + --libexecdir "$libexecdir" \
> + --bindir "$bindir" \
> + --includedir "$includedir" \
> + --datadir "$datadir" \
> + --mandir "$mandir" \
> + --sysconfdir "$sysconfdir" \
> + --localstatedir "$local_statedir" \
> + $(test "$strip_opt" = yes && echo --strip) \
> + --buildtype $(if test "$debug" = yes; then echo debug; else echo
> release; fi) \
> + "$PWD" "$source_path"
> +
> +
> # Save the configure command line for later reuse.
> cat <<EOD >config.status
> #!/bin/sh
> diff --git a/meson.build b/meson.build
> new file mode 100644
> index 0000000..b683d70
> --- /dev/null
> +++ b/meson.build
> @@ -0,0 +1,9 @@
> +project('qemu', 'c', meson_version: '>=0.50.999')
> +
> +kconfig = import('unstable-kconfig')
> +config_host = kconfig.load(meson.current_build_dir() / 'config-host.mak')
> +
> +add_project_arguments(config_host['QEMU_CFLAGS'].split(),
> + language: 'c')
> +add_project_arguments(config_host['QEMU_INCLUDES'].split(),
> + language: 'c')
> diff --git a/scripts/ninjatool.py b/scripts/ninjatool.py
> new file mode 100644
> index 0000000..6d90919
> --- /dev/null
> +++ b/scripts/ninjatool.py
[Lots of code...]
Did you write ninjatool.py specifically for QEMU, or did you steal it
(or parts) somewhere?
- [Qemu-devel] [PATCH 4/7] libvhost-user: convert to Meson, (continued)
- [Qemu-devel] [PATCH 4/7] libvhost-user: convert to Meson, Paolo Bonzini, 2019/06/10
- [Qemu-devel] [PATCH 5/7] vhost-user-blk: convert to Meson, Paolo Bonzini, 2019/06/10
- [Qemu-devel] [PATCH 6/7] vhost-user-scsi: convert to Meson, Paolo Bonzini, 2019/06/10
- [Qemu-devel] [PATCH 7/7] rdmacm-mux: convert to Meson, Paolo Bonzini, 2019/06/10
- [Qemu-devel] [PATCH 3/7] configure: integrate Meson in the build system, Paolo Bonzini, 2019/06/10