pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/lang/rust rust: Add support for CARGO_WRKSRC.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/04d5eb386576
branches:  trunk
changeset: 459403:04d5eb386576
user:      jperkin <jperkin%pkgsrc.org@localhost>
date:      Wed Oct 06 10:25:32 2021 +0000

description:
rust: Add support for CARGO_WRKSRC.

This defaults to WRKSRC and allows packages that aren't primarily
written in rust, but have a rust component that needs to be built, to
support the correct operation of cargo within their source tree.

diffstat:

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

diffs (43 lines):

diff -r 0199dce2298d -r 04d5eb386576 lang/rust/cargo.mk
--- a/lang/rust/cargo.mk        Wed Oct 06 10:20:24 2021 +0000
+++ b/lang/rust/cargo.mk        Wed Oct 06 10:25:32 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: cargo.mk,v 1.28 2021/10/06 10:20:24 jperkin Exp $
+# $NetBSD: cargo.mk,v 1.29 2021/10/06 10:25:32 jperkin 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
@@ -27,6 +27,7 @@
 
 USE_TOOLS+=            bsdtar
 CARGO_VENDOR_DIR=      ${WRKDIR}/vendor
+CARGO_WRKSRC?=         ${WRKSRC}
 
 DISTFILES?=                    ${DEFAULT_DISTFILES}
 .for crate in ${CARGO_CRATE_DEPENDS}
@@ -46,8 +47,8 @@
 .PHONY: cargo-vendor-crates
 cargo-vendor-crates:
        @${STEP_MSG} "Extracting local cargo crates"
-       ${RUN}${MKDIR} ${WRKSRC}/.cargo
-       ${RUN}${PRINTF} "[source.crates-io]\nreplace-with = \"vendored-sources\"\n[source.vendored-sources]\ndirectory = \"${CARGO_VENDOR_DIR}\"\n" > ${WRKSRC}/.cargo/config
+       ${RUN}${MKDIR} ${CARGO_WRKSRC}/.cargo
+       ${RUN}${PRINTF} "[source.crates-io]\nreplace-with = \"vendored-sources\"\n[source.vendored-sources]\ndirectory = \"${CARGO_VENDOR_DIR}\"\n" > ${CARGO_WRKSRC}/.cargo/config
        ${RUN}${MKDIR} ${CARGO_VENDOR_DIR}
 .for crate in ${CARGO_CRATE_DEPENDS}
        ${RUN}${PRINTF} '{"package":"%s","files":{}}'   \
@@ -66,7 +67,7 @@
                /^version = / { split($$3, a, "\""); vers=a[2]; }       \
                /^source = / {                                          \
                        print "CARGO_CRATE_DEPENDS+=\t" name "-" vers;  \
-                       }' ${WRKSRC}/Cargo.lock
+                       }' ${CARGO_WRKSRC}/Cargo.lock
 
 DEFAULT_CARGO_ARGS=    build --offline --release -j${_MAKE_JOBS_N}     \
                          ${CARGO_NO_DEFAULT_FEATURES:M[yY][eE][sS]:C/[yY][eE][sS]/--no-default-features/}      \
@@ -82,4 +83,4 @@
 
 .PHONY: do-cargo-build
 do-cargo-build:
-       ${RUN} cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${PREFIX}/bin/cargo ${CARGO_ARGS}
+       ${RUN} cd ${CARGO_WRKSRC} && ${SETENV} ${MAKE_ENV} ${PREFIX}/bin/cargo ${CARGO_ARGS}



Home | Main Index | Thread Index | Old Index