--- firefox-21.0.ebuild.orig 2013-06-19 00:05:05.000000000 +0200 +++ firefox-21.0.ebuild 2013-06-17 04:22:52.000000000 +0200 @@ -39,7 +39,7 @@ KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux" SLOT="0" LICENSE="MPL-2.0 GPL-2 LGPL-2.1" -IUSE="bindist gstreamer +jit +minimal pgo pulseaudio selinux system-cairo system-jpeg system-sqlite" +IUSE="address-sanitizer bindist gstreamer +jit +minimal pgo pulseaudio selinux system-cairo system-jpeg system-sqlite" # More URIs appended below... SRC_URI="${SRC_URI} @@ -238,6 +238,50 @@ mozconfig_use_enable jit ion mozconfig_use_enable system-cairo + # compiler-dependent settings + if [[ $(tc-getCC) =~ clang ]]; then + mozconfig_annotate 'from ebuild, CC=clang detected' --enable-llvm-hacks + + # methodjit causes clang builds to segfault on x86_64 (see bug #462608) + # same for ion code.. + if use amd64; then + sed -e '/javascript.options.methodjit/ s/true/false/' \ + -e '/javascript.options.ion/ s/true/false/' \ + -i "${S}"/modules/libpref/src/init/all.js + fi + + # https://developer.mozilla.org/en-US/docs/Building_Firefox_with_Address_Sanitizer + if use address-sanitizer; then + echo "export MOZ_JEMALLOC=0" >> ${S}/.mozconfig + mozconfig_annotate '+address-sanitizer' --disable-crash-reporter + mozconfig_annotate '+address-sanitizer' --disable-elf-hack + mozconfig_annotate '+address-sanitizer' --disable-jemalloc + mozconfig_annotate '+address-sanitizer' --disable-replace-malloc + + echo "export MOZ_DEBUG_SYMBOLS=1" >> ${S}/.mozconfig + mozconfig_use_enable address-sanitizer debug-symbols + mozconfig_use_enable address-sanitizer + append-flags "-fsanitize=address" + append-flags "-Dxmalloc=myxmalloc" + fi + else + use address-sanitizer && die "Use flag address-sanitizer can only be \ + enabled if CC=clang is set. You're using a different compiler." + + if [[ $(gcc-major-version) -lt 4 ]]; then + append-cxxflags -fno-stack-protector + elif [[ $(gcc-major-version) -gt 4 || $(gcc-minor-version) -gt 3 ]]; then + if use amd64 || use x86; then + append-flags -mno-avx + fi + fi + fi + + # support EXTRA_ECONF, maybe this should be in mozcoreconf-2.eclass .. + for eeopt in $EXTRA_ECONF; do + mozconfig_annotate 'from ebuild, passed using EXTRA_ECONF' $eeopt + done + # Allow for a proper pgo build if use pgo; then echo "mk_add_options PROFILE_GEN_SCRIPT='\$(PYTHON) \$(OBJDIR)/_profile/pgo/profileserver.py'" >> "${S}"/.mozconfig @@ -245,14 +289,6 @@ # Finalize and report settings mozconfig_final - - if [[ $(gcc-major-version) -lt 4 ]]; then - append-cxxflags -fno-stack-protector - elif [[ $(gcc-major-version) -gt 4 || $(gcc-minor-version) -gt 3 ]]; then - if use amd64 || use x86; then - append-flags -mno-avx - fi - fi } src_compile() {