Skip to content

Commit bf0af79

Browse files
committed
lang/rust: add LTO option
1 parent 8926cc5 commit bf0af79

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎lang/rust/Makefile‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ CONFLICTS_INSTALL?= rust-nightly
4848
# ?= to allow users to still overwrite it in make.conf.
4949
TMPDIR?= ${WRKDIR}
5050

51-
OPTIONS_DEFINE= DOCS GDB SOURCES WASM
51+
OPTIONS_DEFINE= DOCS GDB LTO SOURCES WASM
5252
OPTIONS_DEFAULT= SOURCES WASM
5353

5454
GDB_DESC= Install ports gdb (necessary for debugging rust programs)
@@ -191,7 +191,13 @@ do-configure:
191191
@${ECHO_CMD} 'deny-warnings=false' >> ${WRKSRC}/config.toml
192192
@${ECHO_CMD} 'verbose-tests=true' >> ${WRKSRC}/config.toml
193193
@${ECHO_CMD} 'lld=${_RUST_BUILD_WASM}' >> ${WRKSRC}/config.toml
194+
.if ${PORT_OPTIONS:MLTO}
195+
@${ECHO_CMD} 'lto="thin"' >> ${WRKSRC}/config.toml
196+
.endif
194197
@${ECHO_CMD} '[llvm]' >> ${WRKSRC}/config.toml
198+
.if ${PORT_OPTIONS:MLTO}
199+
@${ECHO_CMD} 'thin-lto=true' >> ${WRKSRC}/config.toml
200+
.endif
195201
.if defined(WITH_CCACHE_BUILD) && !defined(NO_CCACHE)
196202
@${ECHO_CMD} 'ccache="${CCACHE_BIN}"' >> ${WRKSRC}/config.toml
197203
.else

0 commit comments

Comments
 (0)