Build Compile Firefox on Windows 10 To Get Rid Of Telemetry For Real This Time
The time had finally arrived for me to try to build Firefox on Windows again and this time I decided to see if I could get one of the ESR editions to build, because I didn't manage to succeed last time, so I ran some test builds before doing this video. The build process is very long, so you are going to want to use a half decent machine, so that you don't have to spend all day waiting for it. I also showed the various ways that you can disable the spying mechanisms, along with adding your own startup image and I also added options that would build it for the build machines specific processor. I ran this build on Windows 10 and even though the Mozilla build system use Clang as it's compiler, you still have to install certain Visual Studio components, because Microsoft obviously don't want to give away some of the secret guts of Windows.
1. Install MozillaBuild
https://ftp.mozilla.org/pub/mozilla/libraries/win32/
Get 3.4 not the latest
C:\mozilla-build\start-shell.bat
2. Bootstrap a copy of the Firefox source code
# Using the C:\mozilla-build\start-shell.bat shell from step 1:
cd c:/
mkdir mozilla-source
cd mozilla-source
Visual Studio 2019 installer
https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=16
Install:
C++ CLI support build tools
Windows 10 SDK for your build
C++ 2019 Redistributable MSMs
MSVC v142 VS2019 build tools
C++ ATL for latest v142 build tools
C++ MFC for latest v142 build tools
Ensure antivirus exclusions:
Microsoft Defender Antivirus and some third-party antivirus products are known to significantly degrade build times and sometimes even cause failed builds (due to a “missing file”). This is usually because we have tests for well-known security bugs that have code samples that antivirus software identifies as a threat, automatically quarantining/corrupting the files.
To avoid this, add the following directories to your third-party antivirus exclusion list:
The C:\mozilla-build directory.
The directory where the Firefox code is (probably C:\mozilla-source).
The %USERPROFILE%/.mozbuild directory (probably C:\Users\<user>\.mozbuild).
3. Build
Mozilla Mercurial bundles
https://hg.cdn.mozilla.net/
hg init mozilla-esr102
cd mozilla-esr102
hg unbundle /path/to/your/bundle.hg
hg pull https://hg.mozilla.org/mozilla-unified
hg update
./mach bootstrap
# check https://firefox-source-docs.mozilla.org/writing-rust-code/update-policy.html
rustup default 1.60.0
./mach bootstrap
Add the below #undef line to the below files if you want to:
#undef MOZ_TELEMETRY_REPORTING
accessible\windows\msaa\Platform.cpp
dom\base\nsFrameLoader.cpp
browser/app/winlauncher/ErrorHandler.cpp
modules/libpref/Preferences.cpp
toolkit/mozapps/defaultagent/Telemetry.cpp
toolkit/components/telemetry/core/Telemetry.cpp
# Add the below to the end of moz.configure
set_config("MOZ_DATA_REPORTING", False)
set_define("MOZ_TELEMETRY_REPORTING", False)
set_define("MOZ_SERVICES_HEALTHREPORT", False)
set_define("MOZ_DATA_REPORTING", False)
set_define("MOZ_UPDATE_AGENT", False)
set_define("MOZ_BLOCK_PROFILE_DOWNGRADE", False)
set_define("MOZ_NORMANDY", False)
set_define("MOZ_SERVICES_SYNC", False)
Change MOZ_TELEMETRY_REPORTING, MOZ_NORMANDY and MOZ_SERVICES_HEALTHREPORT to False in toolkit/moz.configure
# Change below file to add your background at 2400x1504
browser/components/newtab/data/content/assets/proton-bkg.avif
Edit below preferences file to change Firefox defaults
browser/app/profile/firefox.js
./mach build
./mach package