Build instructions for Pale Moon 27 (Windows)

Post your tutorials for using applications or performing related tasks here.
Note: Not for "how do I...?" Questions!
Forum rules
Tutorials and Howtos should only relate to developed software, and not to third party applications. e.g.: Don't post a generic Howto for configuring a firewall.
If you have a question how to do something, you should use one of the support boards, not this board. It is meant for people to document and post instructions.
User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35473
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Build instructions for Pale Moon 27 (Windows)

Unread post by Moonchild » 2016-10-30, 14:11

Note: these instructions apply to building from source of the v27 milestone.
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.
Get the source

(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
For x64 (64-bit):

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
Build
  • 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.
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 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)
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

Fedor2

Re: Build instructions for Pale Moon 27 (Windows)

Unread post by Fedor2 » 2016-11-03, 02:42

If you don't have Dev Essentials member, you can get VS2013 for free from here.
https://www.microsoft.com/en-us/downloa ... x?id=48131
Even from this direct link
https://download.microsoft.com/download ... xp_ENU.iso

Just did my first built of 27 with it and mozilla-build 2.2.0.
Off-topic:
The good thing is that with this tools building is going on much faster. But there are the one nasty thing: you cannot register VS2013 without internet, and definitely member account also required for that, nevertheless you have your 30 days trial period.

May be someone know how to register VS2013 offline please give a tip.

Next consider VS2015 may even not start without internet.

Fedor2

Re: Build instructions for Pale Moon 27 (Windows)

Unread post by Fedor2 » 2016-11-07, 12:20

UPDATE

No any special member is required at all. Create regular microsoft account and sign in with it inside the VS2013 IDE. Your wil get the registration instantly.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35473
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Build instructions for Pale Moon 27 (Windows)

Unread post by Moonchild » 2016-11-07, 12:34

Fedor2 wrote:UPDATE

No any special member is required at all. Create regular microsoft account and sign in with it inside the VS2013 IDE. Your wil get the registration instantly.
They normally require you to be a dev essentials member to download it, though. If you already have a Microsoft account then that is a one-click deal, however.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

RedRamGT
Moon lover
Moon lover
Posts: 77
Joined: 2014-05-06, 02:43
Location: Almont, Michigan, USA

Re: Build instructions for Pale Moon 27 (Windows)

Unread post by RedRamGT » 2016-11-08, 01:35

Last weekend I did a build of the Pale Moon 27 source, and successfully built a 32-bit installer. A "tip of the hat" to Moonchild for the instructions - they worked well!

I downloaded Visual Studio 2013 using the first link in the post from Fedor2, and used Mozilla Build 2.1.0.

When I try to build a 64-bit browser, I get this error when I run start-shell-msvc2013-x64.bat:
"Unable to call a suitable vcvars script. Exiting."

In the instructions for the install of Visual Studio 2013, it says "For x64 builds, make sure you install the x64 build tools." I did some looking, and found a couple mentions of x64 tool kits for VS2013 - and installed two of them - but still get the same error, so they are not the tools I need. Where can I find the x64 tools that are needed?

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35473
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Build instructions for Pale Moon 27 (Windows)

Unread post by Moonchild » 2016-11-08, 01:40

The x64 tools are an option when you install VS2013 - you'll have to check what components get installed (may require a custom install), and make sure to check to x64 build tools.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

RedRamGT
Moon lover
Moon lover
Posts: 77
Joined: 2014-05-06, 02:43
Location: Almont, Michigan, USA

Re: Build instructions for Pale Moon 27 (Windows)

Unread post by RedRamGT » 2016-11-10, 03:22

Okay... I did some investigating... The edition of VS2013 in the download link from Fedor2 is VS2013 "Express" edition. It supports 32-bit builds - but not 64-bit. If someone is building a 32-bit flavor of Pale Moon, it will work well for doing that.

I installed the VS2013 "Community" edition, and successfully built a 64-bit Pale Moon 27.0.0b3 installer.

If there is a direct link for an ISO image of VS2013 "Community" edition, it would be good to know. I have a slow DSL connection, and installing VS2013 with the web installer takes several hours. With an ISO image, I can download it overnight - and use it when I need it.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35473
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Build instructions for Pale Moon 27 (Windows)

Unread post by Moonchild » 2016-11-10, 10:50

RedRamGT wrote:The edition of VS2013 in the download link from Fedor2 is VS2013 "Express" edition.
Ah yeah that's not the same! I'm not sure what all is missing from that one.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

win7-7
Fanatic
Fanatic
Posts: 183
Joined: 2013-09-16, 15:18
Location: --

Re: Build instructions for Pale Moon 27 (Windows)

Unread post by win7-7 » 2016-11-10, 17:24

Direct download link for web based installer for Visual Studio 2013 community edition.

https://go.microsoft.com/fwlink/?LinkId=517284


Also ISO download link with update 5 included.

http://download.microsoft.com/download/ ... ce_enu.iso

Fedor2

Re: Build instructions for Pale Moon 27 (Windows)

Unread post by Fedor2 » 2016-11-15, 09:22

VS2013 "Express" edition. It supports 32-bit builds - but not 64-bit.
This is not true.
Off-topic:
Express edition have all build tools you need, and almost nothing excessive, communti edition otherwise filled with lots off unwanted stuff that litters your pc.
Actually its a new mozilla-build tools bug, just copy two files from the old mozilla-build tools: start-shell-msvc2013-x64.bat and guess-msvc.bat to the new mozilla-build dir.

GMforker

Re: Build instructions for Pale Moon 27 (Windows)

Unread post by GMforker » 2016-11-17, 08:20

Fedor2 wrote:Actually its a new mozilla-build tools bug, just copy two files from the old mozilla-build tools: start-shell-msvc2013-x64.bat and guess-msvc.bat to the new mozilla-build dir.
...or (for "Mozilla Build 2.1.0") change two lines in the file "start-shell.bat":

from:

Code: Select all

      IF EXIST "!VCDIR!\bin\amd64\vcvars64.bat" (
        CALL "!VCDIR!\bin\amd64\vcvars64.bat"
to:

Code: Select all

      REM IF EXIST "!VCDIR!\bin\amd64\vcvars64.bat" (
        REM CALL "!VCDIR!\bin\amd64\vcvars64.bat"
      IF EXIST "!VCDIR!\bin\x86_amd64\vcvarsx86_amd64.bat" (
        CALL "!VCDIR!\bin\x86_amd64\vcvarsx86_amd64.bat"

JustOff

Re: Build instructions for Pale Moon 27 (Windows)

Unread post by JustOff » 2017-01-13, 11:47

The instructions above probably should be updated with ac_add_options --enable-devtools in .mozconfig.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35473
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Build instructions for Pale Moon 27 (Windows)

Unread post by Moonchild » 2017-01-13, 22:58

JustOff wrote:The instructions above probably should be updated with ac_add_options --enable-devtools in .mozconfig.
Done so.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

kizo07

Re: Build instructions for Pale Moon 27 (Windows)

Unread post by kizo07 » 2017-01-14, 15:50

Off-topic:
Just thought...
Moonchild wrote: JustOff wrote:
The instructions above probably should be updated with ac_add_options --enable-devtools in .mozconfig.


Done so.
17387 x 300 sec. (approximately/minimum time to read each thread, to think about it and to write the answer) = 60 days

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35473
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Build instructions for Pale Moon 27 (Windows)

Unread post by Moonchild » 2017-01-15, 04:51

Off-topic:
kizo07 wrote:17387 x 300 sec. (approximately/minimum time to read each thread, to think about it and to write the answer) = 60 days
Not sure what you're getting at, but if it's related to the number of posts made under my account you're grossly underestimating ;)
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

kizo07

Re: Build instructions for Pale Moon 27 (Windows)

Unread post by kizo07 » 2017-01-15, 13:18

Off-topic:
Moonchild wrote:you're grossly underestimating
I'm aware of that. Even so, 60 days (actually 120 days -sleeping time) of Your life, just to answer to 'seldom right, never in doubt' nuts as us :)

Locked