[Bug 277902] Mk/Uses/cargo.mk: WITH_LTO no longer applies

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 23 Mar 2024 12:51:12 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277902

--- Comment #4 from Gleb Popov <arrowd@FreeBSD.org> ---
What I'm suggesting is

diff --git a/Mk/Features/lto.mk b/Mk/Features/lto.mk
index 3fef5a223e9c..3fbff00d5f5e 100644
--- a/Mk/Features/lto.mk
+++ b/Mk/Features/lto.mk
@@ -10,17 +10,17 @@ LTO_Include_MAINTAINER=     pkubaj@FreeBSD.org
 .  if !defined(LTO_UNSAFE) || defined(LTO_DISABLE_CHECK)
 .    if "${ARCH}" == "riscv64" && !defined(LTO_DISABLE_CHECK)
        DEV_WARNING+=   "LTO is currently broken on riscv64, to override set
LTO_DISABLE_CHECK=yes"
-.    elif defined(_INCLUDE_USES_CARGO_MK)
-   CARGO_ENV+= CARGO_PROFILE_RELEASE_LTO="true" \
+.    else
+   CARGO_LTO_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
-.    elif defined(_INCLUDE_USES_CABAL_MK)
+
+   MESON_LTO_ARGS=     -Db_lto=true
+
    CABAL_LTO_ARGS=     --ghc-options=-split-sections \
                        --gcc-options="-fdata-sections -ffunction-sections" \
                        --ld-options=-Wl,--gc-sections,--build-id,--icf=all
-.    else
+
 # Overridable as a user may want to use -flto
    LTO_FLAGS?= -flto=thin
    CFLAGS+=    ${LTO_FLAGS}


and then use CARGO_LTO_ENV in Uses/cargo.mk

-- 
You are receiving this mail because:
You are on the CC list for the bug.