From: Paolo Bonzini <pbonzini@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 3/7] configure: integrate Meson in the build system
Date: Thu, 27 Jun 2019 10:52:42 +0200 [thread overview]
Message-ID: <44cb12ee-ee3d-43b0-47bd-e706bdf37a01@redhat.com> (raw)
In-Reply-To: <87woh8i725.fsf@dusky.pond.sub.org>
On 26/06/19 19:34, Markus Armbruster wrote:
> 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.
What, the 9+30+9 or the 964? :)
>> +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...
Because this script is invoked by meson too. While my patch to support
a NINJA environment variable was accepted (and we point it to
ninjatool), meson invokes it as "$(NINJA)" --foo with no splitting, so
we need the above change.
But I can do better than this. I can generate the file directly from
meson.build:
configure_file(input: files('scripts/ninjatool.py'),
output: 'ninjatool',
configuration: config_host)
and avoid code duplication between configure and Makefile.
>> +rm -rf meson-private meson-info meson-logs
>
> Ignorant question: why do we need configure remove this stuff?
By default, reinvoking meson complains that you probably want to
reconfigure (a la config.status) because there is already a build tree
here. Our configure script always reconfigures the tree from scratch.
So I just cause meson to fail that check.
>> +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?
No I'm not. It should be just $meson, as you do below, though it could
also be $python "$(type -p meson)" if I wanted to override---but
certainly not $python $meson. It worked for me because I was pointing
$meson to an absolute path under my home directory.
There is actually one reason to override it, which is why I did it in
the patch. Meson has an automagic way to invoke all Python programs
with the same interpreter that was used to run meson itself (you make
the script non-executable and add "#! /usr/bin/env python3" as the first
line). If we want to use that feature, we should invoke meson with $python.
> 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.
FWIW 0.51.0 has now been released so you could grab it from Koji.
>> 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?
I wrote it specifically for QEMU.
Paolo
next prev parent reply other threads:[~2019-06-27 8:53 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
2019-06-27 8:52 ` Paolo Bonzini [this message]
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=44cb12ee-ee3d-43b0-47bd-e706bdf37a01@redhat.com \
--to=pbonzini@redhat.com \
--cc=armbru@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).