--- net-libs/xulrunner/xulrunner-1.9.1.2-r1.ebuild 2009-08-20 13:37:02.000000000 +0200 +++ net-libs/xulrunner/xulrunner-1.9.1.2-r1.ebuild 2009-08-20 14:52:10.000000000 +0200 @@ -21,7 +21,7 @@ KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86" SLOT="1.9" LICENSE="|| ( MPL-1.1 GPL-2 LGPL-2.1 )" -IUSE="+alsa debug python" # qt-experimental +IUSE="+alsa debug pgo python" # qt-experimental # qt-experimental? ( # x11-libs/qt-gui @@ -29,6 +29,7 @@ # nspr-4.8 due to BMO #499144 RDEPEND="java? ( >=virtual/jre-1.4 ) + pgo? ( >=sys-devel/gcc-4.4.1 ) >=dev-lang/python-2.3[threads] >=sys-devel/binutils-2.16.1 >=dev-libs/nss-3.12.3 @@ -61,6 +62,7 @@ EPATCH_SUFFIX="patch" \ EPATCH_FORCE="yes" \ epatch "${WORKDIR}" + use pgo && epatch "${FILESDIR}/gcc44-pgo.diff" # Same as in config/autoconf.mk.in MOZLIBDIR="/usr/$(get_libdir)/${PN}-${MAJ_PV}" @@ -149,6 +151,12 @@ mozconfig_annotate '' --enable-xpctools mozconfig_annotate '' --with-default-mozilla-five-home="${MOZLIBDIR}" + # enable profile guided optimization + if use pgo; then + echo "mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/xul-opt" >> .mozconfig + echo "mk_add_options PROFILE_GEN_SCRIPT='\$(PYTHON) \$(OBJDIR)/_profile/pgo/profileserver.py'" >> .mozconfig + fi + # Disable/Enable audio support based on USE mozconfig_use_enable alsa ogg mozconfig_use_enable alsa wave @@ -186,7 +194,18 @@ sed -i -e "s:/usr/lib/mozilla/plugins:/usr/$(get_libdir)/nsbrowser/plugins:" \ "${S}"/xpcom/io/nsAppFileLocationProvider.cpp || die "sed failed to replace plugin path!" - CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" econf + # without econf we need these + mozconfig_annotate '' --prefix=/usr + mozconfig_annotate '' --libdir=/usr/$(get_libdir) +} + +src_compile() { + # profile guided optimization + local pgo="" + use pgo && pgo="-j1 profiledbuild" + + CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" \ + emake -f client.mk ${pgo} || die "emake failed" } src_install() { --- /dev/null 2009-08-14 03:35:21.951203010 +0200 +++ net-libs/xulrunner/files/gcc44-pgo.diff 2009-08-20 13:58:42.000000000 +0200 @@ -0,0 +1,56 @@ +--- configure.in.orig 2009-07-30 17:30:11.000000000 +0200 ++++ configure.in 2009-08-20 13:55:08.000000000 +0200 +@@ -7013,18 +7013,18 @@ + AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE) + + _SAVE_CFLAGS="$CFLAGS" +-CFLAGS="$CFLAGS -fprofile-generate" ++CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction" + + AC_MSG_CHECKING([whether C compiler supports -fprofile-generate]) + AC_TRY_COMPILE([], [return 0;], +- [ PROFILE_GEN_CFLAGS="-fprofile-generate" ++ [ PROFILE_GEN_CFLAGS="-fprofile-generate -fprofile-correction" + result="yes" ], result="no") + AC_MSG_RESULT([$result]) + + if test $result = "yes"; then + PROFILE_GEN_LDFLAGS="-fprofile-generate" +- PROFILE_USE_CFLAGS="-fprofile-use" +- PROFILE_USE_LDFLAGS="-fprofile-use" ++ PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction" ++ PROFILE_USE_LDFLAGS="-fprofile-use -fprofile-correction" + else + CFLAGS="$_SAVE_CFLAGS -fprofile-arcs" + AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs]) +--- configure.orig 2009-08-20 13:56:05.000000000 +0200 ++++ configure 2009-08-20 13:58:17.000000000 +0200 +@@ -18739,7 +18739,7 @@ + + + _SAVE_CFLAGS="$CFLAGS" +-CFLAGS="$CFLAGS -fprofile-generate" ++CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction" + + echo $ac_n "checking whether C compiler supports -fprofile-generate""... $ac_c" 1>&6 + echo "configure:18746: checking whether C compiler supports -fprofile-generate" >&5 +@@ -18753,7 +18753,7 @@ + EOF + if { (eval echo configure:18755: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* +- PROFILE_GEN_CFLAGS="-fprofile-generate" ++ PROFILE_GEN_CFLAGS="-fprofile-generate -fprofile-correction" + result="yes" + else + echo "configure: failed program was:" >&5 +@@ -18766,8 +18766,8 @@ + + if test $result = "yes"; then + PROFILE_GEN_LDFLAGS="-fprofile-generate" +- PROFILE_USE_CFLAGS="-fprofile-use" +- PROFILE_USE_LDFLAGS="-fprofile-use" ++ PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction" ++ PROFILE_USE_LDFLAGS="-fprofile-use -fprofile-correction" + else + CFLAGS="$_SAVE_CFLAGS -fprofile-arcs" + echo $ac_n "checking whether C compiler supports -fprofile-arcs""... $ac_c" 1>&6