git: 83a19a60d13f - main - Mk/Features/lto.mk: Use Cargo and Meson toggles
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 26 Sep 2022 21:58:35 UTC
The branch main has been updated by diizzy:
URL: https://cgit.FreeBSD.org/ports/commit/?id=83a19a60d13fee8dc2f86ee5f4d48208fd6cabab
commit 83a19a60d13fee8dc2f86ee5f4d48208fd6cabab
Author: Daniel Engberg <diizzy@FreeBSD.org>
AuthorDate: 2022-09-26 21:56:46 +0000
Commit: Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2022-09-26 21:57:18 +0000
Mk/Features/lto.mk: Use Cargo and Meson toggles
Use corresponding toggles for each build framework to enable LTO
Reviewed by: pkubaj (maintainer)
Differential Revision: https://reviews.freebsd.org/D36696
---
Mk/Features/lto.mk | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/Mk/Features/lto.mk b/Mk/Features/lto.mk
index 9d38448f312c..75935b52ca89 100644
--- a/Mk/Features/lto.mk
+++ b/Mk/Features/lto.mk
@@ -8,10 +8,18 @@ _LTO_MK_INCLUDED= yes
LTO_Include_MAINTAINER= pkubaj@FreeBSD.org
. if !defined(LTO_UNSAFE)
+. if defined(_INCLUDE_USES_CARGO_MK)
+ CARGO_ENV+= CARGO_PROFILE_RELEASE_LTO="true" \
+ CARGO_PROFILE_RELEASE_PANIC="abort" \
+ CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1
+. elif defined(_INCLUDE_USES_MESON_MK)
+ MESON_ARGS+= -Db_lto=true
+. else
# Overridable as a user may want to use -flto
-LTO_FLAGS?= -flto=thin
-CFLAGS+= ${LTO_FLAGS}
-CXXFLAGS+= ${LTO_FLAGS}
-LDFLAGS+= ${LTO_FLAGS}
+ LTO_FLAGS?= -flto=thin
+ CFLAGS+= ${LTO_FLAGS}
+ CXXFLAGS+= ${LTO_FLAGS}
+ LDFLAGS+= ${LTO_FLAGS}
+. endif
. endif
.endif