package/pkg-cargo: allow building in a sub-directory

Some packages have their rust sources as a sub-directory, rather
than at the root of the source tree.

Do like we do for autotools-package, and use the package's _SRCDIR
rather than the top-level directory $(@D).

Additionally, in such a situation, it is more than probable that
the Cargo.toml is also present in that sub-directory, so use that
when vendoring the package.

Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Yann E. MORIN
2022-02-10 16:29:25 +01:00
committed by Peter Korsgaard
parent 6d508d8e45
commit 6b59ed35a2
2 changed files with 14 additions and 4 deletions

View File

@@ -73,6 +73,11 @@ A few additional variables, specific to the Cargo infrastructure, can
also be defined. Many of them are only useful in very specific cases,
typical packages will therefore only use a few of them.
* +FOO_SUBDIR+ may contain the name of a subdirectory inside the package
that contains the Cargo.toml file. This is useful, if for example, it
is not at the root of the tree extracted by the tarball. If
+HOST_FOO_SUBDIR+ is not specified, it defaults to +FOO_SUBDIR+.
* +FOO_CARGO_ENV+ can be used to pass additional variables in the
environment of +cargo+ invocations. It used at both build and
installation time