Building Pale Moon: Microsoft Windows

These instructions are for building Pale Moon 28.9.* and newer and assumes you want to build the latest release.

Prerequisites

  • Microsoft Visual Studio 2015 (Community Edition (free) or Pro/Paid version -- Express won't work)
  • Exactly Windows 10 SDK version 10.0.17763.0
  • MozillaBuild 2.2
  • At least 6 GB Ram (8 GB or more recommended)
  • Plenty of free disk space
  • At least Windows 7 64-bit
  • Modern 7zip or another archiver capable of reading 7z files

Caveats

To get the free Visual Studio 2015 Community Edition you need a Developer Account (simply a Microsoft account). Microsoft will try to push newer versions of Visual Studio but it must be exactly VS 2015 with Update 3. You will have to get this version from the "previous versions" part of the site.

Launch Visual Studio 2015 after installation to initialize the environment, start the IDE and get the latest updates. Launch after updating to finish up the update, after which you can close the IDE. For x64 builds, make sure you install the x64 build tools.
Note: You will be asked to register with Microsoft when launching it the first time; simply log in with your developer account in the IDE and you're set.

Make sure you install the correct components for "C++ development"; other languages are not necessary and not installing them will save you (heaps of) disk space.

Getting the Source

The Pale Moon source code along with the Unified XUL Platform are available on our self-hosted Gitea instance.

Both methods will assume you are going to create a directory on your C drive called palemoon-source. You can, of course, put the source code anywhere you want as long as the path does not contain any spaces.

Using git

This is the simplest method assuming you have or want to use Git for Windows

  • Install and/or open Git Bash and change directory to the desired source location, e.g.
    cd /c/palemoon-source/
  • Execute the following commands:
    git clone https://repo.palemoon.org/MoonchildProductions/Pale-Moon.git ./
    git submodule init && git submodule update
    git checkout release && git submodule update
    
  • Close Git bash and proceed to the Build Instructions below.

Using the source archives

This requires downloading source archives from both the Pale Moon and Unified XUL Repository and is more complicated:

  • Navigate to the release page on the Pale Moon repository and download the zip archive for Pale Moon.
  • Extract the source code to the desired location e.g.
    c:\palemoon-source
  • Then using the link in "Built with the Unified XUL Platform - {Month} {Day}, {Year} release" head to the matching UXP release page and download the zip archive for platform source code.
  • Extract that archive to the platform directory inside the Pale Moon source directory e.g.
    c:\palemoon-source\platform
  • Proceed to the Build Instructions below.

NOTE: You will need to extract the contents of the Pale-Moon-XXX or UXP-XXX directory to the locations indicated above.

This source tree will contain everything needed for both x86 and x64 builds of Pale Moon (they share the same release source code).

Build Instructions

Configure

Create a file called .mozconfig in the source folder you cloned or unpacked the source to.

(Yes, that is {dot}mozconfig -- don't omit the . at the start. Also make sure it's not .mozconfig.txt or something crooked like that. If you are hiding extensions of known file types, fix that first in folder options because it's a PITA when trying to do this kind of thing)

Make sure it contains at least the following for a close-to-official build:

.mozconfig file

# Set to 1 if you want a 64 bit build else leave as-is
_BUILD_64=

# Standard build options for Pale Moon
ac_add_options --enable-application=palemoon
ac_add_options --enable-optimize="-O2 -GS-"
ac_add_options --enable-jemalloc
ac_add_options --enable-strip
ac_add_options --enable-devtools
ac_add_options --disable-eme
ac_add_options --disable-webrtc
ac_add_options --disable-gamepad
ac_add_options --disable-parental-controls
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --disable-updater

# Please see https://www.palemoon.org/redist.shtml for restrictions when using the official branding.
ac_add_options --enable-official-branding
export MOZILLA_OFFICIAL=1

# For versions after 28.12.0
ac_add_options --enable-phoenix-extensions

# Processor architecure specific build options
if [ -n "$_BUILD_64" ]; then
  _BUILD_ARCH=x64
  ac_add_options --target=x86_64-pc-mingw32
  ac_add_options --host=x86_64-pc-mingw32
else
  _BUILD_ARCH=x86
fi

# Visual C++ redist files
WIN32_REDIST_DIR=$VCINSTALLDIR/redist/$_BUILD_ARCH/Microsoft.VC140.CRT
WIN_UCRT_REDIST_DIR="C:/Program Files (x86)/Windows Kits/10/Redist/10.0.17763.0/ucrt/DLLs/$_BUILD_ARCH"

Note: LESS IS MORE! There are some pre-made build configs out there that have a lot of options listed, often with insane resulting build configurations. Do not use those and stick to the instructions here.

Build

  • Go to C:\mozilla-build (or wherever you extracted to mozilla build tools) and run
    start-shell-msvc2015.bat
    • This will open a UNIX-like shell with the compile environment set up for Visual Studio 2015 with a 32-bit target. Please do not use the -x64 batch file even if you are on a 64-bit operating system when building x86.
    • The -x64 batch file is for launching a 64-bit build environment and building a 64-bit browser. So for creating an x64 build of Pale Moon, run
      start-shell-msvc2015-x64.bat
  • In the shell, cd to your pale moon source directory, e.g.
    cd /c/palemoon-source
  • Start the build:
    ./mach build

Be patient. Building will take a long time. Your PC will be fully occupied compiling and linking the browser (you can expect 100% CPU usage throughout and lots of memory use - provide ample cooling) and you should not be using it for anything else that is intensive at this time. Especially memory-intensive applications should be avoided because it can cause issues with the linker (memory fragmentation) resulting in a very unstable browser.

Important note: before you start building, make sure to exclude the source and target folders from antivirus software or it will severely slow down the build process or may even break it entirely (due to file locks). Either completely disable real-time/on-access scanning before building, or make specific exclusions for your working folders.

Strip/Package

After building is completed, you can take the resulting binaries for a test run in the object directory directly (see the on-screen instructions at the end of the build process) but it will not be complete yet. You need to strip and package the browser to integrate additional code, pack up the omnijar files, and have a ready-to-use browser. You do this by running:

./mach package
This will create a properly packaged .zip file in your object folder under the Pale Moon source folder. e.g. for x86:
C:\palemoon-source\obj-i686-pc-mingw32\dist\palemoon-{version}.win32.7z

Generating the installer

If you want to build a self-extracting installer, similar to the off-line installers offered in official builds, you will have to do give the following command:

./mach installer
This will create a self-extracting installer in your object folder under the Pale Moon source folder. e.g. for x86:
C:\palemoon-source\obj-i686-pc-mingw32\dist\palemoon-{version}.win32.installer.exe

Site design and Branding © 2020 Moonchild Productions - All rights reserved
Any other content, brand names or logos are copyright or trademark to their respective owners.
Policies: Cookies - User Content - Privacy.

The Pale Moon Developer Site is powered by Project Selene 1.0.0a1.