[packages/thunderbird] change rust's lto only where it's used

atler atler at pld-linux.org
Sun Oct 19 02:27:27 CEST 2025


commit be04dfc1b1d8502bc8166ad19f5805b690eac31b
Author: Jan Palus <atler at pld-linux.org>
Date:   Sun Oct 19 02:25:57 2025 +0200

    change rust's lto only where it's used

 custom-rust-lto.patch | 11 +++++++++++
 thunderbird.spec      | 15 ++++++++++-----
 2 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/thunderbird.spec b/thunderbird.spec
index 453dbda..b28e6d2 100644
--- a/thunderbird.spec
+++ b/thunderbird.spec
@@ -198,6 +198,7 @@ Source164:	https://releases.mozilla.org/pub/thunderbird/releases/%{version}/linu
 Source165:	https://releases.mozilla.org/pub/thunderbird/releases/%{version}/linux-x86_64/xpi/zh-TW.xpi
 # Source165-md5:	ecc0e268a7430bd8017496de045e75a9
 Patch0:		prefs.patch
+Patch1:		custom-rust-lto.patch
 Patch2:		enable-addons.patch
 Patch3:		glibc-2.34.patch
 Patch4:		system-av1-link.patch
@@ -1381,6 +1382,7 @@ for s in %sources; do
 done
 
 %patch -P0 -p1
+%patch -P1 -p1
 %patch -P2 -p0
 %patch -P3 -p1
 %patch -P4 -p1
@@ -1419,11 +1421,6 @@ export MOZ_DEBUG_FLAGS=" "
 export LLVM_USE_SPLIT_DWARF=1
 export LLVM_PARALLEL_LINK_JOBS=1
 export MOZ_LINK_FLAGS="-Wl,--no-keep-memory -Wl,--reduce-memory-overheads"
-export RUSTFLAGS="$RUSTFLAGS -Clto=thin"
-%endif
-
-%if %{with lowmem2}
-export RUSTFLAGS="$RUSTFLAGS -Clto=no"
 %endif
 
 %if %{with crashreporter}
@@ -1503,6 +1500,14 @@ export MOZ_PARALLEL_BUILD
 %{?__jobs:export MOZ_PARALLEL_BUILD="%__jobs"}
 %endif
 
+%if %{with lowmem}
+export RUST_LTO="thin"
+%endif
+
+%if %{with lowmem2}
+export RUST_LTO="none"
+%endif
+
 export MOZBUILD_STATE_PATH="$(pwd)/.mozbuild"
 export MACH_SYSTEM_ASSERTED_COMPATIBLE_WITH_BUILD_SITE=1
 export MACH_SYSTEM_ASSERTED_COMPATIBLE_WITH_MACH_SITE=1
diff --git a/custom-rust-lto.patch b/custom-rust-lto.patch
new file mode 100644
index 0000000..df9d91b
--- /dev/null
+++ b/custom-rust-lto.patch
@@ -0,0 +1,11 @@
+--- thunderbird-144.0/config/makefiles/rust.mk.orig	2025-10-10 21:53:14.000000000 +0200
++++ thunderbird-144.0/config/makefiles/rust.mk	2025-10-19 02:21:26.649027973 +0200
+@@ -101,7 +101,7 @@
+ # Never enable when coverage is enabled to work around https://github.com/rust-lang/rust/issues/90045.
+ ifndef MOZ_CODE_COVERAGE
+ ifeq (,$(findstring gkrust_gtest,$(RUST_LIBRARY_FILE)))
+-cargo_rustc_flags += -Clto$(if $(filter full,$(MOZ_LTO_RUST_CROSS)),=fat)
++cargo_rustc_flags += -Clto$(if $(RUST_LTO),=$(RUST_LTO),$(if $(filter full,$(MOZ_LTO_RUST_CROSS)),=fat))
+ endif
+ # We need -Cembed-bitcode=yes for all crates when using -Clto.
+ RUSTFLAGS += -Cembed-bitcode=yes
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/thunderbird.git/commitdiff/be04dfc1b1d8502bc8166ad19f5805b690eac31b



More information about the pld-cvs-commit mailing list