[Buildroot] [PATCH 2/5 v2] package/pkg-cargo: allow building in a sub-directory

yann.morin at orange.com yann.morin at orange.com
Thu Feb 10 15:08:50 UTC 2022


Thomas, All,

On 2022-02-09 20:54 +0100, Thomas Petazzoni spake thusly:
> On Wed, 9 Feb 2022 17:08:44 +0100
> <yann.morin at orange.com> wrote:
> > +# If building in a sub directory, use that to find the Cargo.toml, unless
> > +# the package already provided its location.
> > +ifneq ($$($(2)_SUBDIR),)
> > +ifeq ($$(filter BR_CARGO_MANIFEST_PATH=%,$$($(2)_DL_ENV)),)
> > +$(2)_DL_ENV += BR_CARGO_MANIFEST_PATH=$$($(2)_SUBDIR)/Cargo.toml
> 
> I find that a bit "meh".

I too am not fond of it, to be honest... But I am not a rust/cargo
expert, by far, I wanted not to break any existing setup.

However, the cargo infra is brand new, and BR_CARGO_MANIFEST_PATH was
not even advertised either, so we should probably not have to expect any
package to actually use it already.

> Should we have an explicit package variable
> that tells the location of the Cargo.toml, instead of directly have
> packages pass this "magic" BR_CARGO_MANIFEST_PATH variable ?

I was wondering if that would even make sense to have a different
_SUBDIR and BR_CARGO_MANIFEST_PATH to begin with?

We have a package here that seems to be in such a situation, though:
    https://github.com/Orange-OpenSource/its-client

The Cargo.toml is in rust/ but we need to do the build in
rust/its-client/ ("cargo build" works perfectly well with a virtual
workspace, like is used here, but "cargo install" refuses to work,
muahaha...)

Still, because of a missing Cargo.lock in that package, vendoring by
Buildroot does not work eother (we'll fix that later).

So, for now, I suggest we just expect that BR_CARGO_MANIFEST_PATH is the
same as _SUBDIR, and thus the conditional assignment is not needed.

If in the future we do have an actual, working situation where they
differ, then we may add the necessary infra, seems like a plan?

In the meantime, I'll respin the series with the ugly conditional
removed.

> Should $(2)_SUBDIR be documented for the cargo-package infra in the
> documentation ?

It is not documented for any of the other infras that make use of it
(autotools, cmake, python, etc...).

The only mention of _SUBDIR in the manual is about _SUBDIRS (plural) for
the kernel-module sub-infra.

Thanks for the review!

Regards,
Yann E. MORIN.

> Thomas
> -- 
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com

-- 
                                        ____________
.-----------------.--------------------:       _    :------------------.
|  Yann E. MORIN  | Real-Time Embedded |    __/ )   | /"\ ASCII RIBBON |
| +33 534.541.179 | Software  Designer |  _/ - /'   | \ / CAMPAIGN     |
| +33 638.411.245 '--------------------: (_    `--, |  X  AGAINST      |
|      yann.morin (at) orange.com      |_="    ,--' | / \ HTML MAIL    |
'--------------------------------------:______/_____:------------------'


_________________________________________________________________________________________________________________________

Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.




More information about the buildroot mailing list