Due to server slowness, downtime, and other issues, guests can no longer search the forum or view user accounts. At some point in the future Eclipse will be moving to a more stable and efficient platform that should result in much better stability and the lifting of these restrictions. There is no timeline for this yet, just want you to know what's happening with all the downtime and I have a plan to fix it.

Lun3r/Hydra UXP build guide (+ eMail/Lun3r Navigator)

Have a project that you want to share, but it's not big enough to warrant an entire category? This is the place.
User avatar
the_r3dacted
Lazy Owner
Posts: 1315
Joined: 11 Jan 2021, 07:40
Location: ur dads house
OS: Windows 8.1 x64
Has thanked: 938 times
Been thanked: 514 times
Contact:
United States of America

Lun3r/Hydra UXP build guide (+ eMail/Lun3r Navigator)

Unread post by the_r3dacted »

1: Have an install of Windows 7 or later. Vista might work, but I have not tested it.

1.5: Install basic prerequisites. .NET 3.5, .NET 4.x, VC++, etc. If you're using one of our ISOs, you should already have these. If you're using 8.1 Lite from here, you will need to grab C:\Windows\SysWOW64\upx.dll from a regular ISO and add it to your install. If you're on Windows 8+ and having trouble installing .NET 3.5, mount your install media, open an admin cmd, and run this. `DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:D:\sources\sxs` (Replacing D: with the drive your install media is in. For some debloated 10+ ISOs, you may need to do this with a stock ISO of the same major version.)

2: Grab the main prerequisites for building, MozillaBuild 3.2 and FWDK-15 (Specifically FWDK-15.7z and Min-DX-SDK.7z), and Git.

3: Install the prerequisites:
MozillaBuild, you can just run and install MozillaBuildSetup-3.2.exe. The only thing I changed is I added -3.2 to the end of the install path, so it installed to C:\mozilla-build-3.2 and that's all.

For FWDK, extract FWDK-15.7z and move the extracted FWDK-15 folder to the root of the C: drive. It should look like C:\FWDK-15\(MSVC15 and Windows Kits)

Other dependencies I like to keep under C:\DEV\ so it doesn't crowd the drive root directory up too much. This includes Min-DX-SDK.7z, extract it inside C:\DEV\. It should look like C:\DEV\Min-DX-SDK\(Include, Lib, and Redist)

Install Git, either as GitHub Desktop or regular Git. For detailed instructions on how to do that, refer to the r3dfox build guide.

4: Clone the source code:

By default Git/GitHub Desktop will clone with Windows style line endings since well we're on Windows, however this causes issues with the Mozilla build system. Open the command prompt, and use these commands to tell Git to use Linux style line endings.

Code: Select all

git config --global core.autocrlf false

git config --global core.eof lf
Now you can git clone the repo either with GitHub Desktop or CLI Git. I've started using C:\Projects\ to store my browser projects, and I suggest you do the same. Go to C:\Projects\ and clone the repo there.

Code: Select all

git clone https://github.com/Eclipse-Community/UXP
5: Preparation for compiling:

Navigate to C:\mozilla-build-3.2\, and create two new bat files there. Any name works, but some potential names are start-shell-legacy-fwdk-19041.bat and start-shell-legacy-fwdk-19041-x64.bat, or just simply shell-3.2-i686.bat and shell-3.2-x64.bat. Something to convey one is 32-bit and the other is 64-bit. Or you can just create one or edit the default start-shell.bat if you're only going to compile for one architecture.

For the 32-bit file, paste this inside it.
► Show Spoiler
For the 64-bit file, paste this inside it.
► Show Spoiler
After this, you should be ready to build.

6: Compiling

Open the .bat file for the architecture you want to compile for, 32-bit or 64-bit. This will automatically place you in C:/Projects/, so to navigate to the UXP source directory, type `cd UXP` and press enter. If you're only ever going to build UXP and not eMail or any other project, you can add `/UXP` to the `cd C:/Projects` command in the two .bat files you created.

If instead the command prompt opens and instantly closes, you cloned the browser to a different path than C:/Projects/. In the case of UXP, I haven't encountered any issues from too long of a path, so you should just be fine editing both batch files to point to the path the source code is stored in. Since this is a Linux style terminal, you will need to use forward slashes for the path.

Now that you're inside the UXP source directory, you're almost ready to start building, but first you need to learn about mozconfigs. The browser uses a mozconfig to store compile flags and settings. This is normally set as an environment variable or taken from .mozconfig if none is set. However since we have a Linux style terminal, we can specify an environment variable before the command, letting us choose whatever we want, whenever we want, without setting any environment variables or swapping .mozconfig files. However if you're only going to ever use one mozconfig, you can add it as an environment variable. Then you don't need MOZCONFIG=xyz in every command.

If when running any of the below commands to compile the browser, you still get an error about Windows style line endings even after our preparation earlier, run these commands to fix it up.

Code: Select all

git config core.autocrlf false
git config core.eof lf
git rm --cached -r .
git reset --hard
Instead of building Lun3r or Hydra branded builds, the below commands will build unbranded builds. For Lun3r you will have New Moon, and for Hydra you will have Serpent, and this is what they will be referred to as from now on. Please do not distribute Lun3r or Hydra branded builds if you are not part of Eclipse Community.

To build the 32-bit release of New Moon, use the below commands. (Make sure you are in the 32-bit shell!)

Code: Select all

MOZCONFIG=C:/Projects/UXP/mozconfigs/nm-win32 ./mach build
MOZCONFIG=C:/Projects/UXP/mozconfigs/nm-win32 ./mach package
MOZCONFIG=C:/Projects/UXP/mozconfigs/nm-win32 ./mach installer
To build the 64-bit release of New Moon, use the below commands. (Make sure you are in the 64-bit shell!)

Code: Select all

MOZCONFIG=C:/Projects/UXP/mozconfigs/nm-win64 ./mach build
MOZCONFIG=C:/Projects/UXP/mozconfigs/nm-win64 ./mach package
MOZCONFIG=C:/Projects/UXP/mozconfigs/nm-win64 ./mach installer
Note: If you have already built New Moon, and want to build Serpent, or vice versa, you will need to clobber in between since they compile to the same directory. Clobbering basically just deletes the old compiled code and makes it so the next build recompiles the browser fresh. (Although you could probably set a custom target for one or the other and have two directories, but I haven't tried this yet.)

One or the other command should work since it goes in the same directory, but it's probably best to run both clobber commands.
To clobber the 32-bit release of the browser, use the below commands.

Code: Select all

MOZCONFIG=C:/Projects/UXP/mozconfigs/nm-win32 ./mach clobber
MOZCONFIG=C:/Projects/UXP/mozconfigs/serpent-win32 ./mach clobber
To clobber the 64-bit release of the browser, use the below commands.

Code: Select all

MOZCONFIG=C:/Projects/UXP/mozconfigs/nm-win64 ./mach clobber
MOZCONFIG=C:/Projects/UXP/mozconfigs/serpent-win64 ./mach clobber
To build the 32-bit release of Serpent, use the below commands. (Make sure you are in the 32-bit shell!)

Code: Select all

MOZCONFIG=C:/Projects/UXP/mozconfigs/serpent-win32 ./mach build
MOZCONFIG=C:/Projects/UXP/mozconfigs/serpent-win32 ./mach package
MOZCONFIG=C:/Projects/UXP/mozconfigs/serpent-win32 ./mach installer
To build the 64-bit release of Serpent, use the below commands. (Make sure you are in the 64-bit shell!)

Code: Select all

MOZCONFIG=C:/Projects/UXP/mozconfigs/serpent-win64 ./mach build
MOZCONFIG=C:/Projects/UXP/mozconfigs/serpent-win64 ./mach package
MOZCONFIG=C:/Projects/UXP/mozconfigs/serpent-win64 ./mach installer
You may also want to clobber for source code updates. I'm unsure if UXP gets very many big changes that would necessitate a clobber, however it's always good practice to. Will avoid unnecessary issues. However if you have older hardware that takes a while to compile the browser, it is faster to not clobber.

Now you should have a compiled build of New Moon (Lun3r) and/or Serpent (Hydra). However another Eclipse Community UXP based project is Eclipse Mail, and Lun3r Navigator. If you want to build those, follow the below.

The generic name for Eclipse Mail is MailNews, and the generic name for Lun3r Navigator is BNavigator. This is what they will be referred to as from now on.

Note: You will want to compile New Moon or Serpent first before trying to compile MailNews or BNavigator. Some errors that may arise when compiling New Moon/Serpent might not throw an error when compiling MailNews or BNavigator, and may result in a broken application. It's best to make sure you can successfully compile the base UXP project first before trying to compile this.

Much like the above, you'll want to clone it with Git or GitHub Desktop, and I suggest the same C:/Projects/ directory.

Code: Select all

git clone https://github.com/Eclipse-Community/eMail
For this project, it needs to link back to the upstream source, the platform directory needs to point to the UXP source directory. I accomplish this by making a symbolic link, however a git clone doesn't properly create this link, so you will need to manually recreate it. Inside the eMail source directory, delete the platform file. Now open an admin CMD in the eMail directory, and use this command to create the symbolic link, assuming the UXP and eMail directories are in the same parent directory.

Code: Select all

mklink /d platform ..\UXP
After this, you will need to apply this commit to the UXP source directory or else you will be unable to build. This lets it work with external directories. If you wish to build New Moon or Serpent again, you will need to revert the change or else it won't work.
https://github.com/roytam1/UXP/commit/ae3068547e4645e3cc5e8d187c9ecbe77162d288
Open a CMD in the UXP source directory (should be C:\Projects\UXP) and use this command to cherry-pick the changes.

Code: Select all

git cherry-pick ae3068547e4645e3cc5e8d187c9ecbe77162d288
Or if you don't want to create a commit, you can obtain it as a patch by appending .patch to the end of the url.
https://github.com/roytam1/UXP/commit/ae3068547e4645e3cc5e8d187c9ecbe77162d288.patch
Download this and apply it using.

Code: Select all

git apply --ignore-space-change (path-to-patch).patch
Or you can just manually apply it by copy and pasting from the webpage. Just make sure you have this change or else it won't work.

Now you're ready to build MailNews and BNavigator. Please do not distribute Eclipse Mail or Lun3r Navigator branded builds if you are not part of Eclipse Community.

To build the 32-bit release of MailNews, use the below commands. (Make sure you are in the 32-bit shell!)

Code: Select all

MOZCONFIG=C:/Projects/eMail/mozconfigs/mail-win32 ./mach build
MOZCONFIG=C:/Projects/eMail/mozconfigs/mail-win32 ./mach package
MOZCONFIG=C:/Projects/eMail/mozconfigs/mail-win32 ./mach installer
To build the 64-bit release of MailNews, use the below commands. (Make sure you are in the 64-bit shell!)

Code: Select all

MOZCONFIG=C:/Projects/eMail/mozconfigs/mail-win64 ./mach build
MOZCONFIG=C:/Projects/eMail/mozconfigs/mail-win64 ./mach package
MOZCONFIG=C:/Projects/eMail/mozconfigs/mail-win64 ./mach installer
Much like the above, you will want to clobber if you've already built MailNews and you want to build BNavigator, or vice versa.
One or the other command should work since it goes in the same directory, but it's probably best to run both clobber commands.
To clobber the 32-bit release of the application, use the below commands.

Code: Select all

MOZCONFIG=C:/Projects/eMail/mozconfigs/mail-win32 ./mach clobber
MOZCONFIG=C:/Projects/eMail/mozconfigs/nav-win32 ./mach clobber
To clobber the 64-bit release of the application, use the below commands.

Code: Select all

MOZCONFIG=C:/Projects/eMail/mozconfigs/mail-win64 ./mach clobber
MOZCONFIG=C:/Projects/eMail/mozconfigs/nav-win64 ./mach clobber
To build the 32-bit release of BNavigator, use the below commands. (Make sure you are in the 32-bit shell!)

Code: Select all

MOZCONFIG=C:/Projects/eMail/mozconfigs/nav-win32 ./mach build
MOZCONFIG=C:/Projects/eMail/mozconfigs/nav-win32 ./mach package
MOZCONFIG=C:/Projects/eMail/mozconfigs/nav-win32 ./mach installer
To build the 64-bit release of BNavigator, use the below commands. (Make sure you are in the 64-bit shell!)

Code: Select all

MOZCONFIG=C:/Projects/eMail/mozconfigs/nav-win64 ./mach build
MOZCONFIG=C:/Projects/eMail/mozconfigs/nav-win64 ./mach package
MOZCONFIG=C:/Projects/eMail/mozconfigs/nav-win64 ./mach installer
Much like the above, you may also want to clobber for source code updates.

This guide still isn't finished but I am so tired right now. The below is for me to expand later

IA-32 there exists ia32 mozconfigs and for now that requires these to be applied.
https://github.com/roytam1/UXP/commit/d560d9f315d913087fd5f8cca19a5157f545c2b9
https://github.com/roytam1/UXP/commit/95e1c106f53409fa154cb59c4471228a5f41c7ad
https://github.com/roytam1/UXP/commit/bc4a8c542fa335aa01aefc07557354f96e671870

Write steps to install official VS2015+ and DX SDK for building with official tools instead of FWDK. (Although FWDK is highly recommended for massive space savings, but it falls apart when you want the VM for other compiling tasks so there's a case for both.)

Add git instructions here instead of linking to r3dfox guide.
k4sum1 who?

I might know what I'm doing not the hit album by brad sucks

Post Reply