From: Markus Armbruster <armbru@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 3/7] configure: integrate Meson in the build system
Date: Wed, 26 Jun 2019 19:34:58 +0200 [thread overview]
Message-ID: <87woh8i725.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <1560165301-39026-4-git-send-email-pbonzini@redhat.com> (Paolo Bonzini's message of "Mon, 10 Jun 2019 13:14:57 +0200")
Paolo Bonzini <pbonzini@redhat.com> 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 <pbonzini@redhat.com>
> ---
> 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?
next prev parent reply other threads:[~2019-06-26 17:36 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-10 11:14 [Qemu-devel] [RFC PATCH 0/7] Proof of concept for Meson integration Paolo Bonzini
2019-06-10 11:14 ` [Qemu-devel] [PATCH 1/7] configure: do not include $(...) variables in config-host.mak Paolo Bonzini
2019-06-10 11:14 ` [Qemu-devel] [PATCH 2/7] configure: set $PYTHON to a full path Paolo Bonzini
2019-06-10 11:14 ` [Qemu-devel] [PATCH 3/7] configure: integrate Meson in the build system Paolo Bonzini
2019-06-26 17:34 ` Markus Armbruster [this message]
2019-06-27 8:52 ` Paolo Bonzini
2019-06-27 9:46 ` Christophe de Dinechin
2019-06-27 9:03 ` Daniel P. Berrangé
2019-06-27 10:16 ` Paolo Bonzini
2019-06-27 12:23 ` Markus Armbruster
2019-06-27 12:50 ` Daniel P. Berrangé
2019-06-27 12:57 ` Paolo Bonzini
2019-06-27 12:55 ` Daniel P. Berrangé
2019-06-27 13:16 ` Gerd Hoffmann
2019-06-27 13:20 ` Paolo Bonzini
2019-06-27 13:27 ` Daniel P. Berrangé
2019-06-10 11:14 ` [Qemu-devel] [PATCH 4/7] libvhost-user: convert to Meson Paolo Bonzini
2019-06-27 9:03 ` Markus Armbruster
2019-06-10 11:14 ` [Qemu-devel] [PATCH 5/7] vhost-user-blk: " Paolo Bonzini
2019-06-10 11:15 ` [Qemu-devel] [PATCH 6/7] vhost-user-scsi: " Paolo Bonzini
2019-06-27 11:23 ` Markus Armbruster
2019-06-27 12:31 ` Paolo Bonzini
2019-06-10 11:15 ` [Qemu-devel] [PATCH 7/7] rdmacm-mux: " Paolo Bonzini
2019-06-27 11:38 ` Markus Armbruster
2019-06-27 12:21 ` Paolo Bonzini
2019-06-10 12:33 ` [Qemu-devel] [RFC PATCH 0/7] Proof of concept for Meson integration no-reply
2019-06-10 12:36 ` no-reply
2019-06-10 12:40 ` no-reply
2019-06-27 12:39 ` Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87woh8i725.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.