mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-10-01 06:21:56 -09:00
package/pkg-cargo.mk: introduce the cargo package infrastructure
In order to be package agnostic, the install phase is now using cargo instead of install. TARGET_CONFIGURE_OPTS is now also set when running cargo in order to support cross compiling C code within cargo. This commit also adds support/download/cargo-post-process to perform the vendoring on Cargo packages. The <pkg>_LICENSE variable of cargo packages is expanded with ", vendored dependencies licenses probably not listed" as currently for all packages, the licenses of the vendored dependencies are not taken into account. Signed-off-by: Patrick Havelange <patrick.havelange@essensium.com> [Thomas: add support for host-cargo-package and vendoring] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
committed by
Thomas Petazzoni
parent
ad034892d8
commit
301a8eae0c
38
support/download/cargo-post-process
Executable file
38
support/download/cargo-post-process
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
. "${0%/*}/helpers"
|
||||
|
||||
while getopts "n:o:" OPT; do
|
||||
case "${OPT}" in
|
||||
o) output="${OPTARG}";;
|
||||
n) base_name="${OPTARG}";;
|
||||
:) error "option '%s' expects a mandatory argument\n" "${OPTARG}";;
|
||||
\?) error "unknown option '%s'\n" "${OPTARG}";;
|
||||
esac
|
||||
done
|
||||
|
||||
# Already vendored tarball, nothing to do
|
||||
if tar tf "${output}" | grep -q "^[^/]*/VENDOR" ; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
post_process_unpack "${base_name}" "${output}"
|
||||
|
||||
# Do the Cargo vendoring
|
||||
pushd "${base_name}" > /dev/null
|
||||
cargo vendor --locked VENDOR
|
||||
|
||||
# Create the local .cargo/config with vendor info
|
||||
mkdir -p .cargo/
|
||||
cat <<EOF >.cargo/config
|
||||
[source.crates-io]
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source.vendored-sources]
|
||||
directory = "VENDOR"
|
||||
EOF
|
||||
popd > /dev/null
|
||||
|
||||
post_process_repack "$(pwd)" "${base_name}" "${output}"
|
||||
Reference in New Issue
Block a user