diff options
author | tnn <tnn@pkgsrc.org> | 2020-08-14 20:44:16 +0000 |
---|---|---|
committer | tnn <tnn@pkgsrc.org> | 2020-08-14 20:44:16 +0000 |
commit | a05d4148378f27535966f83e1372f5dd4b7789e1 (patch) | |
tree | bb91cf0c51b7b2f0ad2357584cd18b4fc6bbf649 /lang/rust/cargo.mk | |
parent | 3350a4336fdadb944c690a943f06bbf88c8ba20c (diff) | |
download | pkgsrc-a05d4148378f27535966f83e1372f5dd4b7789e1.tar.gz |
rust/cargo.mk: add a default do-build target to reduce copypasta
Diffstat (limited to 'lang/rust/cargo.mk')
-rw-r--r-- | lang/rust/cargo.mk | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/lang/rust/cargo.mk b/lang/rust/cargo.mk index 2be1877f784..9d75474fde8 100644 --- a/lang/rust/cargo.mk +++ b/lang/rust/cargo.mk @@ -1,4 +1,4 @@ -# $NetBSD: cargo.mk,v 1.19 2020/08/14 11:05:00 tnn Exp $ +# $NetBSD: cargo.mk,v 1.20 2020/08/14 20:44:16 tnn Exp $ # # Common logic that can be used by packages that depend on cargo crates # from crates.io. This lets existing pkgsrc infrastructure fetch and verify @@ -9,12 +9,9 @@ # # CARGO_CRATE_DEPENDS+= sha1-0.20 # .include "../../lang/rust/cargo.mk" -# do-build: -# cargo build --offline -# # # If modifying the list of dependencies, re-run the build once without -# --offline to generate a new valid Cargo.lock. +# --offline in CARGO_ARGS to generate a new valid Cargo.lock. # # a list of CARGO_CRATE_DEPENDS can be generated via "make show-cargo-depends". # @@ -61,3 +58,14 @@ show-cargo-depends: /^source = / { \ print "CARGO_CRATE_DEPENDS+=\t" name "-" vers; \ }' ${WRKSRC}/Cargo.lock + +DEFAULT_CARGO_ARGS= build --offline --release -j${_MAKE_JOBS_N} +CARGO_ARGS?= ${DEFAULT_CARGO_ARGS} + +.if !target(do-build) +do-build: do-cargo-build +.endif + +.PHONY: do-cargo-build +do-cargo-build: + ${RUN} cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${PREFIX}/bin/cargo ${CARGO_ARGS} |