git: 93924a20b38e - main - Uses/cargo: respect CC when --target is passed
Tobias Kortkamp
tobik at FreeBSD.org
Sun Sep 19 09:16:01 UTC 2021
The branch main has been updated by tobik:
URL: https://cgit.FreeBSD.org/ports/commit/?id=93924a20b38e7856dc1a0df0c4514eaecdb624be
commit 93924a20b38e7856dc1a0df0c4514eaecdb624be
Author: Jan Beich <jbeich at FreeBSD.org>
AuthorDate: 2021-09-07 09:14:10 +0000
Commit: Tobias Kortkamp <tobik at FreeBSD.org>
CommitDate: 2021-09-19 09:03:22 +0000
Uses/cargo: respect CC when --target is passed
devel/cargo-c always passes --target when building consumers.
Some other USES=cargo consumers may also pass --target.
Differential Revision: https://reviews.freebsd.org/D31568
---
Mk/Uses/cargo.mk | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Mk/Uses/cargo.mk b/Mk/Uses/cargo.mk
index 987818215665..2e361f771716 100644
--- a/Mk/Uses/cargo.mk
+++ b/Mk/Uses/cargo.mk
@@ -69,6 +69,9 @@ CARGO_CARGO_BIN?= ${LOCALBASE}/bin/cargo
# Location of the cargo output directory.
CARGO_TARGET_DIR?= ${WRKDIR}/target
+# Default target platform (affects some RUSTFLAGS if passed)
+CARGO_BUILD_TARGET?= ${ARCH:S/amd64/x86_64/:S/i386/i686/}-unknown-${OPSYS:tl}
+
# Environment for cargo
# - CARGO_HOME: local cache of the registry index
# - CARGO_BUILD_JOBS: configure number of jobs to run
@@ -80,11 +83,13 @@ CARGO_TARGET_DIR?= ${WRKDIR}/target
CARGO_ENV+= \
CARGO_HOME=${WRKDIR}/cargo-home \
CARGO_BUILD_JOBS=${MAKE_JOBS_NUMBER} \
+ CARGO_BUILD_TARGET=${CARGO_BUILD_TARGET} \
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 \
- RUSTFLAGS="${RUSTFLAGS} -C linker=${CC:Q} ${LDFLAGS:C/.+/-C link-arg=&/}"
+ RUSTFLAGS="${RUSTFLAGS} ${LDFLAGS:C/.+/-C link-arg=&/}"
# Adjust -C target-cpu if -march/-mcpu is set by bsd.cpu.mk
.if ${ARCH} == amd64 || ${ARCH} == i386
More information about the dev-commits-ports-all
mailing list