Files
Ryan VanderMeulen 2ef77c8c6d Bug 2067508 - updated abseil-cpp patch stack. r=firefox-build-system-reviewers,sergesanspaille
Rebased onto chromium third_party cd3dd0a61f8. Drops the ABSL_HAVE_THREAD_SANITIZER
and ABSL_HAVE_LEAK_SANITIZER disables, which the preceding system-header change makes
unnecessary; the -Wsign-compare suppression, which protobuf v36 no longer needs; and
the android api < 17 SYS_mmap2 patch, replaced by the next commit. Consolidates the
remaining eleven local patches into six.

Differential Revision: https://phabricator.services.mozilla.com/D322121
2026-09-01 13:02:39 +00:00

191 lines
6.7 KiB
Diff

From: Ryan VanderMeulen <rvandermeulen@mozilla.com>
Date: Sun, 23 Aug 2026 13:55:19 -0400
Subject: Bug 1921707 - abseil-cpp gn build integration.
Relocates abseil out of libwebrtc: preprocessor/.json/.gni/*.gn changes, dep-path
filtering from //third_party/abseil-cpp/ to //, and pointing at the new build
directory location. Squashed from four commits that were all the same change.
---
abseil-cpp/.gn | 10 ++++++
abseil-cpp/BUILD.gn | 8 ++---
abseil-cpp/absl.gni | 83 +++++++++++++++++++++++++++++++++++++--------
3 files changed, 83 insertions(+), 18 deletions(-)
create mode 100644 abseil-cpp/.gn
diff --git a/abseil-cpp/.gn b/abseil-cpp/.gn
new file mode 100644
index 00000000000..bd6c38b3762
--- /dev/null
+++ b/abseil-cpp/.gn
@@ -0,0 +1,10 @@
+# The location of the build configuration file.
+buildconfig = "//chromium/build/config/BUILDCONFIG.gn"
+script_executable = "python3"
+secondary_source = "//abseil-cpp/"
+
+default_args = {
+use_custom_libcxx = false
+is_component_build = false
+}
+
diff --git a/abseil-cpp/BUILD.gn b/abseil-cpp/BUILD.gn
index 72c1655fee0..3b1cb12de3e 100644
--- a/abseil-cpp/BUILD.gn
+++ b/abseil-cpp/BUILD.gn
@@ -6,10 +6,10 @@
# opts will be linked together, and in some cases headers compiled with and
# without these options will be part of the same program.
-import("//build/config/c++/c++.gni")
-import("//build/config/compiler/compiler.gni")
-import("//build/config/sanitizers/sanitizers.gni")
-import("//build/toolchain/toolchain.gni")
+import("//chromium/build/config/c++/c++.gni")
+import("//chromium/build/config/compiler/compiler.gni")
+import("//chromium/build/config/sanitizers/sanitizers.gni")
+import("//chromium/build/toolchain/toolchain.gni")
import("//build_overrides/build.gni")
import("//third_party/abseil-cpp/absl.gni")
diff --git a/abseil-cpp/absl.gni b/abseil-cpp/absl.gni
index 5ec01f6d23c..3632789e941 100644
--- a/abseil-cpp/absl.gni
+++ b/abseil-cpp/absl.gni
@@ -21,6 +21,7 @@ import("//build_overrides/build.gni")
declare_args() {
absl_build_tests = build_with_chromium
+ moz_webrtc_build = true
}
template("absl_source_set") {
@@ -29,12 +30,12 @@ template("absl_source_set") {
not_needed(invoker, "*")
} else {
forward_variables_from(invoker, "*")
- configs -= [ "//build/config/compiler:chromium_code" ]
+ configs -= [ "//chromium/build/config/compiler:chromium_code" ]
configs += [
- "//build/config/compiler:no_chromium_code",
- "//build/config/compiler:prevent_unsafe_narrowing",
- "//third_party/abseil-cpp:absl_default_cflags_cc",
- "//third_party/abseil-cpp:absl_define_config",
+ "//chromium/build/config/compiler:no_chromium_code",
+ "//chromium/build/config/compiler:prevent_unsafe_narrowing",
+ "//abseil-cpp:absl_default_cflags_cc",
+ "//abseil-cpp:absl_define_config",
]
if (!defined(defines)) {
@@ -43,15 +44,15 @@ template("absl_source_set") {
if (is_component_build) {
defines += [ "ABSL_BUILD_DLL" ]
if (!is_win && current_os != "aix") {
- configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
- configs += [ "//build/config/gcc:symbol_visibility_default" ]
+ configs -= [ "//chromium/build/config/gcc:symbol_visibility_hidden" ]
+ configs += [ "//chromium/build/config/gcc:symbol_visibility_default" ]
}
}
if (!defined(public_configs)) {
public_configs = []
}
- public_configs += [ "//third_party/abseil-cpp:absl_include_config" ]
+ public_configs += [ "//abseil-cpp:absl_include_config" ]
if (!defined(visibility)) {
# Within Chromium builds, restrict direct visibility of Abseil sources,
@@ -79,6 +80,45 @@ template("absl_source_set") {
visibility = [ "*" ]
}
}
+ visibility += [ "//abseil-cpp/*" ]
+
+ # Now that abseil-cpp lives under Mozilla's third_party instead
+ # of under libwebrtc's third_party and is built as a stand-alone
+ # library, we need to "re-root" the dependency paths. We can
+ # modify the dependencies here to avoid modifying most, if not
+ # all, of the BUILD.gn files.
+ if (defined(deps)) {
+ modified_deps = []
+ foreach (dep, deps) {
+ newdep = string_replace(dep, "//third_party/abseil-cpp/", "//")
+ newdep = string_replace(newdep, "//build", "//chromium/build")
+ modified_deps += [ newdep ]
+ }
+ deps = []
+ deps = modified_deps
+ }
+
+ # Same for public_deps
+ if (defined(public_deps)) {
+ modified_deps = []
+ foreach (dep, public_deps) {
+ newdep = string_replace(dep, "//third_party/abseil-cpp/", "//")
+ modified_deps += [ newdep ]
+ }
+ public_deps = []
+ public_deps = modified_deps
+ }
+
+ # Same for visibility
+ if (defined(visibility)) {
+ modified_deps = []
+ foreach (dep, visibility) {
+ newdep = string_replace(dep, "//third_party/abseil-cpp/", "//")
+ modified_deps += [ newdep ]
+ }
+ visibility = []
+ visibility = modified_deps
+ }
}
}
}
@@ -90,18 +130,18 @@ template("absl_test") {
} else {
forward_variables_from(invoker, "*")
testonly = true
- configs -= [ "//build/config/compiler:chromium_code" ]
+ configs -= [ "//chromium/build/config/compiler:chromium_code" ]
configs += [
- "//build/config/compiler:no_chromium_code",
- "//third_party/abseil-cpp:absl_default_cflags_cc",
- "//third_party/abseil-cpp:absl_define_config",
- "//third_party/abseil-cpp:absl_test_config",
+ "//chromium/build/config/compiler:no_chromium_code",
+ "//abseil-cpp:absl_default_cflags_cc",
+ "//abseil-cpp:absl_define_config",
+ "//abseil-cpp:absl_test_config",
]
if (!defined(public_configs)) {
public_configs = []
}
- public_configs += [ "//third_party/abseil-cpp:absl_include_config" ]
+ public_configs += [ "//abseil-cpp:absl_include_config" ]
visibility = [ "//third_party/abseil-cpp/:*" ]
deps += [
@@ -109,5 +149,20 @@ template("absl_test") {
"//third_party/googletest:gtest",
]
}
+
+ # Now that abseil-cpp lives under Mozilla's third_party instead
+ # of under libwebrtc's third_party and is built as a stand-alone
+ # library, we need to "re-root" the dependency paths. We can
+ # modify the dependencies here to avoid modifying most, if not
+ # all, of the BUILD.gn files.
+ if (defined(deps)) {
+ modified_deps = []
+ foreach (dep, deps) {
+ newdep = string_replace(dep, "//third_party/abseil-cpp/", "//")
+ modified_deps += [ newdep ]
+ }
+ deps = []
+ deps = modified_deps
+ }
}
}