Building Pale Moon for Linux yourself

Building Pale Moon for Linux yourself

Though the process of compiling Pale Moon on Linux is the same as Firefox, the documentation on MDN is lacking. This post will just clarify a few points:

Build prerequisites

(Original document: https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Linux_Prerequisites)

Hardware

At least 4GB RAM, and more swap area the better. It is possible to compile even with 1.5GB of RAM, and ~3GB of swap area, but this significantly slows down the compilation process.

Build tools and dependencies

Note:

  • Some Mozilla docs mention that CentOS 5 is used; but for some reason I doubt this -- if it were truly so then Firefox would run on a greater number of platforms. Or perhaps I'm wrong. Personally, I use a CentOS 6.5 VM.
  • The bootstrap.py script does not work on CentOS, because it references a few package groups that do not exist.
  • Updating things should not be done at all until absolutely necessary, for example, to satisfy dependencies.
  • The recommendation to use CentOS is purely from the consideration of backward compatibility. If you have no need for backward compatibility, you can use any distro for this.

For future versions of Pale Moon, please have a look over about:buildconfig of the corresponding version of FF; it contains important hints (versions of compilers, switches etc.)

First of all, we need to install the necessary packages using the following commands:

yum install autoconf213 yasm mesa-libGL-devel alsa-lib-devel libXt-devel gstreamer-devel gstreamer-plugins-base-devel pulseaudio-libs-devel
yum groupinstall 'Development Tools' 'GNOME Software Development'

Remember to add e.g. "epel"/"remi" repositories to yum or some of the packages (e.g. yasm) will not be found.

If you want to save on data, you can correspond the list of packages with the list provided for Debian/Ubuntu. I did this to some extent, but it is simply not worth the time.

The Mozilla build process also requires Python 2.7, which you can install using the instructions here. In short:

yum install zlib-dev openssl-devel sqlite-devel bzip2-devel # dependencies
wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
tar -xf Python-2.7.6.tar.xz
cd Python-2.7.6
./configure --prefix=/usr/local
make
make altinstall # don't use make install, this will replace the system python!

Throw in setuptools, pip and virtualenv along with that:

wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
python2.7 ez_setup.py
easy_install-2.7 pip
pip2.7 install virtualenv # not really sure if virtualenv is needed

The development tools on CentOS are old, so let's install newer ones:

cd /etc/yum.repos.d
wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo
yum install devtoolset-1.1-{gcc,gcc-c++,binutils,elfutils}

Compiling Pale Moon from source

build.sh:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

if [ ! -d "pmsrc" ] || [ ! -d "pmbuild" ] || [ ! -f "mozconfig.txt" ] ; then
  echo "Check the directories and files!"
  exit 1
fi

cp mozconfig.txt pmsrc/.mozconfig
cd pmsrc/

echo "Build?"
read -n 1 ch

if [ "$ch" == "y" ] ; then
  make -f client.mk build &> /dev/stdout | tee buildlog.txt
  if [ ${PIPESTATUS[0]} == 0 ]; then
    cd "../pmbuild"
    make package
  fi
else
  echo "Compilation aborted."
fi

mozconfig.txt (used in PM4Linux 24.*, make sure to change OBJDIR to an existing path in your /home):

ac_add_options --enable-official-branding
export MOZILLA_OFFICIAL=1

mk_add_options MOZ_CO_PROJECT=browser
ac_add_options --enable-application=browser

mk_add_options MOZ_OBJDIR=/home/{username}/pmbuild/

ac_add_options --disable-crashreporter
ac_add_options --disable-accessibility
ac_add_options --disable-parental-controls
ac_add_options --disable-webrtc
ac_add_options --disable-logging
ac_add_options --disable-necko-wifi
ac_add_options --disable-installer
ac_add_options --disable-updater
ac_add_options --disable-websms-backend

ac_add_options --disable-tests
ac_add_options --disable-mochitests
ac_add_options --disable-debug
ac_add_options --disable-debug-symbols

ac_add_options --enable-strip
ac_add_options --enable-jemalloc
ac_add_options --enable-optimize="-O3 -msse2 -mfpmath=sse"

ac_add_options --enable-chrome-format=omni

ac_add_options --x-libraries=/usr/lib
  • Download the latest version of Pale Moon and extract the source.
  • Set permissions by using chmod -R 777 pmsrc/.
  • Run scl enable devtoolset-1.1 ./build.sh.

A palemoon*.tar.bz2 will await you in the pmbuild folder after the compilation completes.

NOTE: The above guide covers on how to make binaries similar to those released; however, it is possible to build using later versions of the toolchains/libraries (although we cannot give any guarantees regarding the stability of such builds).


Related

Wiki: Home