Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/lang/rust rust/cargo.mk: add a default do-build target...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/fdf9505f4dcc
branches:  trunk
changeset: 437032:fdf9505f4dcc
user:      tnn <tnn%pkgsrc.org@localhost>
date:      Fri Aug 14 20:44:16 2020 +0000

description:
rust/cargo.mk: add a default do-build target to reduce copypasta

diffstat:

 lang/rust/cargo.mk |  18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diffs (38 lines):

diff -r a4cb3dc325fb -r fdf9505f4dcc lang/rust/cargo.mk
--- a/lang/rust/cargo.mk        Fri Aug 14 20:10:03 2020 +0000
+++ b/lang/rust/cargo.mk        Fri Aug 14 20:44:16 2020 +0000
@@ -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 @@
                /^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}



Home | Main Index | Thread Index | Old Index