--- firefox-19.0.2.ebuild 2013-03-30 23:28:31.018634903 +0100 +++ firefox-19.0.2.ebuild.new 2013-03-30 23:52:01.242004684 +0100 @@ -38,7 +38,7 @@ KEYWORDS="~alpha ~amd64 ~arm ~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 selinux system-jpeg system-sqlite" +IUSE="address-sanitizer bindist gstreamer +jit +minimal pgo selinux system-jpeg system-sqlite" # More URIs appended below... SRC_URI="${SRC_URI} @@ -213,10 +213,53 @@ mozconfig_use_enable gstreamer mozconfig_use_enable system-sqlite mozconfig_use_with system-jpeg + # Feature is know to cause problems on hardened mozconfig_use_enable jit methodjit mozconfig_use_enable jit tracejit + # 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) + if use amd64; then + sed -e '/javascript.options.methodjit/ 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 @@ -224,14 +267,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() {