commit:     f9e9a8666cd4b64a01bf3f6dcf585e8c4e1dec14
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 21 23:24:25 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Nov 21 23:27:36 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f9e9a866

app-office/libreoffice: Brute-force compiler settings (clang/gcc)

Bug: https://bugs.gentoo.org/739134
Package-Manager: Portage-3.0.9, Repoman-3.0.2
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 app-office/libreoffice/libreoffice-7.0.3.1.ebuild  | 26 +++++++++-------------
 app-office/libreoffice/libreoffice-7.0.9999.ebuild | 26 +++++++++-------------
 app-office/libreoffice/libreoffice-9999.ebuild     | 26 +++++++++-------------
 3 files changed, 30 insertions(+), 48 deletions(-)

diff --git a/app-office/libreoffice/libreoffice-7.0.3.1.ebuild 
b/app-office/libreoffice/libreoffice-7.0.3.1.ebuild
index 695c9c5f0f6..e561517b8f5 100644
--- a/app-office/libreoffice/libreoffice-7.0.3.1.ebuild
+++ b/app-office/libreoffice/libreoffice-7.0.3.1.ebuild
@@ -393,41 +393,35 @@ src_configure() {
        local google_default_client_secret="vgKG0NNv7GoDpbtoFNLxCUXu"
 
        # Show flags set at the beginning
-       einfo "Current CFLAGS:    ${CFLAGS}"
-       einfo "Current LDFLAGS:   ${LDFLAGS}"
+       einfo "Preset CFLAGS:    ${CFLAGS}"
+       einfo "Preset LDFLAGS:   ${LDFLAGS}"
 
-       local have_switched_compiler=
-       if use clang && ! tc-is-clang ; then
+       if use clang ; then
                # Force clang
                einfo "Enforcing the use of clang due to USE=clang ..."
-               have_switched_compiler=yes
                AR=llvm-ar
                CC=${CHOST}-clang
                CXX=${CHOST}-clang++
                NM=llvm-nm
                RANLIB=llvm-ranlib
-       elif ! use clang && ! tc-is-gcc ; then
+               LDFLAGS+=" -fuse-ld=lld"
+               strip-unsupported-flags
+       else
                # Force gcc
-               have_switched_compiler=yes
                einfo "Enforcing the use of gcc due to USE=-clang ..."
                AR=gcc-ar
                CC=${CHOST}-gcc
                CXX=${CHOST}-g++
                NM=gcc-nm
                RANLIB=gcc-ranlib
+               strip-unsupported-flags
        fi
        export CLANG_CC=${CC}
        export CLANG_CXX=${CXX}
 
-       if [[ -n "${have_switched_compiler}" ]] ; then
-               # Because we switched active compiler we have to ensure
-               # that no unsupported flags are set
-               strip-unsupported-flags
-       fi
-
-       # Show flags set at the beginning
-       einfo "   Used CFLAGS:    ${CFLAGS}"
-       einfo "   Used LDFLAGS:   ${LDFLAGS}"
+       # Show flags set at the end
+       einfo "  Used CFLAGS:    ${CFLAGS}"
+       einfo "  Used LDFLAGS:   ${LDFLAGS}"
 
        # Ensure we use correct toolchain
        tc-export CC CXX LD AR NM OBJDUMP RANLIB PKG_CONFIG

diff --git a/app-office/libreoffice/libreoffice-7.0.9999.ebuild 
b/app-office/libreoffice/libreoffice-7.0.9999.ebuild
index b10bdb491e5..223d653facc 100644
--- a/app-office/libreoffice/libreoffice-7.0.9999.ebuild
+++ b/app-office/libreoffice/libreoffice-7.0.9999.ebuild
@@ -389,41 +389,35 @@ src_configure() {
        local google_default_client_secret="vgKG0NNv7GoDpbtoFNLxCUXu"
 
        # Show flags set at the beginning
-       einfo "Current CFLAGS:    ${CFLAGS}"
-       einfo "Current LDFLAGS:   ${LDFLAGS}"
+       einfo "Preset CFLAGS:    ${CFLAGS}"
+       einfo "Preset LDFLAGS:   ${LDFLAGS}"
 
-       local have_switched_compiler=
-       if use clang && ! tc-is-clang ; then
+       if use clang ; then
                # Force clang
                einfo "Enforcing the use of clang due to USE=clang ..."
-               have_switched_compiler=yes
                AR=llvm-ar
                CC=${CHOST}-clang
                CXX=${CHOST}-clang++
                NM=llvm-nm
                RANLIB=llvm-ranlib
-       elif ! use clang && ! tc-is-gcc ; then
+               LDFLAGS+=" -fuse-ld=lld"
+               strip-unsupported-flags
+       else
                # Force gcc
-               have_switched_compiler=yes
                einfo "Enforcing the use of gcc due to USE=-clang ..."
                AR=gcc-ar
                CC=${CHOST}-gcc
                CXX=${CHOST}-g++
                NM=gcc-nm
                RANLIB=gcc-ranlib
+               strip-unsupported-flags
        fi
        export CLANG_CC=${CC}
        export CLANG_CXX=${CXX}
 
-       if [[ -n "${have_switched_compiler}" ]] ; then
-               # Because we switched active compiler we have to ensure
-               # that no unsupported flags are set
-               strip-unsupported-flags
-       fi
-
-       # Show flags set at the beginning
-       einfo "   Used CFLAGS:    ${CFLAGS}"
-       einfo "   Used LDFLAGS:   ${LDFLAGS}"
+       # Show flags set at the end
+       einfo "  Used CFLAGS:    ${CFLAGS}"
+       einfo "  Used LDFLAGS:   ${LDFLAGS}"
 
        # Ensure we use correct toolchain
        tc-export CC CXX LD AR NM OBJDUMP RANLIB PKG_CONFIG

diff --git a/app-office/libreoffice/libreoffice-9999.ebuild 
b/app-office/libreoffice/libreoffice-9999.ebuild
index 0bc93233961..67ba6c45bbe 100644
--- a/app-office/libreoffice/libreoffice-9999.ebuild
+++ b/app-office/libreoffice/libreoffice-9999.ebuild
@@ -389,41 +389,35 @@ src_configure() {
        local google_default_client_secret="vgKG0NNv7GoDpbtoFNLxCUXu"
 
        # Show flags set at the beginning
-       einfo "Current CFLAGS:    ${CFLAGS}"
-       einfo "Current LDFLAGS:   ${LDFLAGS}"
+       einfo "Preset CFLAGS:    ${CFLAGS}"
+       einfo "Preset LDFLAGS:   ${LDFLAGS}"
 
-       local have_switched_compiler=
-       if use clang && ! tc-is-clang ; then
+       if use clang ; then
                # Force clang
                einfo "Enforcing the use of clang due to USE=clang ..."
-               have_switched_compiler=yes
                AR=llvm-ar
                CC=${CHOST}-clang
                CXX=${CHOST}-clang++
                NM=llvm-nm
                RANLIB=llvm-ranlib
-       elif ! use clang && ! tc-is-gcc ; then
+               LDFLAGS+=" -fuse-ld=lld"
+               strip-unsupported-flags
+       else
                # Force gcc
-               have_switched_compiler=yes
                einfo "Enforcing the use of gcc due to USE=-clang ..."
                AR=gcc-ar
                CC=${CHOST}-gcc
                CXX=${CHOST}-g++
                NM=gcc-nm
                RANLIB=gcc-ranlib
+               strip-unsupported-flags
        fi
        export LO_CLANG_CC=${CC}
        export LO_CLANG_CXX=${CXX}
 
-       if [[ -n "${have_switched_compiler}" ]] ; then
-               # Because we switched active compiler we have to ensure
-               # that no unsupported flags are set
-               strip-unsupported-flags
-       fi
-
-       # Show flags set at the beginning
-       einfo "   Used CFLAGS:    ${CFLAGS}"
-       einfo "   Used LDFLAGS:   ${LDFLAGS}"
+       # Show flags set at the end
+       einfo "  Used CFLAGS:    ${CFLAGS}"
+       einfo "  Used LDFLAGS:   ${LDFLAGS}"
 
        # Ensure we use correct toolchain
        tc-export CC CXX LD AR NM OBJDUMP RANLIB PKG_CONFIG

Reply via email to