pkgsrc-Changes archive

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

CVS commit: pkgsrc/lang/rust



Module Name:    pkgsrc
Committed By:   tnn
Date:           Fri Aug 14 20:44:16 UTC 2020

Modified Files:
        pkgsrc/lang/rust: cargo.mk

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


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 pkgsrc/lang/rust/cargo.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/lang/rust/cargo.mk
diff -u pkgsrc/lang/rust/cargo.mk:1.19 pkgsrc/lang/rust/cargo.mk:1.20
--- pkgsrc/lang/rust/cargo.mk:1.19      Fri Aug 14 11:05:00 2020
+++ pkgsrc/lang/rust/cargo.mk   Fri Aug 14 20:44:16 2020
@@ -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}



Home | Main Index | Thread Index | Old Index