]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
rust: Avoid requiring development dependencies
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 28 Jan 2022 09:12:06 +0000 (09:12 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 1 Feb 2022 13:50:32 +0000 (13:50 +0000)
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>
lfs/Config

index a1e77f72ce0dfb26b0ed94cf2b99e05bb8c6b2b8..fb5745df062e6363575c18c6e9040267073c765d 100644 (file)
@@ -184,7 +184,13 @@ export CARGO_CONFIG
 
 CARGO = \
        CARGOPATH=$(CARGO_PATH) \
-       cargo
+       RUSTC_BOOTSTRAP=1 \
+       cargo \
+       --offline
+
+CARGO_OPTIONS = \
+       $(MAKETUNING) \
+       -Z avoid-dev-deps
 
 define CARGO_PREPARE
        mkdir -p $(CARGO_PATH) && \
@@ -195,11 +201,11 @@ endef
 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
@@ -214,7 +220,7 @@ 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