Hi

On Wed, Jun 12, 2024 at 12:05 PM Daniel P. Berrangé <berra...@redhat.com>
wrote:

> On Tue, Jun 11, 2024 at 02:25:39PM -0400, Stefan Hajnoczi wrote:
> > On Tue, 11 Jun 2024 at 13:54, Manos Pitsidianakis
> > <manos.pitsidiana...@linaro.org> wrote:
> > >
> > > On Tue, 11 Jun 2024 at 17:05, Stefan Hajnoczi <stefa...@redhat.com>
> wrote:
> > > >
> > > > On Mon, Jun 10, 2024 at 09:22:36PM +0300, Manos Pitsidianakis wrote:
> > > > > Add options for Rust in meson_options.txt, meson.build, configure
> to
> > > > > prepare for adding Rust code in the followup commits.
> > > > >
> > > > > `rust` is a reserved meson name, so we have to use an alternative.
> > > > > `with_rust` was chosen.
> > > > >
> > > > > Signed-off-by: Manos Pitsidianakis <manos.pitsidiana...@linaro.org
> >
> > > > > ---
> > > > > The cargo wrapper script hardcodes some rust target triples. This
> is
> > > > > just temporary.
> > > > > ---
> > > > >  .gitignore               |   2 +
> > > > >  configure                |  12 +++
> > > > >  meson.build              |  11 ++
> > > > >  meson_options.txt        |   4 +
> > > > >  scripts/cargo_wrapper.py | 211
> +++++++++++++++++++++++++++++++++++++++
> > > > >  5 files changed, 240 insertions(+)
> > > > >  create mode 100644 scripts/cargo_wrapper.py
>
> > > > > diff --git a/configure b/configure
> > > > > index 38ee257701..c195630771 100755
> > > > > --- a/configure
> > > > > +++ b/configure
>
> snip
>
> > > > > +  test "$with_rust_target_triple" != "" && meson_option_add
> "-Dwith_rust_target_triple=$with_rust_target_triple"
>
> So the --rust-target-triple is only needed when cross compiling,
> but this is not the way we normally handle passing cross compiler
> info to meson. Instead we create a meson cross compiler options
> file containing the target info.
>
> eg for ./configure --cross-prefix=x86_64-w64-mingw32-
>
> we end up creating:
>
> $ cat build/config-meson.cross
> # Automatically generated by configure - do not modify
> [properties]
> [built-in options]
> c_args = []
> cpp_args = []
> objc_args = []
> c_link_args = []
> cpp_link_args = []
> # environment defaults, can still be overridden on
> # the command line
> werror = true
> [project options]
>
> [binaries]
> c = ['x86_64-w64-mingw32-gcc','-m64']
> cpp = ['x86_64-w64-mingw32-g++','-m64']
> objc = ['x86_64-w64-mingw32-clang','-m64']
> ar = ['x86_64-w64-mingw32-ar']
> dlltool = ['x86_64-w64-mingw32-dlltool']
> nm = ['x86_64-w64-mingw32-nm']
> pkgconfig = ['x86_64-w64-mingw32-pkg-config']
> pkg-config = ['x86_64-w64-mingw32-pkg-config']
> ranlib = ['x86_64-w64-mingw32-ranlib']
> strip = ['x86_64-w64-mingw32-strip']
> widl = ['x86_64-w64-mingw32-widl']
> windres = ['x86_64-w64-mingw32-windres']
> windmc = ['x86_64-w64-mingw32-windmc']
> [host_machine]
> system = 'windows'
> cpu_family = 'x86_64'
> cpu = 'x86_64'
> endian = 'little'
>
>
> Should we not be passing the rust compiler target through
> this meson options file by setting something like this
>
>   rust = ['rustc', '--target', '$target_target_triple']
>

Agree


>
>
> Also I don't think we should be requiring --rust-target-triple
> to be passed by the user. For all the combinations we know &
> test, we should have configure "do the right thing" and set a
> suitable rust target triple based on the --cross-prefix argument
> that is given, so there is no extra burden on users cross
> compiling. Users should then only use --rust-target-triple
> if our default logic is wrong for some reason.
>
>
Then I think we would need to maintain some mapping between GNU
target-triplets and Rust. It would be convenient to allow users to
set/overwrite it though.


-- 
Marc-André Lureau

Reply via email to