Trying to build from previous (< v27.0) release archives or branches with these instructions will fail.
To build your own copy of Pale Moon from source on Windows, using the freely available version of Visual Studio 2013 Community edition, you will need to do the following.
Most of these instructions are universal for building x86 and x64, so I will indicate differences required for x64 at the steps they are required.
Install prerequisites
- Make sure you have powerful enough hardware running Windows 7 x64 with SP1 or above (at least dual-core full-fledged processor, at least 4GB of Ram (8 or more recommended), at least 20GB of free disk space). Don't try to build on an average laptop. If you are even considering doing this, stop. You need a development-class computer to build Pale Moon. A 64-bit operating system is required!
- Visual Studio 2013 Community Edition (you can of course also use the commercial version of VS 2013): https://www.visualstudio.com/vs/older-downloads/
You will need to be a Dev Essentials member (free account) to get access to the Visual Studio 2013 CE downloads since Microsoft has deemed that "older versions should be behind a registration wall while current versions are in the open".
Launch VS2013 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.
You will also be asked to register your installed copy of Visual Studio. I suggest you do this immediately to prevent nags later on.
Since people have been repeating this question: No, you cannot build with any other version of Visual Studio! You must use exactly Visual Studio 2013. This is because both older and newer versions of Visual Studio have breaking changes for C++ that will break the build. - The build tools package: Either from Mozilla at https://ftp.mozilla.org/pub/mozilla/libraries/win32/MozillaBuildSetup-2.1.0.exe or from our FTP site: ftp://archive:get@ftp2.palemoon.org/misc/MozillaBuildSetup-2.1.0.exe
Install it in the recommended location, or a different path that has no spaces in it.
(when v27 is released) Download the source from http://www.palemoon.org/sourcecode.shtml
For pre-releases, check our github repository.
Unpack the source code to a path that does not contain spaces, e.g. c:\palemoon-source
This source tree will contain everything needed for both x86 and x64 builds of Pale Moon (they share the same release source code).
Configure
Create a file called .mozconfig in the source folder you unpacked the source in.
(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:
For x86 (32-bit):
Code: Select all
mk_add_options MOZ_CO_PROJECT=browser
ac_add_options --enable-application=browser
ac_add_options --enable-optimize="-O2"
ac_add_options --enable-jemalloc
ac_add_options --enable-shared-js
ac_add_options --enable-devtools
WIN32_REDIST_DIR=$VCINSTALLDIR/redist/x86
Code: Select all
ac_add_options --target=x86_64-pc-mingw32
ac_add_options --host=x86_64-pc-mingw32
mk_add_options MOZ_CO_PROJECT=browser
ac_add_options --enable-application=browser
ac_add_options --enable-optimize="-O2"
ac_add_options --enable-jemalloc
ac_add_options --enable-shared-js
ac_add_options --enable-devtools
WIN32_REDIST_DIR=$VCINSTALLDIR/redist/x64
- Go to C:\mozilla-build (or wherever you extracted to mozilla build tools) and run start-shell-msvc2013.bat
This will open a UNIX-like shell with the compile environment set up for Visual Studio 2013. Please do not use the -x64 batch file when building a 32-bit (x86) version of the browser.
The -x64 batch file is for launching a build environment for building a 64-bit browser. So for creating an x64 build of Pale Moon, run start-shell-msvc2013-x64.bat - In the shell, cd to your Pale Moon source directory, e.g. cd /c/palemoon-source if you installed the source in C:\palemoon-source
- Start the build:mach build
- Be patient. Building will take a considerable amount of 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. The build system will, by default, use all of your CPU cores. Especially memory-intensive applications should be avoided because it can cause issues with the linker (memory fragmentation) resulting in a very unstable browser.
Strip/Package
After building is completed, you can take the resulting binaries for a test run in the object directory directly by issuing a mach run command (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 have a ready-to-use browser. You do this by running the mach package command.
This will create a properly packaged .zip file in your object folder under the Pale Moon source folder. e.g.:
C:\palemoon-source\obj-i686-pc-mingw32\dist\palemoon-{version}.win32.zip (for x86)
Building a self-extracting 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.:
C:\palemoon-source\obj-i686-pc-mingw32\dist\palemoon-{version}.win32.installer.exe (for x86)