aboutsummaryrefslogtreecommitdiffstats
path: root/Mk
diff options
context:
space:
mode:
authortobik <tobik@FreeBSD.org>2017-11-29 19:06:11 +0800
committertobik <tobik@FreeBSD.org>2017-11-29 19:06:11 +0800
commit3f08f7484d6473cd150e50713fa5514f6d4bab11 (patch)
treeaf0172ff838846c6e2bb9f9986c030cf55fadd85 /Mk
parent19f64da713b28bf8e9b2cbe9e0d5495e3fa2608e (diff)
downloadfreebsd-ports-gnome-3f08f7484d6473cd150e50713fa5514f6d4bab11.tar.gz
freebsd-ports-gnome-3f08f7484d6473cd150e50713fa5514f6d4bab11.tar.zst
freebsd-ports-gnome-3f08f7484d6473cd150e50713fa5514f6d4bab11.zip
Mk/Uses/cargo.mk: Respect CPUTYPE
C and C++ code can be built targeting newer CPUs if user defined CPUTYPE in make.conf. Let's opt-in for Rust as well. PR: 223939 Submitted by: jbeich
Diffstat (limited to 'Mk')
-rw-r--r--Mk/Uses/cargo.mk7
1 files changed, 7 insertions, 0 deletions
diff --git a/Mk/Uses/cargo.mk b/Mk/Uses/cargo.mk
index 87d1d9b22e69..e3439579639f 100644
--- a/Mk/Uses/cargo.mk
+++ b/Mk/Uses/cargo.mk
@@ -72,6 +72,13 @@ CARGO_ENV+= \
RUSTDOC=${LOCALBASE}/bin/rustdoc \
RUSTFLAGS="${RUSTFLAGS}"
+# Adjust -C target-cpu if -march/-mcpu is set by bsd.cpu.mk
+.if ${ARCH} == amd64 || ${ARCH} == i386
+RUSTFLAGS+= ${CFLAGS:M-march=*:S/-march=/-C target-cpu=/}
+.else
+RUSTFLAGS+= ${CFLAGS:M-mcpu=*:S/-mcpu=/-C target-cpu=/}
+.endif
+
# Helper to shorten cargo calls.
CARGO_CARGO_RUN= \
cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${CARGO_ENV} \