commit:     8ab45caf651ff9ad2c40e4784ad65cb8eabf1ccb
Author:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 27 08:05:30 2020 +0000
Commit:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Tue Oct 27 08:15:31 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8ab45caf

net-im/telegram-desktop: add lto useflag (WARNING: insane build times)

tested on both gcc and clang.

Package-Manager: Portage-3.0.8, Repoman-3.0.2
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>

 net-im/telegram-desktop/metadata.xml                  |  1 +
 net-im/telegram-desktop/telegram-desktop-2.4.4.ebuild | 10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/net-im/telegram-desktop/metadata.xml 
b/net-im/telegram-desktop/metadata.xml
index 3483ee3eee6..4e1022a426d 100644
--- a/net-im/telegram-desktop/metadata.xml
+++ b/net-im/telegram-desktop/metadata.xml
@@ -8,6 +8,7 @@
        <use>
                <flag name="enchant">Enable the app-text/aspell spell-checking 
backend</flag>
                <flag name="hunspell">Enable the app-text/hunspell 
spell-checking backend</flag>
+               <flag name="lto">Enable Link Time Optimization (LTO / 
IPO)</flag>
                <flag name="webrtc">WebRTC based video call support</flag>
        </use>
 </pkgmetadata>

diff --git a/net-im/telegram-desktop/telegram-desktop-2.4.4.ebuild 
b/net-im/telegram-desktop/telegram-desktop-2.4.4.ebuild
index 09b08748d2d..d5937adb078 100644
--- a/net-im/telegram-desktop/telegram-desktop-2.4.4.ebuild
+++ b/net-im/telegram-desktop/telegram-desktop-2.4.4.ebuild
@@ -22,7 +22,7 @@ 
SRC_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v${PV}/${
 LICENSE="GPL-3-with-openssl-exception LGPL-2+ webrtc? ( BSD )"
 SLOT="0"
 KEYWORDS="~amd64 ~ppc64"
-IUSE="+alsa +dbus enchant +gtk +hunspell libressl +pulseaudio +spell +webrtc 
+X"
+IUSE="+alsa +dbus enchant +gtk +hunspell libressl lto +pulseaudio +spell 
+webrtc +X"
 
 RDEPEND="
        !net-im/telegram-desktop-bin
@@ -104,7 +104,11 @@ build_tg_owt() {
        einfo "Building tg_owt / webrtc"
        mkdir -v "${WORKDIR}/tg_owt_build" || die
        pushd "${WORKDIR}/tg_owt_build" > /dev/null || die
-       cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DTG_OWT_PACKAGED_BUILD=ON 
../tg_owt || die
+       cmake -G Ninja \
+               -DCMAKE_BUILD_TYPE=Release \
+               -DTG_OWT_PACKAGED_BUILD=ON \
+               $(usex lto "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON" '') \
+               ../tg_owt || die
        eninja
        popd > /dev/null || die
 }
@@ -114,6 +118,7 @@ src_configure() {
                -Wno-deprecated-declarations
                -Wno-error=deprecated-declarations
                -Wno-switch
+               -Wno-unknown-warning-option
        )
 
        append-cxxflags "${mycxxflags[@]}"
@@ -138,6 +143,7 @@ src_configure() {
                -DDESKTOP_APP_DISABLE_SPELLCHECK="$(usex spell OFF ON)" # 
enables hunspell (recommended)
                -DDESKTOP_APP_DISABLE_WEBRTC_INTEGRATION="$(usex webrtc OFF 
ON)" # requires pulse AND alsa
                -DDESKTOP_APP_USE_ENCHANT="$(usex enchant ON OFF)" # enables 
enchant and disables hunspell
+               $(usex lto "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON" '')
                $(usex webrtc "-Dtg_owt_DIR=${WORKDIR}/tg_owt_build" '')
        )
 

Reply via email to