diff --git a/gjs.spec b/gjs.spec index eb0df28..95a4a32 100644 --- a/gjs.spec +++ b/gjs.spec @@ -8,6 +8,21 @@ %global mozjs_major 115 %global mozjs_version 115.7.0 +# LTO - Enable in Release builds, but consider disabling for development as it increases compile time +%global mozjs_build_with_lto 1 + +%if 0%{?mozjs_build_with_lto} +# LTO is the default +%else +%define _lto_cflags %{nil} +%endif + +# Disable LTO on aarch64 (borked since GCC14) +# https://bugzilla.redhat.com/show_bug.cgi?id=2260867 +%ifarch aarch64 +%define _lto_cflags %{nil} +%endif + # Big endian platforms %ifarch ppc ppc64 s390 s390x %global big_endian 1 @@ -198,8 +213,10 @@ export CXX=g++ # https://github.com/japaric/cargo-call-stack/issues/25 export RUSTFLAGS="-C embed-bitcode" +%if 0%{?mozjs_build_with_lto} # https://github.com/ptomato/mozjs/commit/36bb7982b41e0ef9a65f7174252ab996cd6777bd export CARGO_PROFILE_RELEASE_LTO=true +%endif export LINKFLAGS="%{?__global_ldflags}" export PYTHON="%{__python3}"