On Tue, 7 Sept 2021 at 13:41, <marcandre.lureau@redhat.com> wrote:
>
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Add the build-sys infrastructure to optionally build Rust code.
> Introduce a top-level workspace, so various sub-projects (libraries,
> executables etc) can be developed together, sharing the dependencies and
> output directory.
>
> If not Tier 1 (aarch64 and x86), all of the host architecture QEMU
> supports should be Tier 2:
> https://doc.rust-lang.org/nightly/rustc/platform-support.html
I don't think this is quite true -- for instance the riscv
TCG backend supports 32-bit, but the riscv 32 bit linux rust
port is down in Tier 3. But the major stuff seems to be in Tier
1 or 2.
That's why the first patch would clarify the situation a bit :)
> +if with_rust
> + rust_target_triple = get_option('with_rust_target')
> + if meson.is_cross_build()
> + # more default target mappings may be added over time
> + if rust_target_triple == '' and targetos == 'windows'
> + rust_target_triple = host_machine.cpu() + '-pc-windows-gnu'
> + endif
> + if rust_target_triple == ''
> + error('cross-compiling, but no Rust target-triple defined.')
> + endif
> + endif
> +endif
Not a huge fan of this... I think we would be better to always
require the user to specify the rust target triple explicitly.
In this case, no need to handle the i686 case. Fine with me, I was trying to guess from the meson config and existing --cross-prefix to make things simpler.
> diff --git a/.gitignore b/.gitignore
> index eb2553026c..78715bc7c4 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -1,5 +1,6 @@
> /GNUmakefile
> /build/
> +/target/
What's this for ?
Oops, that's wrong and unfortunate. It's the default target dir of Cargo. But it's set to $builddir/rs-target in the scripts/cargo_wrapper.py.
It is convenient to run cargo commands manually, and dirty stuff end up in target/.. I will configure .cargo/config.toml and try to prevent cargo usage from top-level source directory.
> *.pyc
> .sdk
> .stgit-*
thanks
-- PMM