buildMozillaMach: use system onnxruntime, make profiling phase cheaper, prune patches (#436667)

This commit is contained in:
Martin Weinelt
2025-08-25 18:44:02 +02:00
committed by GitHub
8 changed files with 8 additions and 218 deletions
@@ -1,57 +0,0 @@
From 45d40b3eeb393051bd3a49feebcefe39dc6e4e93 Mon Sep 17 00:00:00 2001
From: Peter Collingbourne <pcc@google.com>
Date: Wed, 23 Apr 2025 21:13:38 -0700
Subject: [PATCH] build: fix RELRHACK_LINKER setting when linker name is target
triple prefixed
RELRHACK_LINKER is used as the name of a binary installed in a
directory specified with -B to override the linker. Both Clang and
GCC will only look for a binary named "ld" (or "ld.$fuse_ld_setting"
if -fuse-ld= is specified) in the -B directories, which means that
if the linker name does not follow this pattern, for example if it
is named $target_triple-ld", the relrhack linker will not be found,
the compiler will use the normal linker and the link will fail. To fix
this problem, use the correct pattern to name the relrhack executable.
---
toolkit/moz.configure | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/toolkit/moz.configure b/toolkit/moz.configure
index 6c47287a5b..1a9c368e5e 100644
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -1843,23 +1843,23 @@ with only_when("--enable-compile-environment"):
use_relrhack = depends(which_elf_hack)(lambda x: x == "relr")
set_config("RELRHACK", True, when=use_relrhack)
- @depends(c_compiler, linker_ldflags, when=use_relrhack)
- def relrhack_real_linker(c_compiler, linker_ldflags):
+ @depends(linker_ldflags, when=use_relrhack)
+ def relrhack_linker(linker_ldflags):
ld = "ld"
for flag in linker_ldflags:
if flag.startswith("-fuse-ld="):
ld = "ld." + flag[len("-fuse-ld=") :]
+ return ld
+
+ set_config("RELRHACK_LINKER", relrhack_linker)
+
+ @depends(c_compiler, relrhack_linker, when=use_relrhack)
+ def relrhack_real_linker(c_compiler, ld):
ld = check_cmd_output(
c_compiler.compiler, f"--print-prog-name={ld}", *c_compiler.flags
)
return ld.rstrip()
- @depends(relrhack_real_linker, when=use_relrhack)
- def relrhack_linker(ld):
- return os.path.basename(ld)
-
- set_config("RELRHACK_LINKER", relrhack_linker)
-
std_filesystem = host_cxx_compiler.try_run(
header="#include <filesystem>",
body='auto foo = std::filesystem::absolute("");',
--
2.49.0.805.g082f7c87e0-goog
@@ -90,6 +90,7 @@ in
nspr,
nss_esr,
nss_latest,
onnxruntime,
pango,
xorg,
zip,
@@ -303,15 +304,7 @@ buildStdenv.mkDerivation {
];
patches =
lib.optionals (lib.versionAtLeast version "111" && lib.versionOlder version "133") [
./env_var_for_system_dir-ff111.patch
]
++ lib.optionals (lib.versionAtLeast version "133") [ ./env_var_for_system_dir-ff133.patch ]
++ lib.optionals (lib.versionAtLeast version "121" && lib.versionOlder version "136") [
./no-buildconfig-ffx121.patch
]
++ lib.optionals (lib.versionAtLeast version "136") [ ./no-buildconfig-ffx136.patch ]
++ lib.optionals (lib.versionAtLeast version "139" && lib.versionOlder version "141") [
lib.optionals (lib.versionAtLeast version "139" && lib.versionOlder version "141") [
# https://bugzilla.mozilla.org/show_bug.cgi?id=1955112
# https://hg-edge.mozilla.org/mozilla-central/rev/aa8a29bd1fb9
./139-wayland-drag-animation.patch
@@ -325,24 +318,6 @@ buildStdenv.mkDerivation {
[
./142-relax-apple-sdk.patch
]
++ lib.optionals (lib.versionOlder version "139") [
# Fix for missing vector header on macOS
# https://bugzilla.mozilla.org/show_bug.cgi?id=1959377
# Fixed on Firefox 139
./firefox-mac-missing-vector-header.patch
]
++ lib.optionals (lib.versionOlder version "140") [
# https://bugzilla.mozilla.org/show_bug.cgi?id=1962497
# https://phabricator.services.mozilla.com/D246545
# Fixed on Firefox 140
./build-fix-RELRHACK_LINKER-setting-when-linker-name-i.patch
]
++ lib.optionals (lib.versionOlder version "138") [
# https://bugzilla.mozilla.org/show_bug.cgi?id=1941479
# https://phabricator.services.mozilla.com/D240572
# Fixed on Firefox 138
./firefox-cannot-find-type-Allocator.patch
]
++ extraPatches;
postPatch = ''
@@ -510,6 +485,9 @@ buildStdenv.mkDerivation {
(enableFeature pulseaudioSupport "pulseaudio")
(enableFeature sndioSupport "sndio")
]
++ lib.optionals (!buildStdenv.hostPlatform.isDarwin && lib.versionAtLeast version "141") [
"--with-onnx-runtime=${lib.getLib onnxruntime}/lib"
]
++ [
(enableFeature crashreporterSupport "crashreporter")
(enableFeature ffmpegSupport "ffmpeg")
@@ -595,6 +573,9 @@ buildStdenv.mkDerivation {
++ extraBuildInputs;
profilingPhase = lib.optionalString pgoSupport ''
# Avoid compressing the instrumented build with high levels of compression
export MOZ_PKG_FORMAT=tar
# Package up Firefox for profiling
./mach package
@@ -1,22 +0,0 @@
diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp
index 6db876975187..5882c5d7f1d6 100644
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -11,6 +11,7 @@
#include "jsapi.h"
#include "xpcpublic.h"
+#include "prenv.h"
#include "prprf.h"
#include "nsIAppStartup.h"
@@ -309,7 +310,8 @@ static nsresult GetSystemParentDirectory(nsIFile** aFile) {
"/usr/lib/mozilla"_ns
# endif
;
- rv = NS_NewNativeLocalFile(dirname, false, getter_AddRefs(localDir));
+ const char* pathVar = PR_GetEnv("MOZ_SYSTEM_DIR");
+ rv = NS_NewNativeLocalFile((pathVar && *pathVar) ? nsDependentCString(pathVar) : reinterpret_cast<const nsCString&>(dirname), false, getter_AddRefs(localDir));
# endif
if (NS_SUCCEEDED(rv)) {
@@ -1,22 +0,0 @@
diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp
index 6db876975187..5882c5d7f1d6 100644
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -11,6 +11,7 @@
#include "jsapi.h"
#include "xpcpublic.h"
+#include "prenv.h"
#include "prprf.h"
#include "nsIAppStartup.h"
@@ -297,7 +297,8 @@ static nsresult GetSystemParentDirectory(nsIFile** aFile) {
"/usr/lib/mozilla"_ns
# endif
;
- rv = NS_NewNativeLocalFile(dirname, getter_AddRefs(localDir));
+ const char* pathVar = PR_GetEnv("MOZ_SYSTEM_DIR");
+ rv = NS_NewNativeLocalFile((pathVar && *pathVar) ? nsDependentCString(pathVar) : reinterpret_cast<const nsCString&>(dirname), getter_AddRefs(localDir));
# endif
if (NS_SUCCEEDED(rv)) {
@@ -1,26 +0,0 @@
From 518049ce568d01413eeda304e8e9c341ab8849f6 Mon Sep 17 00:00:00 2001
From: Mike Hommey <mh+mozilla@glandium.org>
Date: Thu, 6 Mar 2025 09:36:10 +0000
Subject: [PATCH] Bug 1941479 - Mark mozilla::SmallPointerArray_Element as
opaque. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D240572
---
layout/style/ServoBindings.toml | 1 +
1 file changed, 1 insertion(+)
diff --git a/layout/style/ServoBindings.toml b/layout/style/ServoBindings.toml
index 86c6c3026ce7..2b9a34a81a0f 100644
--- a/layout/style/ServoBindings.toml
+++ b/layout/style/ServoBindings.toml
@@ -301,6 +301,7 @@ opaque-types = [
"mozilla::dom::Touch",
"mozilla::dom::Sequence",
"mozilla::SmallPointerArray",
+ "mozilla::SmallPointerArray_Element",
"mozilla::dom::Optional",
"mozilla::dom::OwningNodeOrString_Value",
"mozilla::dom::Nullable",
--
2.49.0
@@ -1,11 +0,0 @@
diff -r 8273f6f8f9b6 security/sandbox/mac/Sandbox.h
--- a/security/sandbox/mac/Sandbox.h Mon Sep 02 00:19:08 2024 +0000
+++ b/security/sandbox/mac/Sandbox.h Sun Dec 29 11:41:25 2024 -0500
@@ -7,6 +7,7 @@
#define mozilla_Sandbox_h
#include <string>
+#include <vector>
#include "mozilla/ipc/UtilityProcessSandboxing.h"
enum MacSandboxType {
@@ -1,27 +0,0 @@
diff --git a/docshell/base/nsAboutRedirector.cpp b/docshell/base/nsAboutRedirector.cpp
index cfbc39527b02..9327631a79c5 100644
--- a/docshell/base/nsAboutRedirector.cpp
+++ b/docshell/base/nsAboutRedirector.cpp
@@ -88,9 +88,6 @@ static const RedirEntry kRedirMap[] = {
{"about", "chrome://global/content/aboutAbout.html", 0},
{"addons", "chrome://mozapps/content/extensions/aboutaddons.html",
nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::IS_SECURE_CHROME_UI},
- {"buildconfig", "chrome://global/content/buildconfig.html",
- nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
- nsIAboutModule::IS_SECURE_CHROME_UI},
{"checkerboard", "chrome://global/content/aboutCheckerboard.html",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::ALLOW_SCRIPT},
diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn
index ed7c2ad3fc30..ff54456a6582 100644
--- a/toolkit/content/jar.mn
+++ b/toolkit/content/jar.mn
@@ -41,8 +41,6 @@ toolkit.jar:
content/global/aboutUrlClassifier.js
content/global/aboutUrlClassifier.xhtml
content/global/aboutUrlClassifier.css
-* content/global/buildconfig.html
- content/global/buildconfig.css
content/global/contentAreaUtils.js
content/global/datepicker.xhtml
#ifndef MOZ_FENNEC
@@ -1,26 +0,0 @@
diff --git a/docshell/base/nsAboutRedirector.cpp b/docshell/base/nsAboutRedirector.cpp
index 16888323d7..b96450a247 100644
--- a/docshell/base/nsAboutRedirector.cpp
+++ b/docshell/base/nsAboutRedirector.cpp
@@ -90,9 +90,6 @@ static const RedirEntry kRedirMap[] = {
{"addons", "chrome://mozapps/content/extensions/aboutaddons.html",
nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::IS_SECURE_CHROME_UI},
#endif
- {"buildconfig", "chrome://global/content/buildconfig.html",
- nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
- nsIAboutModule::IS_SECURE_CHROME_UI},
{"checkerboard", "chrome://global/content/aboutCheckerboard.html",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::ALLOW_SCRIPT},
diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn
index eb6c179b60..57568668b1 100644
--- a/toolkit/content/jar.mn
+++ b/toolkit/content/jar.mn
@@ -40,7 +40,6 @@ toolkit.jar:
content/global/aboutUrlClassifier.js
content/global/aboutUrlClassifier.xhtml
content/global/aboutUrlClassifier.css
-* content/global/buildconfig.html
content/global/buildconfig.css
content/global/contentAreaUtils.js
content/global/datepicker.xhtml