commit:     b46e329dd9ccf01cfdd722f38db341ead34ac418
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 27 14:51:52 2018 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Thu Sep 27 16:19:09 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b46e329d

mozconfig-v6.60.eclass: add USE=clang

See commit 59c9e92b639712d4c37ece540582db83afdc8608 for details.

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 eclass/mozconfig-v6.60.eclass | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/eclass/mozconfig-v6.60.eclass b/eclass/mozconfig-v6.60.eclass
index c124baef74e..a9b04fd7730 100644
--- a/eclass/mozconfig-v6.60.eclass
+++ b/eclass/mozconfig-v6.60.eclass
@@ -75,7 +75,7 @@ inherit flag-o-matic toolchain-funcs mozcoreconf-v6
 # Set the variable to any value if the use flag should exist but not be 
default-enabled.
 
 # use-flags common among all mozilla ebuilds
-IUSE="${IUSE} dbus debug neon pulseaudio selinux startup-notification 
system-harfbuzz
+IUSE="${IUSE} clang dbus debug neon pulseaudio selinux startup-notification 
system-harfbuzz
  system-icu system-jpeg system-libevent system-sqlite system-libvpx"
 
 # some notes on deps:
@@ -155,6 +155,10 @@ DEPEND="app-arch/zip
        app-arch/unzip
        >=sys-devel/binutils-2.30
        sys-apps/findutils
+       clang? (
+               >=sys-devel/llvm-4.0.1[gold]
+               >=sys-devel/lld-4.0.1
+       )
        pulseaudio? ( media-sound/pulseaudio )
        elibc_glibc? (
                virtual/cargo
@@ -189,6 +193,20 @@ RDEPEND+="
 # }
 
 mozconfig_config() {
+       if use clang && ! tc-is-clang ; then
+               # Force clang
+               einfo "Enforcing the use of clang due to USE=clang ..."
+               CC=${CHOST}-clang
+               CXX=${CHOST}-clang++
+               strip-unsupported-flags
+       elif ! use clang && ! tc-is-gcc ; then
+               # Force gcc
+               einfo "Enforcing the use of gcc due to USE=-clang ..."
+               CC=${CHOST}-gcc
+               CXX=${CHOST}-gcc++
+               strip-unsupported-flags
+       fi
+
        # Migrated from mozcoreconf-2
        mozconfig_annotate 'system_libs' \
                --with-system-zlib \
@@ -200,11 +218,14 @@ mozconfig_config() {
        # Must pass release in order to properly select linker
        mozconfig_annotate 'Enable by Gentoo' --enable-release
 
-       # Must pass --enable-gold if using ld.gold
-       if tc-ld-is-gold ; then
-               mozconfig_annotate 'tc-ld-is-gold=true' --enable-gold
+       # Avoid auto-magic on linker
+       if use clang ; then
+               # This is upstream's default
+               mozconfig_annotate "forcing ld=lld due to USE=clang" 
--enable-linker=lld
+       elif tc-ld-is-gold ; then
+               mozconfig_annotate "linker is set to gold" --enable-linker=gold
        else
-               mozconfig_annotate 'tc-ld-is-gold=false' --disable-gold
+               mozconfig_annotate "linker is set to bfd" --enable-linker=bfd
        fi
 
        if has bindist ${IUSE}; then

Reply via email to