Cargo will always require all depenendencies, even if the package is not
being built against them. In order to avoid that, we will need the
nightly build of the Rust compiler which supports skipping those
dependencies.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
CARGO = \
CARGOPATH=$(CARGO_PATH) \
- cargo
+ RUSTC_BOOTSTRAP=1 \
+ cargo \
+ --offline
+
+CARGO_OPTIONS = \
+ $(MAKETUNING) \
+ -Z avoid-dev-deps
define CARGO_PREPARE
mkdir -p $(CARGO_PATH) && \
CARGO_BUILD = \
$(CARGO) \
build \
- $(MAKETUNING) \
- --release
+ --release \
+ $(CARGO_OPTIONS)
# Checks whether this crate has a right taregt
-CARGO_TARGET_CHECK = cargo metadata --format-version 1 | \
+CARGO_TARGET_CHECK = $(CARGO) metadata --format-version 1 --no-deps | \
jq -e ".packages[].targets[].kind | any(. == \"$(1)\")" | grep -q "true"
define CARGO_INSTALL
echo "{\"files\":{},\"package\":\"\"}" > $(CRATE_PATH)/.cargo-checksum.json; \
fi && \
if $(call CARGO_TARGET_CHECK,bin); then \
- $(CARGO) install --no-track --path .; \
+ $(CARGO) install $(CARGO_OPTIONS) --no-track --path .; \
fi
endef