Page MenuHomeFreeBSD

D36736.id111039.diff
No OneTemporary

D36736.id111039.diff

diff --git a/Mk/Uses/cargo.mk b/Mk/Uses/cargo.mk
--- a/Mk/Uses/cargo.mk
+++ b/Mk/Uses/cargo.mk
@@ -3,16 +3,24 @@
#
# Feature: cargo
# Usage: USES=cargo
-# Valid ARGS: none
+# Valid ARGS: noopt
+# ARGS description:
+# noopt do not apply additional optimization to
+# increase performance and decrease binary size
#
# MAINTAINER: rust@FreeBSD.org
.if !defined(_INCLUDE_USES_CARGO_MK)
_INCLUDE_USES_CARGO_MK= yes
-. if !empty(cargo_ARGS)
-IGNORE+= USES=cargo takes no arguments
-. endif
+_valid_ARGS= noopt
+
+# Sanity check
+. for arg in ${cargo_ARGS}
+. if empty(_valid_ARGS:M${arg})
+IGNORE= Incorrect 'USES+= cargo:${cargo_ARGS}' usage: argument [${arg}] is not recognized
+. endif
+. endfor
.sinclude "${MASTERDIR}/Makefile.crates"
@@ -139,6 +147,11 @@
CARGO_ENV+= RUST_BACKTRACE=1
. endif
+. if empty(cargo_ARGS:Mnoopt)
+_CARGO_MSG= "===> Additional optimization to port applied"
+WITH_LTO= yes
+. endif
+
# 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=/}
@@ -295,6 +308,9 @@
# Check that the running kernel has COMPAT_FREEBSD11 required by lang/rust post-ino64
@${SETENV} CC="${CC}" OPSYS="${OPSYS}" OSVERSION="${OSVERSION}" WRKDIR="${WRKDIR}" \
${SH} ${SCRIPTSDIR}/rust-compat11-canary.sh
+. if defined(_CARGO_MSG)
+ @${ECHO_MSG} ${_CARGO_MSG}
+. endif
@${ECHO_MSG} "===> Cargo config:"
@${MKDIR} ${WRKDIR}/.cargo
@: > ${WRKDIR}/.cargo/config.toml

File Metadata

Mime Type
text/plain
Expires
Fri, Jun 26, 12:26 AM (14 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34334141
Default Alt Text
D36736.id111039.diff (1 KB)

Event Timeline