aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Kortkamp <tobik@FreeBSD.org>2021-11-07 14:08:57 +0000
committerTobias Kortkamp <tobik@FreeBSD.org>2021-11-07 15:24:13 +0000
commitd2eb03d1c0d343b2fe350b9079f6c54dfcfbaa1f (patch)
tree4a8c1109f4d3690110fc23905567e2005832898a
parentbe828d031061793975e0773c2219e22fe5e088d8 (diff)
downloadports-d2eb03d1c0d343b2fe350b9079f6c54dfcfbaa1f.tar.gz
ports-d2eb03d1c0d343b2fe350b9079f6c54dfcfbaa1f.zip
Uses/cargo: Make it easier to build ports with out-of-tree toolchain
- CARGO_CARGO_BIN -> CARGO - Add RUSTC and RUSTDOC for overriding rustc and rustdoc
-rw-r--r--Mk/Uses/cargo.mk12
1 files changed, 7 insertions, 5 deletions
diff --git a/Mk/Uses/cargo.mk b/Mk/Uses/cargo.mk
index 76b44f3f2ba3..1da833d29c4f 100644
--- a/Mk/Uses/cargo.mk
+++ b/Mk/Uses/cargo.mk
@@ -100,8 +100,10 @@ CARGO_BUILDDEP?= yes
BUILD_DEPENDS+= ${RUST_DEFAULT}>=1.56.0:lang/${RUST_DEFAULT}
.endif
-# Location of cargo binary (default to lang/rust's Cargo binary)
-CARGO_CARGO_BIN?= ${LOCALBASE}/bin/cargo
+# Location of toolchain (default to lang/rust's toolchain)
+CARGO?= ${LOCALBASE}/bin/cargo
+RUSTC?= ${LOCALBASE}/bin/rustc
+RUSTDOC?= ${LOCALBASE}/bin/rustdoc
# Location of the cargo output directory.
CARGO_TARGET_DIR?= ${WRKDIR}/target
@@ -124,8 +126,8 @@ CARGO_ENV+= \
CARGO_TARGET_DIR=${CARGO_TARGET_DIR} \
CARGO_TARGET_${CARGO_BUILD_TARGET:S/-/_/g:tu}_LINKER="${CC}" \
RUST_BACKTRACE=1 \
- RUSTC=${LOCALBASE}/bin/rustc \
- RUSTDOC=${LOCALBASE}/bin/rustdoc \
+ RUSTC=${RUSTC} \
+ RUSTDOC=${RUSTDOC} \
RUSTFLAGS="${RUSTFLAGS} ${LDFLAGS:C/.+/-C link-arg=&/}"
# Adjust -C target-cpu if -march/-mcpu is set by bsd.cpu.mk
@@ -143,7 +145,7 @@ STRIP_CMD= ${LOCALBASE}/bin/strip # unsupported e_type with base strip
.endif
# Helper to shorten cargo calls.
-_CARGO_RUN= ${SETENV} ${MAKE_ENV} ${CARGO_ENV} ${CARGO_CARGO_BIN}
+_CARGO_RUN= ${SETENV} ${MAKE_ENV} ${CARGO_ENV} ${CARGO}
CARGO_CARGO_RUN= cd ${WRKSRC}; ${SETENV} CARGO_FREEBSD_PORTS_SKIP_GIT_UPDATE=1 ${_CARGO_RUN}
# User arguments for cargo targets.