Porting/Firefox

From RCS Wiki
Jump to: navigation, search

This page details the efforts to port Firefox to PowerPC/POWER.

Legend: 'Both' means both BE and LE benefit from the fix. 'BE' means the issue is specific to Big Endian; 'LE' means the issue is specific to Little Endian.

Finished

In progress

Needs work

  • BE Skia colours are backwards in some cases (XXX: seems like it's specific to <canvas/>?) bug filed for backwards colours in text glyphs
  • BE FFmpeg overlays cause assertion because RGBX data is endian-shifted wrongly
  • Both? More acceleration with AltiVec / optional VSX / etc

JIT

The Firefox JIT (IonMonkey) needs to be ported to all sorts of POWER. The most important targets are PPC64 BE (Adélie, FreeBSD, Gentoo) and PPC64 LE (Debian, Fedora). PPC32 BE would be useful for the community, in addition to those who want to run a 32-bit userland on 64-bit kernel on Talos - this can save memory and perform a little faster depending on workloads, and is officially supported by Debian.

BE is being actively investigated by awilfox and the Adélie people; LE is being planned by Cameron KaiserTenFourFox issue where a POWER8 LE JIT for Linux is mentioned as "planning"..

Build instructions

This is how awilfox is building Firefox central (equivalent to Mozilla's Firefox Nightly, previously known as "Aurora" builds).

Ensure you have hg (Mercurial VCS) installed. You will need a significant amount of disk space; including the build directory, a normal mozilla-unified clone is over 20 GB. Paraphrasing from Mozilla's excellent description of working with their repository, which is a highly recommended read if you want to hack on the tree (and not just test it):

   $ hg clone --uncompressed https://hg.mozilla.org/mozilla-unified
   $ hg up central

You can replace 'central' with 'beta' to get firefox64. Most work is landing on firefox65 now, so 64 may not work correctly. Specifically, this patch is required to make 64 run on BE.

Build-time dependencies for Firefox Quantum (also applies to Thunderbird 60+):

   autoconf2.13 cargo clang llvm6-dev ncurses-dev openssl-dev perl rust which

Media libraries (some are optional, but all are highly recommended):

   alsa-lib-dev bzip2-dev icu-dev libevent-dev libffi-dev libpng-dev
   libjpeg-turbo-dev nspr-dev nss-dev pulseaudio-dev zlib-dev

Libraries used by XUL (required):

   dbus-glib-dev gconf-dev gtk+2.0-dev gtk+3.0-dev hunspell-dev libsm-dev
   libnotify-dev libxcomposite-dev libxdamage-dev libxrender-dev libxt-dev
   sqlite-dev startup-notification-dev unzip yasm zip

The build dependencies that are unpackaged on Adélie are Python 2 and Node.js. Node.js will require Python 2 to build, and the Mozilla build system is still in the process of upgrading to Python 3 compatibility. I've used an external drive mounted at /var/big (since it is 3TB drive), and installed Python 2 to --prefix /var/big/py2, and then installed Node.js to --prefix /var/big/node. So, export PATH=/var/big/py2/bin:/var/big/node/bin:$PATH should work. On most other distros those should be packaged and you can skip this step.

Download File:Mozconfig.txt as mozilla-unified/mozconfig. Adjust to your liking; if you are building on a GNU/Linux system instead of a musl libc system, change the triplets to 'powerpc64-unknown-linux-gnu'. If you are using a non-Adélie musl system, change the triplets to 'powerpc64-unknown-linux-musl'. Removing --enable-debug will make the browser much, much faster, but it will be much harder to catch bugs (as assertions won't crash it to get accurate backtraces). Note that as of now, you must use --with-system-icu on PowerPC.

If you are using musl (Adélie, Alpine, Void only): apply File:PPC64-musl-u2fhid.patch and File:WebRTC-on-musl.patch. If you are using Adélie, you need to apply File:Adelie-specific-triplet.patch so that the Rust compiler works. On all big endian hosts you'll need to apply File:Temp-assertion-disable.patch to run the browser with --enable-debug; otherwise, it will crash on startup.

You can now run ./mach build to build the browser. Use ./mach run to run it; you will probably need to set LD_LIBRARY_PATH=obj-powerpc64-foxkit-linux-musl/dist/bin so that Firefox can find libxul (Mach does not handle that).