Howto: Compile Firefox PGO on Gentoo using an ebuild

Warning! All this doesn’t work at all anymore. Don’t even try it.

This Howto explains how to build Mozilla Firefox with PGO (profile guided optimization) on Gentoo using portage and the ebuild. It’s quite tricky, so make sure the prerequisites are correct on your system.


  • Your user has to be in the "portage" group!
  • /var/tmp/portage has to be 775 or 770 (chmod g+w /var/tmp/portage)
  • You need a customized ebuild

I use the mozilla-firefox-3.1_beta3 ebuild from mozilla overlay. The needed should be in the files/ subdir. You can svn checkout my modified one from here:

svn co

Just put that in your overlay.

Make sure to enable the useflags "pgo -xulrunner" in your /etc/portage/package.use file!

Now as user we call the ebuild phases manually

cd /path/to/your/overlay/www-client/mozilla-firefox
ebuild mozilla-firefox-3.1_beta3-r1.ebuild compile

This will start the compile, after the first PGO run, the browser will open up, and you should do some usual browsing for some minutes. Maybe go to the spidermonkey JS speed test page. When done, just close the browser.

Now the second run will be done. When finished, we install it as root with

sudo ebuild mozilla-firefox-3.1_beta3-r1.ebuild qmerge

Overlay with Qt 4.5 snapshot ebuilds

Recently stumbled over this blog post:

Looks like it’s usable for KDE 4 trunk already, and the improvements to the WebKit engine got me interested in trying it. So I spend 2 hours in creating ebuilds for the Qt 4.5 snapshots – based on the split Qt 4.4.2 ebuilds in portage.

That actually wasn’t that hard to do, just fixing the qt4-build.eclass to include that 4.5.0_pre* version, and adding one line to qt-core ebuilds (adding src/tools/bootstrap to the targets). Other than that, it compiled fine. Easy.

The overlay can be found in my SVN:

svn co

There is an script in the Scripts/ subfolder, which should generate an updated headers tarball and update all ebuilds. Just adjust that distdir variable.

And now the usual warnings etc: USING THE EBUILDS IN THIS OVERLAY MIGHT KILL YOUR CAT, BURN YOUR HOUSE, BREAK YOUR CAR AND YOUR KDE4 and whatnot else. Use at your own risk!