commit:     80b87c3abb4124fb1699878443001880c15b1002
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 26 13:03:11 2021 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Tue Jan 26 13:03:21 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=80b87c3a

www-client/seamonkey: Added "lto" USE flag

Package-Manager: Portage-3.0.14, Repoman-3.0.2
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 www-client/seamonkey/metadata.xml            |  1 +
 www-client/seamonkey/seamonkey-2.53.6.ebuild | 35 ++++++++++++++++++++++++----
 2 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/www-client/seamonkey/metadata.xml 
b/www-client/seamonkey/metadata.xml
index 1d714b2e631..e527e43b5c4 100644
--- a/www-client/seamonkey/metadata.xml
+++ b/www-client/seamonkey/metadata.xml
@@ -15,6 +15,7 @@
                <flag name="custom-optimization">Build with user-specified 
compiler optimizations (-Os, -O0, -O1, -O2, -O3) from CFLAGS 
(unsupported)</flag>
                <flag name="gmp-autoupdate">Allow Gecko Media Plugins (binary 
blobs) to be automatically downloaded and kept up-to-date in user 
profiles</flag>
                <flag name="ipc">Use inter-process communication between tabs 
and plugins. Allows for greater stability in case of plugin crashes</flag>
+               <flag name="lto">Enable Link Time Optimization (LTO). Requires 
Gold linker</flag>
                <flag name="roaming">Build roaming extension support (default 
on)</flag>
                <flag name="system-av1">Use the system-wide 
<pkg>media-libs/dav1d</pkg> and <pkg>media-libs/libaom</pkg> library instead of 
bundled</flag>
                <!-- flag name="system-cairo">Use the system-wide 
<pkg>x11-libs/cairo</pkg> instead of bundled</flag -->

diff --git a/www-client/seamonkey/seamonkey-2.53.6.ebuild 
b/www-client/seamonkey/seamonkey-2.53.6.ebuild
index f2fc86ef1b5..f6e913d6d04 100644
--- a/www-client/seamonkey/seamonkey-2.53.6.ebuild
+++ b/www-client/seamonkey/seamonkey-2.53.6.ebuild
@@ -44,7 +44,7 @@ KEYWORDS="~amd64 ~ppc64 ~x86"
 SLOT="0"
 LICENSE="MPL-2.0 GPL-2 LGPL-2.1"
 SYSTEM_IUSE=( +system-{av1,harfbuzz,icu,jpeg,libevent,libvpx,sqlite} )
-IUSE="+chatzilla +crypt dbus debug +gmp-autoupdate +ipc jack minimal
+IUSE="+chatzilla +crypt dbus debug +gmp-autoupdate +ipc jack lto minimal
 neon pulseaudio +roaming selinux startup-notification ${SYSTEM_IUSE[@]} test
 wifi"
 RESTRICT="!test? ( test )"
@@ -138,6 +138,7 @@ RDEPEND="
        selinux? ( sec-policy/selinux-mozilla )
 "
 DEPEND+="${CDEPEND}
+       lto? ( sys-devel/binutils[gold] )
        amd64? ( virtual/opengl )
        x86? ( virtual/opengl )
 "
@@ -162,7 +163,17 @@ pkg_setup() {
 
 pkg_pretend() {
        # Ensure we have enough disk space to compile
-       if use debug || use test ; then
+       if use debug || use lto || use test ; then
+               CHECKREQS_DISK_BUILD="16G"
+       else
+               CHECKREQS_DISK_BUILD="12G"
+       fi
+       check-reqs_pkg_setup
+}
+
+spkg_setup() {
+       # Ensure we have enough disk space to compile
+       if use debug || use lto || use test ; then
                CHECKREQS_DISK_BUILD="16G"
        else
                CHECKREQS_DISK_BUILD="12G"
@@ -236,11 +247,11 @@ src_configure() {
        # get your own set of keys.
        _google_api_key=AIzaSyDEAOvatFo0eTgsV_ZlEzx0ObmepsMzfAc
 
-       ####################################
+       ######################################
        #
        # mozconfig, CFLAGS and CXXFLAGS setup
        #
-       ####################################
+       ######################################
 
        mozconfig_init
 
@@ -351,6 +362,22 @@ src_configure() {
                                media/libvpx/moz.build || die
                fi
        fi
+
+       if use lto ; then
+               # Linking only works when using ld.gold when LTO is enabled
+               mozconfig_add_options_ac "forcing ld=gold due to USE=lto" 
--enable-linker=gold
+               # ThinLTO is currently broken, see bmo#1644409
+               mozconfig_add_options_ac '+lto' --enable-lto=full
+       else
+               if tc-ld-is-gold ; then
+                       mozconfig_add_options_ac "linker is set to gold" 
--enable-linker=gold
+               else
+                       mozconfig_add_options_ac "linker is set to bfd" 
--enable-linker=bfd
+               fi
+       fi
+       # LTO flag was handled via configure
+       filter-flags '-flto*'
+
        ##################################
        # Former mozconfig_config() end  #
        ##################################

Reply via email to