Skip to Content.
Sympa Menu

sm-commit - [[SM-Commit] ] GIT changes to master grimoire by Pavel Vinogradov (c3c1ccdff8fe43e28b21653bd4238e80ddb1d775)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Pavel Vinogradov <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [[SM-Commit] ] GIT changes to master grimoire by Pavel Vinogradov (c3c1ccdff8fe43e28b21653bd4238e80ddb1d775)
  • Date: Fri, 2 Feb 2024 22:58:35 +0000

GIT changes to master grimoire by Pavel Vinogradov <public AT sourcemage.org>:

http/firefox/HISTORY
| 3
http/firefox/patches/0020-bmo-1516803-gcc-lto-sandbox.patch
| 16
http/firefox/patches/0021-bmo-1516803-gcc-lto-sandbox.patch
| 16
http/firefox/patches/0021-enable-vaapi-on-all-amd-cards.patch
| 19
http/firefox/patches/0022-bgo-907963-rustflags-single-string.patch
| 76
http/firefox/patches/0022-enable-vaapi-on-all-amd-cards.patch
| 19
http/firefox/patches/0023-bgo-907963-rustflags-single-string.patch
| 76

http/firefox/patches/0023-bgo-910309-dont-link-widevineplugin-to-libgcc_s.patch
| 20

http/firefox/patches/0024-bgo-910309-dont-link-widevineplugin-to-libgcc_s.patch
| 20
http/firefox/patches/0024-gcc-lto-patch-from-fedora.patch
| 117 +
http/firefox/patches/0025-bmo-1862601-system-icu-74.patch
| 41
http/firefox/patches/0025-gcc-lto-patch-from-fedora.patch
| 117 -
http/firefox/patches/0026-bgo-748849-RUST_TARGET_override.patch
| 61
http/firefox/patches/0026-bmo-1862601-system-icu-74.patch
| 41
http/firefox/patches/0027-bgo-748849-RUST_TARGET_override.patch
| 61
http/firefox/patches/0027-bmo-1743144-add-wayland-proxy-cache.patch
| 1029 ++++++++++
http/firefox/patches/0028-bgo-919418-ppc64-flac-decoder-unsupported.patch
| 11
http/firefox/patches/0028-bmo-1743144-add-wayland-proxy-cache.patch
| 1029 ----------
http/firefox/patches/0029-bgo-919418-ppc64-flac-decoder-unsupported.patch
| 11
http/firefox/patches/0029-bmo-1793001-switch-egrep-to-grepE.patch
| 171 +
http/firefox/patches/0030-bmo-1793001-switch-egrep-to-grepE.patch
| 171 -
21 files changed, 1564 insertions(+), 1561 deletions(-)

New commits:
commit c3c1ccdff8fe43e28b21653bd4238e80ddb1d775
Author: Pavel Vinogradov <public AT sourcemage.org>
Commit: Pavel Vinogradov <public AT sourcemage.org>

http/firefox: updated patches for 122.0

diff --git a/http/firefox/HISTORY b/http/firefox/HISTORY
index 94c43db..b2a6fea 100644
--- a/http/firefox/HISTORY
+++ b/http/firefox/HISTORY
@@ -1,3 +1,6 @@
+2024-02-02 Pavel Vinogradov <public AT sourcemage.org>
+ * patches/*: updated
+
2024-01-23 Pavel Vinogradov <public AT sourcemage.org>
* DETAILS: version 122.0, SECURITY_PATCH++
* patches/*: updated
diff --git a/http/firefox/patches/0020-bmo-1516803-gcc-lto-sandbox.patch
b/http/firefox/patches/0020-bmo-1516803-gcc-lto-sandbox.patch
new file mode 100644
index 0000000..eff08f6
--- /dev/null
+++ b/http/firefox/patches/0020-bmo-1516803-gcc-lto-sandbox.patch
@@ -0,0 +1,16 @@
+diff -Naur a/security/sandbox/linux/moz.build
b/security/sandbox/linux/moz.build
+--- a/security/sandbox/linux/moz.build 2023-07-04 13:57:56.029462755 +0300
++++ b/security/sandbox/linux/moz.build 2023-07-04 14:05:08.607221195 +0300
+@@ -114,9 +114,9 @@
+ # gcc lto likes to put the top level asm in syscall.cc in a different
partition
+ # from the function using it which breaks the build. Work around that by
+ # forcing there to be only one partition.
+-for f in CONFIG["OS_CXXFLAGS"]:
+- if f.startswith("-flto") and CONFIG["CC_TYPE"] != "clang":
+- LDFLAGS += ["--param lto-partitions=1"]
++if CONFIG['CC_TYPE'] != 'clang':
++ LDFLAGS += ['--param', 'lto-partitions=1']
++
+
+ DEFINES["NS_NO_XPCOM"] = True
+ DisableStlWrapping()
diff --git a/http/firefox/patches/0021-bmo-1516803-gcc-lto-sandbox.patch
b/http/firefox/patches/0021-bmo-1516803-gcc-lto-sandbox.patch
deleted file mode 100644
index eff08f6..0000000
--- a/http/firefox/patches/0021-bmo-1516803-gcc-lto-sandbox.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-diff -Naur a/security/sandbox/linux/moz.build
b/security/sandbox/linux/moz.build
---- a/security/sandbox/linux/moz.build 2023-07-04 13:57:56.029462755 +0300
-+++ b/security/sandbox/linux/moz.build 2023-07-04 14:05:08.607221195 +0300
-@@ -114,9 +114,9 @@
- # gcc lto likes to put the top level asm in syscall.cc in a different
partition
- # from the function using it which breaks the build. Work around that by
- # forcing there to be only one partition.
--for f in CONFIG["OS_CXXFLAGS"]:
-- if f.startswith("-flto") and CONFIG["CC_TYPE"] != "clang":
-- LDFLAGS += ["--param lto-partitions=1"]
-+if CONFIG['CC_TYPE'] != 'clang':
-+ LDFLAGS += ['--param', 'lto-partitions=1']
-+
-
- DEFINES["NS_NO_XPCOM"] = True
- DisableStlWrapping()
diff --git a/http/firefox/patches/0021-enable-vaapi-on-all-amd-cards.patch
b/http/firefox/patches/0021-enable-vaapi-on-all-amd-cards.patch
new file mode 100644
index 0000000..112cd42
--- /dev/null
+++ b/http/firefox/patches/0021-enable-vaapi-on-all-amd-cards.patch
@@ -0,0 +1,19 @@
+diff -up firefox-115.0/widget/gtk/GfxInfo.cpp.firefox-enable-vaapi
firefox-115.0/widget/gtk/GfxInfo.cpp
+--- firefox-115.0/widget/gtk/GfxInfo.cpp.firefox-enable-vaapi 2023-06-29
12:18:53.179833765 +0200
++++ firefox-115.0/widget/gtk/GfxInfo.cpp 2023-06-29 12:19:33.256212776
+0200
+@@ -970,14 +970,6 @@ const nsTArray<GfxDriverInfo>& GfxInfo::
+ nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_COMPARISON_IGNORED,
+ V(0, 0, 0, 0), "FEATURE_HARDWARE_VIDEO_DECODING_NO_R600", "");
+
+- // Disable on Release/late Beta on AMD
+-#if !defined(EARLY_BETA_OR_EARLIER)
+- APPEND_TO_DRIVER_BLOCKLIST(OperatingSystem::Linux, DeviceFamily::AtiAll,
+- nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING,
+- nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
+- DRIVER_COMPARISON_IGNORED, V(0, 0, 0, 0),
+- "FEATURE_HARDWARE_VIDEO_DECODING_DISABLE",
"");
+-#endif
+ ////////////////////////////////////
+ // FEATURE_HW_DECODED_VIDEO_ZERO_COPY - ALLOWLIST
+ APPEND_TO_DRIVER_BLOCKLIST2(OperatingSystem::Linux, DeviceFamily::All,
+
diff --git
a/http/firefox/patches/0022-bgo-907963-rustflags-single-string.patch
b/http/firefox/patches/0022-bgo-907963-rustflags-single-string.patch
new file mode 100644
index 0000000..a56aec4
--- /dev/null
+++ b/http/firefox/patches/0022-bgo-907963-rustflags-single-string.patch
@@ -0,0 +1,76 @@
+--- firefox-111.0.1/build/moz.configure/rust.configure 2023-03-21
06:16:03.000000000 -0700
++++ firefox-111.0.1/build/moz.configure/rust.configure.new 2023-04-05
08:57:29.403219120 -0700
+@@ -593,7 +593,7 @@
+
+ # ==============================================================
+
+-option(env="RUSTFLAGS", nargs=1, help="Rust compiler flags")
++option(env="RUSTFLAGS", nargs=1, help="Rust compiler flags",
comma_split=False)
+ set_config("RUSTFLAGS", depends("RUSTFLAGS")(lambda flags: flags))
+
+
+--- firefox-111.0.1/python/mozbuild/mozbuild/configure/options.py
2023-03-21 06:16:09.000000000 -0700
++++ firefox-111.0.1/python/mozbuild/mozbuild/configure/options.py.new
2023-04-05 08:57:31.270193468 -0700
+@@ -191,6 +191,10 @@
+ to instantiate an option indirectly. Set this to a positive integer to
+ force the script to look into a deeper stack frame when inferring the
+ `category`.
++ - `comma_split` specifies whether the value string should be split on
++ commas. The default is True. Setting it False is necessary for things
++ like compiler flags which should be a single string that may contain
++ commas.
+ """
+
+ __slots__ = (
+@@ -205,6 +209,7 @@
+ "possible_origins",
+ "category",
+ "define_depth",
++ "comma_split",
+ )
+
+ def __init__(
+@@ -218,6 +223,7 @@
+ category=None,
+ help=None,
+ define_depth=0,
++ comma_split=True,
+ ):
+ if not name and not env:
+ raise InvalidOptionError(
+@@ -335,9 +341,10 @@
+ self.choices = choices
+ self.help = help
+ self.category = category or _infer_option_category(define_depth)
++ self.comma_split = comma_split
+
+ @staticmethod
+- def split_option(option):
++ def split_option(option, comma_split=True):
+ """Split a flag or variable into a prefix, a name and values
+
+ Variables come in the form NAME=values (no prefix).
+@@ -350,7 +357,13 @@
+
+ elements = option.split("=", 1)
+ name = elements[0]
+- values = tuple(elements[1].split(",")) if len(elements) == 2 else ()
++ if len(elements) == 2:
++ if comma_split:
++ values = tuple(elements[1].split(","))
++ else:
++ values = (elements[1],)
++ else:
++ values = ()
+ if name.startswith("--"):
+ name = name[2:]
+ if not name.islower():
+@@ -426,7 +439,7 @@
+ % (option, origin, ", ".join(self.possible_origins))
+ )
+
+- prefix, name, values = self.split_option(option)
++ prefix, name, values = self.split_option(option, self.comma_split)
+ option = self._join_option(prefix, name)
+
+ assert name in (self.name, self.env)
diff --git a/http/firefox/patches/0022-enable-vaapi-on-all-amd-cards.patch
b/http/firefox/patches/0022-enable-vaapi-on-all-amd-cards.patch
deleted file mode 100644
index 112cd42..0000000
--- a/http/firefox/patches/0022-enable-vaapi-on-all-amd-cards.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-diff -up firefox-115.0/widget/gtk/GfxInfo.cpp.firefox-enable-vaapi
firefox-115.0/widget/gtk/GfxInfo.cpp
---- firefox-115.0/widget/gtk/GfxInfo.cpp.firefox-enable-vaapi 2023-06-29
12:18:53.179833765 +0200
-+++ firefox-115.0/widget/gtk/GfxInfo.cpp 2023-06-29 12:19:33.256212776
+0200
-@@ -970,14 +970,6 @@ const nsTArray<GfxDriverInfo>& GfxInfo::
- nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_COMPARISON_IGNORED,
- V(0, 0, 0, 0), "FEATURE_HARDWARE_VIDEO_DECODING_NO_R600", "");
-
-- // Disable on Release/late Beta on AMD
--#if !defined(EARLY_BETA_OR_EARLIER)
-- APPEND_TO_DRIVER_BLOCKLIST(OperatingSystem::Linux, DeviceFamily::AtiAll,
-- nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING,
-- nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
-- DRIVER_COMPARISON_IGNORED, V(0, 0, 0, 0),
-- "FEATURE_HARDWARE_VIDEO_DECODING_DISABLE",
"");
--#endif
- ////////////////////////////////////
- // FEATURE_HW_DECODED_VIDEO_ZERO_COPY - ALLOWLIST
- APPEND_TO_DRIVER_BLOCKLIST2(OperatingSystem::Linux, DeviceFamily::All,
-
diff --git
a/http/firefox/patches/0023-bgo-907963-rustflags-single-string.patch
b/http/firefox/patches/0023-bgo-907963-rustflags-single-string.patch
deleted file mode 100644
index a56aec4..0000000
--- a/http/firefox/patches/0023-bgo-907963-rustflags-single-string.patch
+++ /dev/null
@@ -1,76 +0,0 @@
---- firefox-111.0.1/build/moz.configure/rust.configure 2023-03-21
06:16:03.000000000 -0700
-+++ firefox-111.0.1/build/moz.configure/rust.configure.new 2023-04-05
08:57:29.403219120 -0700
-@@ -593,7 +593,7 @@
-
- # ==============================================================
-
--option(env="RUSTFLAGS", nargs=1, help="Rust compiler flags")
-+option(env="RUSTFLAGS", nargs=1, help="Rust compiler flags",
comma_split=False)
- set_config("RUSTFLAGS", depends("RUSTFLAGS")(lambda flags: flags))
-
-
---- firefox-111.0.1/python/mozbuild/mozbuild/configure/options.py
2023-03-21 06:16:09.000000000 -0700
-+++ firefox-111.0.1/python/mozbuild/mozbuild/configure/options.py.new
2023-04-05 08:57:31.270193468 -0700
-@@ -191,6 +191,10 @@
- to instantiate an option indirectly. Set this to a positive integer to
- force the script to look into a deeper stack frame when inferring the
- `category`.
-+ - `comma_split` specifies whether the value string should be split on
-+ commas. The default is True. Setting it False is necessary for things
-+ like compiler flags which should be a single string that may contain
-+ commas.
- """
-
- __slots__ = (
-@@ -205,6 +209,7 @@
- "possible_origins",
- "category",
- "define_depth",
-+ "comma_split",
- )
-
- def __init__(
-@@ -218,6 +223,7 @@
- category=None,
- help=None,
- define_depth=0,
-+ comma_split=True,
- ):
- if not name and not env:
- raise InvalidOptionError(
-@@ -335,9 +341,10 @@
- self.choices = choices
- self.help = help
- self.category = category or _infer_option_category(define_depth)
-+ self.comma_split = comma_split
-
- @staticmethod
-- def split_option(option):
-+ def split_option(option, comma_split=True):
- """Split a flag or variable into a prefix, a name and values
-
- Variables come in the form NAME=values (no prefix).
-@@ -350,7 +357,13 @@
-
- elements = option.split("=", 1)
- name = elements[0]
-- values = tuple(elements[1].split(",")) if len(elements) == 2 else ()
-+ if len(elements) == 2:
-+ if comma_split:
-+ values = tuple(elements[1].split(","))
-+ else:
-+ values = (elements[1],)
-+ else:
-+ values = ()
- if name.startswith("--"):
- name = name[2:]
- if not name.islower():
-@@ -426,7 +439,7 @@
- % (option, origin, ", ".join(self.possible_origins))
- )
-
-- prefix, name, values = self.split_option(option)
-+ prefix, name, values = self.split_option(option, self.comma_split)
- option = self._join_option(prefix, name)
-
- assert name in (self.name, self.env)
diff --git
a/http/firefox/patches/0023-bgo-910309-dont-link-widevineplugin-to-libgcc_s.patch

b/http/firefox/patches/0023-bgo-910309-dont-link-widevineplugin-to-libgcc_s.patch
new file mode 100644
index 0000000..bb0621a
--- /dev/null
+++
b/http/firefox/patches/0023-bgo-910309-dont-link-widevineplugin-to-libgcc_s.patch
@@ -0,0 +1,20 @@
+--- a/security/sandbox/linux/Sandbox.cpp 2023-07-10 20:29:48.000000000 +0100
++++ b/security/sandbox/linux/Sandbox.cpp 2023-07-15 09:13:43.561724668
+0100
+@@ -18,6 +18,8 @@
+ #include <dirent.h>
+ #ifdef NIGHTLY_BUILD
+ # include "dlfcn.h"
++#else
++# include <dlfcn.h>
+ #endif
+ #include <errno.h>
+ #include <fcntl.h>
+@@ -685,7 +687,7 @@
+ files->Add("/proc/stat", SandboxOpenedFile::Error{});
+ files->Add("/proc/net/unix", SandboxOpenedFile::Error{});
+ files->Add("/proc/self/maps", SandboxOpenedFile::Error{});
+-
++ Unused << dlopen("libgcc_s.so.1", RTLD_GLOBAL|RTLD_LAZY);
+ // Finally, start the sandbox.
+ SetCurrentProcessSandbox(GetMediaSandboxPolicy(files));
+ }
\ No newline at end of file
diff --git
a/http/firefox/patches/0024-bgo-910309-dont-link-widevineplugin-to-libgcc_s.patch

b/http/firefox/patches/0024-bgo-910309-dont-link-widevineplugin-to-libgcc_s.patch
deleted file mode 100644
index bb0621a..0000000
---
a/http/firefox/patches/0024-bgo-910309-dont-link-widevineplugin-to-libgcc_s.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/security/sandbox/linux/Sandbox.cpp 2023-07-10 20:29:48.000000000 +0100
-+++ b/security/sandbox/linux/Sandbox.cpp 2023-07-15 09:13:43.561724668
+0100
-@@ -18,6 +18,8 @@
- #include <dirent.h>
- #ifdef NIGHTLY_BUILD
- # include "dlfcn.h"
-+#else
-+# include <dlfcn.h>
- #endif
- #include <errno.h>
- #include <fcntl.h>
-@@ -685,7 +687,7 @@
- files->Add("/proc/stat", SandboxOpenedFile::Error{});
- files->Add("/proc/net/unix", SandboxOpenedFile::Error{});
- files->Add("/proc/self/maps", SandboxOpenedFile::Error{});
--
-+ Unused << dlopen("libgcc_s.so.1", RTLD_GLOBAL|RTLD_LAZY);
- // Finally, start the sandbox.
- SetCurrentProcessSandbox(GetMediaSandboxPolicy(files));
- }
\ No newline at end of file
diff --git a/http/firefox/patches/0024-gcc-lto-patch-from-fedora.patch
b/http/firefox/patches/0024-gcc-lto-patch-from-fedora.patch
new file mode 100644
index 0000000..3ce9593
--- /dev/null
+++ b/http/firefox/patches/0024-gcc-lto-patch-from-fedora.patch
@@ -0,0 +1,117 @@
+diff -up firefox-122.0/build/moz.configure/lto-pgo.configure.pgo
firefox-122.0/build/moz.configure/lto-pgo.configure
+--- firefox-122.0/build/moz.configure/lto-pgo.configure.pgo 2024-01-18
21:41:19.000000000 +0100
++++ firefox-122.0/build/moz.configure/lto-pgo.configure 2024-01-19
18:21:17.974681504 +0100
+@@ -86,7 +86,7 @@ def pgo_flags(compiler, profdata, target
+ return namespace(
+ gen_cflags=["-fprofile-generate"],
+ gen_ldflags=["-fprofile-generate"],
+- use_cflags=["-fprofile-use", "-fprofile-correction",
"-Wcoverage-mismatch"],
++ use_cflags=["-fprofile-use", "-fprofile-correction",
"-Wno-coverage-mismatch"],
+ use_ldflags=["-fprofile-use"],
+ )
+
+diff -up firefox-122.0/build/pgo/profileserver.py.pgo
firefox-122.0/build/pgo/profileserver.py
+--- firefox-122.0/build/pgo/profileserver.py.pgo 2024-01-18
21:41:20.000000000 +0100
++++ firefox-122.0/build/pgo/profileserver.py 2024-01-19 18:21:17.974681504
+0100
+@@ -11,7 +11,7 @@ import subprocess
+ import sys
+
+ import mozcrash
+-from mozbuild.base import BinaryNotFoundException, MozbuildObject
++from mozbuild.base import BinaryNotFoundException, MozbuildObject,
BuildEnvironmentNotFoundException
+ from mozfile import TemporaryDirectory
+ from mozhttpd import MozHttpd
+ from mozprofile import FirefoxProfile, Preferences
+@@ -98,9 +98,22 @@ if __name__ == "__main__":
+ locations = ServerLocations()
+ locations.add_host(host="127.0.0.1", port=PORT,
options="primary,privileged")
+
+- old_profraw_files = glob.glob("*.profraw")
+- for f in old_profraw_files:
+- os.remove(f)
++ using_gcc = False
++ try:
++ if build.config_environment.substs.get('CC_TYPE') == 'gcc':
++ using_gcc = True
++ except BuildEnvironmentNotFoundException:
++ pass
++
++ if using_gcc:
++ for dirpath, _, filenames in os.walk('.'):
++ for f in filenames:
++ if f.endswith('.gcda'):
++ os.remove(os.path.join(dirpath, f))
++ else:
++ old_profraw_files = glob.glob('*.profraw')
++ for f in old_profraw_files:
++ os.remove(f)
+
+ with TemporaryDirectory() as profilePath:
+ # TODO: refactor this into mozprofile
+diff -up firefox-122.0/gfx/2d/moz.build.pgo firefox-122.0/gfx/2d/moz.build
+--- firefox-122.0/gfx/2d/moz.build.pgo 2024-01-18 21:41:22.000000000 +0100
++++ firefox-122.0/gfx/2d/moz.build 2024-01-19 18:21:17.974681504 +0100
+@@ -137,11 +137,11 @@ if CONFIG["INTEL_ARCHITECTURE"]:
+ # The file uses SSE2 intrinsics, so it needs special compile flags on
some
+ # compilers.
+ SOURCES["BlurSSE2.cpp"].flags += CONFIG["SSE2_FLAGS"]
+- SOURCES["ConvolutionFilterAVX2.cpp"].flags += ["-mavx2"]
++ SOURCES["ConvolutionFilterAVX2.cpp"].flags += ["-mavx2", "-fno-lto"]
+ SOURCES["ConvolutionFilterSSE2.cpp"].flags += CONFIG["SSE2_FLAGS"]
+ SOURCES["FilterProcessingSSE2.cpp"].flags += CONFIG["SSE2_FLAGS"]
+ SOURCES["ImageScalingSSE2.cpp"].flags += CONFIG["SSE2_FLAGS"]
+- SOURCES["SwizzleAVX2.cpp"].flags += ["-mavx2"]
++ SOURCES["SwizzleAVX2.cpp"].flags += ["-mavx2", "-fno-lto"]
+ SOURCES["SwizzleSSE2.cpp"].flags += CONFIG["SSE2_FLAGS"]
+ SOURCES["SwizzleSSSE3.cpp"].flags += CONFIG["SSSE3_FLAGS"]
+ SOURCES["ssse3-scaler.c"].flags += CONFIG["SSSE3_FLAGS"]
+diff -up firefox-122.0/gfx/skia/generate_mozbuild.py.pgo
firefox-122.0/gfx/skia/generate_mozbuild.py
+--- firefox-122.0/gfx/skia/generate_mozbuild.py.pgo 2024-01-19
18:21:17.975681537 +0100
++++ firefox-122.0/gfx/skia/generate_mozbuild.py 2024-01-19
18:24:15.494934133 +0100
+@@ -54,10 +54,10 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'wind
+ if CONFIG['INTEL_ARCHITECTURE']:
+ SOURCES['skia/src/opts/SkOpts_ssse3.cpp'].flags +=
['-Dskvx=skvx_ssse3', '-mssse3']
+ SOURCES['skia/src/opts/SkOpts_sse42.cpp'].flags +=
['-Dskvx=skvx_sse42', '-msse4.2']
+- SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += ['-Dskvx=skvx_avx',
'-mavx']
+- SOURCES['skia/src/opts/SkOpts_hsw.cpp'].flags += ['-Dskvx=skvx_hsw',
'-mavx2', '-mf16c', '-mfma']
++ SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += ['-Dskvx=skvx_avx',
'-mavx', '-fno-lto']
++ SOURCES['skia/src/opts/SkOpts_hsw.cpp'].flags += ['-Dskvx=skvx_hsw',
'-mavx2', '-mf16c', '-mfma', '-fno-lto']
+ if not CONFIG["MOZ_CODE_COVERAGE"]:
+- SOURCES['skia/src/opts/SkOpts_skx.cpp'].flags +=
['-Dskvx=skvx_skx', '-mavx512f', '-mavx512dq', '-mavx512cd', '-mavx512bw',
'-mavx512vl']
++ SOURCES['skia/src/opts/SkOpts_skx.cpp'].flags +=
['-Dskvx=skvx_skx', '-mavx512f', '-mavx512dq', '-mavx512cd', '-mavx512bw',
'-mavx512vl', '-fno-lto']
+ elif CONFIG['TARGET_CPU'] == 'aarch64' and CONFIG['CC_TYPE'] in ('clang',
'gcc'):
+ SOURCES['skia/src/opts/SkOpts_crc32.cpp'].flags +=
['-Dskvx=skvx_crc32', '-march=armv8-a+crc']
+
+diff -up firefox-122.0/gfx/skia/moz.build.pgo
firefox-122.0/gfx/skia/moz.build
+--- firefox-122.0/gfx/skia/moz.build.pgo 2024-01-19 18:21:17.975681537
+0100
++++ firefox-122.0/gfx/skia/moz.build 2024-01-19 18:25:13.472039275 +0100
+@@ -564,10 +564,10 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'wind
+ if CONFIG['INTEL_ARCHITECTURE']:
+ SOURCES['skia/src/opts/SkOpts_ssse3.cpp'].flags +=
['-Dskvx=skvx_ssse3', '-mssse3']
+ SOURCES['skia/src/opts/SkOpts_sse42.cpp'].flags +=
['-Dskvx=skvx_sse42', '-msse4.2']
+- SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += ['-Dskvx=skvx_avx',
'-mavx']
+- SOURCES['skia/src/opts/SkOpts_hsw.cpp'].flags += ['-Dskvx=skvx_hsw',
'-mavx2', '-mf16c', '-mfma']
++ SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += ['-Dskvx=skvx_avx',
'-mavx', '-fno-lto']
++ SOURCES['skia/src/opts/SkOpts_hsw.cpp'].flags += ['-Dskvx=skvx_hsw',
'-mavx2', '-mf16c', '-mfma', '-fno-lto']
+ if not CONFIG["MOZ_CODE_COVERAGE"]:
+- SOURCES['skia/src/opts/SkOpts_skx.cpp'].flags +=
['-Dskvx=skvx_skx', '-mavx512f', '-mavx512dq', '-mavx512cd', '-mavx512bw',
'-mavx512vl']
++ SOURCES['skia/src/opts/SkOpts_skx.cpp'].flags +=
['-Dskvx=skvx_skx', '-mavx512f', '-mavx512dq', '-mavx512cd', '-mavx512bw',
'-mavx512vl', '-fno-lto']
+ elif CONFIG['TARGET_CPU'] == 'aarch64' and CONFIG['CC_TYPE'] in ('clang',
'gcc'):
+ SOURCES['skia/src/opts/SkOpts_crc32.cpp'].flags +=
['-Dskvx=skvx_crc32', '-march=armv8-a+crc']
+
+diff -up firefox-122.0/toolkit/components/terminator/nsTerminator.cpp.pgo
firefox-122.0/toolkit/components/terminator/nsTerminator.cpp
+--- firefox-122.0/toolkit/components/terminator/nsTerminator.cpp.pgo
2024-01-18 21:41:36.000000000 +0100
++++ firefox-122.0/toolkit/components/terminator/nsTerminator.cpp
2024-01-19 18:21:17.976681572 +0100
+@@ -460,6 +460,11 @@ void nsTerminator::StartWatchdog() {
+ }
+ #endif
+
++ // Disable watchdog for PGO train builds - writting profile information at
++ // exit may take time and it is better to make build hang rather than
++ // silently produce poorly performing binary.
++ crashAfterMS = INT32_MAX;
++
+ UniquePtr<Options> options(new Options());
+ // crashAfterTicks is guaranteed to be > 0 as
+ // crashAfterMS >= ADDITIONAL_WAIT_BEFORE_CRASH_MS >>
HEARTBEAT_INTERVAL_MS
+
diff --git a/http/firefox/patches/0025-bmo-1862601-system-icu-74.patch
b/http/firefox/patches/0025-bmo-1862601-system-icu-74.patch
new file mode 100644
index 0000000..617dd76
--- /dev/null
+++ b/http/firefox/patches/0025-bmo-1862601-system-icu-74.patch
@@ -0,0 +1,41 @@
+https://bugs.gentoo.org/917599
+https://bugzilla.mozilla.org/show_bug.cgi?id=1862601
+https://hg.mozilla.org/try/rev/d5f3b0c4f08a426ce00a153c04e177eecb6820e2
+
+# HG changeset patch
+# User André Bargull <andre.bargull AT gmail.com>
+# Date 1697435923 -7200
+# Node ID d5f3b0c4f08a426ce00a153c04e177eecb6820e2
+# Parent c63994f8259efdf6e745c960aa9e1409d5477049
+Bug xxx - Part 12: Add new line break classes. r?
+
+diff --git a/intl/lwbrk/LineBreaker.cpp b/intl/lwbrk/LineBreaker.cpp
+--- a/intl/lwbrk/LineBreaker.cpp
++++ b/intl/lwbrk/LineBreaker.cpp
+@@ -443,17 +443,23 @@ static int8_t GetClass(uint32_t u, LineB
+ /* JT = 34, [JT] */ CLASS_CHARACTER,
+ /* JV = 35, [JV] */ CLASS_CHARACTER,
+ /* CLOSE_PARENTHESIS = 36, [CP] */
CLASS_CLOSE_LIKE_CHARACTER,
+ /* CONDITIONAL_JAPANESE_STARTER = 37, [CJ] */ CLASS_CLOSE,
+ /* HEBREW_LETTER = 38, [HL] */ CLASS_CHARACTER,
+ /* REGIONAL_INDICATOR = 39, [RI] */ CLASS_CHARACTER,
+ /* E_BASE = 40, [EB] */ CLASS_BREAKABLE,
+ /* E_MODIFIER = 41, [EM] */ CLASS_CHARACTER,
+- /* ZWJ = 42, [ZWJ]*/ CLASS_CHARACTER};
++ /* ZWJ = 42, [ZWJ]*/ CLASS_CHARACTER,
++ /* AKSARA = 43, [AK] */ CLASS_CHARACTER,
++ /* AKSARA_PREBASE = 44, [AP] */ CLASS_CHARACTER,
++ /* AKSARA_START = 45, [AS] */ CLASS_CHARACTER,
++ /* VIRAMA_FINAL = 46, [VF] */ CLASS_CHARACTER,
++ /* VIRAMA = 47, [VI] */ CLASS_CHARACTER,
++ };
+
+ static_assert(U_LB_COUNT ==
mozilla::ArrayLength(sUnicodeLineBreakToClass),
+ "Gecko vs ICU LineBreak class mismatch");
+
+ auto cls = GetLineBreakClass(u);
+ MOZ_ASSERT(cls < mozilla::ArrayLength(sUnicodeLineBreakToClass));
+
+ // Overrides based on rules for the different line-break values given in
+
+
diff --git a/http/firefox/patches/0025-gcc-lto-patch-from-fedora.patch
b/http/firefox/patches/0025-gcc-lto-patch-from-fedora.patch
deleted file mode 100644
index 3ce9593..0000000
--- a/http/firefox/patches/0025-gcc-lto-patch-from-fedora.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-diff -up firefox-122.0/build/moz.configure/lto-pgo.configure.pgo
firefox-122.0/build/moz.configure/lto-pgo.configure
---- firefox-122.0/build/moz.configure/lto-pgo.configure.pgo 2024-01-18
21:41:19.000000000 +0100
-+++ firefox-122.0/build/moz.configure/lto-pgo.configure 2024-01-19
18:21:17.974681504 +0100
-@@ -86,7 +86,7 @@ def pgo_flags(compiler, profdata, target
- return namespace(
- gen_cflags=["-fprofile-generate"],
- gen_ldflags=["-fprofile-generate"],
-- use_cflags=["-fprofile-use", "-fprofile-correction",
"-Wcoverage-mismatch"],
-+ use_cflags=["-fprofile-use", "-fprofile-correction",
"-Wno-coverage-mismatch"],
- use_ldflags=["-fprofile-use"],
- )
-
-diff -up firefox-122.0/build/pgo/profileserver.py.pgo
firefox-122.0/build/pgo/profileserver.py
---- firefox-122.0/build/pgo/profileserver.py.pgo 2024-01-18
21:41:20.000000000 +0100
-+++ firefox-122.0/build/pgo/profileserver.py 2024-01-19 18:21:17.974681504
+0100
-@@ -11,7 +11,7 @@ import subprocess
- import sys
-
- import mozcrash
--from mozbuild.base import BinaryNotFoundException, MozbuildObject
-+from mozbuild.base import BinaryNotFoundException, MozbuildObject,
BuildEnvironmentNotFoundException
- from mozfile import TemporaryDirectory
- from mozhttpd import MozHttpd
- from mozprofile import FirefoxProfile, Preferences
-@@ -98,9 +98,22 @@ if __name__ == "__main__":
- locations = ServerLocations()
- locations.add_host(host="127.0.0.1", port=PORT,
options="primary,privileged")
-
-- old_profraw_files = glob.glob("*.profraw")
-- for f in old_profraw_files:
-- os.remove(f)
-+ using_gcc = False
-+ try:
-+ if build.config_environment.substs.get('CC_TYPE') == 'gcc':
-+ using_gcc = True
-+ except BuildEnvironmentNotFoundException:
-+ pass
-+
-+ if using_gcc:
-+ for dirpath, _, filenames in os.walk('.'):
-+ for f in filenames:
-+ if f.endswith('.gcda'):
-+ os.remove(os.path.join(dirpath, f))
-+ else:
-+ old_profraw_files = glob.glob('*.profraw')
-+ for f in old_profraw_files:
-+ os.remove(f)
-
- with TemporaryDirectory() as profilePath:
- # TODO: refactor this into mozprofile
-diff -up firefox-122.0/gfx/2d/moz.build.pgo firefox-122.0/gfx/2d/moz.build
---- firefox-122.0/gfx/2d/moz.build.pgo 2024-01-18 21:41:22.000000000 +0100
-+++ firefox-122.0/gfx/2d/moz.build 2024-01-19 18:21:17.974681504 +0100
-@@ -137,11 +137,11 @@ if CONFIG["INTEL_ARCHITECTURE"]:
- # The file uses SSE2 intrinsics, so it needs special compile flags on
some
- # compilers.
- SOURCES["BlurSSE2.cpp"].flags += CONFIG["SSE2_FLAGS"]
-- SOURCES["ConvolutionFilterAVX2.cpp"].flags += ["-mavx2"]
-+ SOURCES["ConvolutionFilterAVX2.cpp"].flags += ["-mavx2", "-fno-lto"]
- SOURCES["ConvolutionFilterSSE2.cpp"].flags += CONFIG["SSE2_FLAGS"]
- SOURCES["FilterProcessingSSE2.cpp"].flags += CONFIG["SSE2_FLAGS"]
- SOURCES["ImageScalingSSE2.cpp"].flags += CONFIG["SSE2_FLAGS"]
-- SOURCES["SwizzleAVX2.cpp"].flags += ["-mavx2"]
-+ SOURCES["SwizzleAVX2.cpp"].flags += ["-mavx2", "-fno-lto"]
- SOURCES["SwizzleSSE2.cpp"].flags += CONFIG["SSE2_FLAGS"]
- SOURCES["SwizzleSSSE3.cpp"].flags += CONFIG["SSSE3_FLAGS"]
- SOURCES["ssse3-scaler.c"].flags += CONFIG["SSSE3_FLAGS"]
-diff -up firefox-122.0/gfx/skia/generate_mozbuild.py.pgo
firefox-122.0/gfx/skia/generate_mozbuild.py
---- firefox-122.0/gfx/skia/generate_mozbuild.py.pgo 2024-01-19
18:21:17.975681537 +0100
-+++ firefox-122.0/gfx/skia/generate_mozbuild.py 2024-01-19
18:24:15.494934133 +0100
-@@ -54,10 +54,10 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'wind
- if CONFIG['INTEL_ARCHITECTURE']:
- SOURCES['skia/src/opts/SkOpts_ssse3.cpp'].flags +=
['-Dskvx=skvx_ssse3', '-mssse3']
- SOURCES['skia/src/opts/SkOpts_sse42.cpp'].flags +=
['-Dskvx=skvx_sse42', '-msse4.2']
-- SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += ['-Dskvx=skvx_avx',
'-mavx']
-- SOURCES['skia/src/opts/SkOpts_hsw.cpp'].flags += ['-Dskvx=skvx_hsw',
'-mavx2', '-mf16c', '-mfma']
-+ SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += ['-Dskvx=skvx_avx',
'-mavx', '-fno-lto']
-+ SOURCES['skia/src/opts/SkOpts_hsw.cpp'].flags += ['-Dskvx=skvx_hsw',
'-mavx2', '-mf16c', '-mfma', '-fno-lto']
- if not CONFIG["MOZ_CODE_COVERAGE"]:
-- SOURCES['skia/src/opts/SkOpts_skx.cpp'].flags +=
['-Dskvx=skvx_skx', '-mavx512f', '-mavx512dq', '-mavx512cd', '-mavx512bw',
'-mavx512vl']
-+ SOURCES['skia/src/opts/SkOpts_skx.cpp'].flags +=
['-Dskvx=skvx_skx', '-mavx512f', '-mavx512dq', '-mavx512cd', '-mavx512bw',
'-mavx512vl', '-fno-lto']
- elif CONFIG['TARGET_CPU'] == 'aarch64' and CONFIG['CC_TYPE'] in ('clang',
'gcc'):
- SOURCES['skia/src/opts/SkOpts_crc32.cpp'].flags +=
['-Dskvx=skvx_crc32', '-march=armv8-a+crc']
-
-diff -up firefox-122.0/gfx/skia/moz.build.pgo
firefox-122.0/gfx/skia/moz.build
---- firefox-122.0/gfx/skia/moz.build.pgo 2024-01-19 18:21:17.975681537
+0100
-+++ firefox-122.0/gfx/skia/moz.build 2024-01-19 18:25:13.472039275 +0100
-@@ -564,10 +564,10 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'wind
- if CONFIG['INTEL_ARCHITECTURE']:
- SOURCES['skia/src/opts/SkOpts_ssse3.cpp'].flags +=
['-Dskvx=skvx_ssse3', '-mssse3']
- SOURCES['skia/src/opts/SkOpts_sse42.cpp'].flags +=
['-Dskvx=skvx_sse42', '-msse4.2']
-- SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += ['-Dskvx=skvx_avx',
'-mavx']
-- SOURCES['skia/src/opts/SkOpts_hsw.cpp'].flags += ['-Dskvx=skvx_hsw',
'-mavx2', '-mf16c', '-mfma']
-+ SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += ['-Dskvx=skvx_avx',
'-mavx', '-fno-lto']
-+ SOURCES['skia/src/opts/SkOpts_hsw.cpp'].flags += ['-Dskvx=skvx_hsw',
'-mavx2', '-mf16c', '-mfma', '-fno-lto']
- if not CONFIG["MOZ_CODE_COVERAGE"]:
-- SOURCES['skia/src/opts/SkOpts_skx.cpp'].flags +=
['-Dskvx=skvx_skx', '-mavx512f', '-mavx512dq', '-mavx512cd', '-mavx512bw',
'-mavx512vl']
-+ SOURCES['skia/src/opts/SkOpts_skx.cpp'].flags +=
['-Dskvx=skvx_skx', '-mavx512f', '-mavx512dq', '-mavx512cd', '-mavx512bw',
'-mavx512vl', '-fno-lto']
- elif CONFIG['TARGET_CPU'] == 'aarch64' and CONFIG['CC_TYPE'] in ('clang',
'gcc'):
- SOURCES['skia/src/opts/SkOpts_crc32.cpp'].flags +=
['-Dskvx=skvx_crc32', '-march=armv8-a+crc']
-
-diff -up firefox-122.0/toolkit/components/terminator/nsTerminator.cpp.pgo
firefox-122.0/toolkit/components/terminator/nsTerminator.cpp
---- firefox-122.0/toolkit/components/terminator/nsTerminator.cpp.pgo
2024-01-18 21:41:36.000000000 +0100
-+++ firefox-122.0/toolkit/components/terminator/nsTerminator.cpp
2024-01-19 18:21:17.976681572 +0100
-@@ -460,6 +460,11 @@ void nsTerminator::StartWatchdog() {
- }
- #endif
-
-+ // Disable watchdog for PGO train builds - writting profile information at
-+ // exit may take time and it is better to make build hang rather than
-+ // silently produce poorly performing binary.
-+ crashAfterMS = INT32_MAX;
-+
- UniquePtr<Options> options(new Options());
- // crashAfterTicks is guaranteed to be > 0 as
- // crashAfterMS >= ADDITIONAL_WAIT_BEFORE_CRASH_MS >>
HEARTBEAT_INTERVAL_MS
-
diff --git a/http/firefox/patches/0026-bgo-748849-RUST_TARGET_override.patch
b/http/firefox/patches/0026-bgo-748849-RUST_TARGET_override.patch
new file mode 100644
index 0000000..f109538
--- /dev/null
+++ b/http/firefox/patches/0026-bgo-748849-RUST_TARGET_override.patch
@@ -0,0 +1,61 @@
+From: Sam James <sam AT gentoo.org>
+Subject: Allow RUST_TARGET override for detected Rust triplet (fixes musl
build)
+
+Respect RUST_TARGET from the environment to override Mozilla's
+own triplet detection.
+
+If the variable is unset, the old logic is used.
+
+The issue is that Gentoo supports both, say:
+- x86_64-unknown-linux-musl, and
+- x86-64-gentoo-linux-musl
+
+Our Rust is built to understand
+-gentoo- as a vendor target, but
+our Rust only actually includes
+-unknown-.
+
+Mozilla's configure sees -gentoo-
+in CHOST and that Rust _understands_
+-gentoo- and tries to use it, without
+verifying that we actually have
+-gentoo- installed as a Rust target.
+
+This requires exporting RUST_TARGET
+in the ebuild, possibly like:
+````
+inherit rust-toolchain
+
+src_configure() {
+ [...]
+ export RUST_TARGET=$(rust_abi)
+ [...]
+}
+````
+
+Inspired by Alpine's patch at
+https://git.alpinelinux.org/aports/tree/community/firefox/fix-rust-target.patch?id=740922900cf8042be6751fcfcccdd3fc11bd77d3.
+
+Bug: https://bugs.gentoo.org/748849
+Bug: https://bugs.gentoo.org/779178
+Bug: https://bugs.gentoo.org/836226
+Thanks-to: Georgy Yakovlev <gyakovlev AT gentoo.org>
+--- a/build/moz.configure/rust.configure
++++ b/build/moz.configure/rust.configure
+@@ -275,6 +275,7 @@ def rust_supported_targets(rustc):
+ return data
+
+
++@imports('os')
+ def detect_rustc_target(
+ host_or_target, compiler_info, arm_target, rust_supported_targets
+ ):
+@@ -396,7 +397,7 @@ def detect_rustc_target(
+
+ return None
+
+- rustc_target = find_candidate(candidates)
++ rustc_target = os.environ.get('RUST_TARGET', find_candidate(candidates))
+
+ if rustc_target is None:
+ die("Don't know how to translate {} for
rustc".format(host_or_target.alias))
diff --git a/http/firefox/patches/0026-bmo-1862601-system-icu-74.patch
b/http/firefox/patches/0026-bmo-1862601-system-icu-74.patch
deleted file mode 100644
index 617dd76..0000000
--- a/http/firefox/patches/0026-bmo-1862601-system-icu-74.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-https://bugs.gentoo.org/917599
-https://bugzilla.mozilla.org/show_bug.cgi?id=1862601
-https://hg.mozilla.org/try/rev/d5f3b0c4f08a426ce00a153c04e177eecb6820e2
-
-# HG changeset patch
-# User André Bargull <andre.bargull AT gmail.com>
-# Date 1697435923 -7200
-# Node ID d5f3b0c4f08a426ce00a153c04e177eecb6820e2
-# Parent c63994f8259efdf6e745c960aa9e1409d5477049
-Bug xxx - Part 12: Add new line break classes. r?
-
-diff --git a/intl/lwbrk/LineBreaker.cpp b/intl/lwbrk/LineBreaker.cpp
---- a/intl/lwbrk/LineBreaker.cpp
-+++ b/intl/lwbrk/LineBreaker.cpp
-@@ -443,17 +443,23 @@ static int8_t GetClass(uint32_t u, LineB
- /* JT = 34, [JT] */ CLASS_CHARACTER,
- /* JV = 35, [JV] */ CLASS_CHARACTER,
- /* CLOSE_PARENTHESIS = 36, [CP] */
CLASS_CLOSE_LIKE_CHARACTER,
- /* CONDITIONAL_JAPANESE_STARTER = 37, [CJ] */ CLASS_CLOSE,
- /* HEBREW_LETTER = 38, [HL] */ CLASS_CHARACTER,
- /* REGIONAL_INDICATOR = 39, [RI] */ CLASS_CHARACTER,
- /* E_BASE = 40, [EB] */ CLASS_BREAKABLE,
- /* E_MODIFIER = 41, [EM] */ CLASS_CHARACTER,
-- /* ZWJ = 42, [ZWJ]*/ CLASS_CHARACTER};
-+ /* ZWJ = 42, [ZWJ]*/ CLASS_CHARACTER,
-+ /* AKSARA = 43, [AK] */ CLASS_CHARACTER,
-+ /* AKSARA_PREBASE = 44, [AP] */ CLASS_CHARACTER,
-+ /* AKSARA_START = 45, [AS] */ CLASS_CHARACTER,
-+ /* VIRAMA_FINAL = 46, [VF] */ CLASS_CHARACTER,
-+ /* VIRAMA = 47, [VI] */ CLASS_CHARACTER,
-+ };
-
- static_assert(U_LB_COUNT ==
mozilla::ArrayLength(sUnicodeLineBreakToClass),
- "Gecko vs ICU LineBreak class mismatch");
-
- auto cls = GetLineBreakClass(u);
- MOZ_ASSERT(cls < mozilla::ArrayLength(sUnicodeLineBreakToClass));
-
- // Overrides based on rules for the different line-break values given in
-
-
diff --git a/http/firefox/patches/0027-bgo-748849-RUST_TARGET_override.patch
b/http/firefox/patches/0027-bgo-748849-RUST_TARGET_override.patch
deleted file mode 100644
index f109538..0000000
--- a/http/firefox/patches/0027-bgo-748849-RUST_TARGET_override.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From: Sam James <sam AT gentoo.org>
-Subject: Allow RUST_TARGET override for detected Rust triplet (fixes musl
build)
-
-Respect RUST_TARGET from the environment to override Mozilla's
-own triplet detection.
-
-If the variable is unset, the old logic is used.
-
-The issue is that Gentoo supports both, say:
-- x86_64-unknown-linux-musl, and
-- x86-64-gentoo-linux-musl
-
-Our Rust is built to understand
--gentoo- as a vendor target, but
-our Rust only actually includes
--unknown-.
-
-Mozilla's configure sees -gentoo-
-in CHOST and that Rust _understands_
--gentoo- and tries to use it, without
-verifying that we actually have
--gentoo- installed as a Rust target.
-
-This requires exporting RUST_TARGET
-in the ebuild, possibly like:
-````
-inherit rust-toolchain
-
-src_configure() {
- [...]
- export RUST_TARGET=$(rust_abi)
- [...]
-}
-````
-
-Inspired by Alpine's patch at
-https://git.alpinelinux.org/aports/tree/community/firefox/fix-rust-target.patch?id=740922900cf8042be6751fcfcccdd3fc11bd77d3.
-
-Bug: https://bugs.gentoo.org/748849
-Bug: https://bugs.gentoo.org/779178
-Bug: https://bugs.gentoo.org/836226
-Thanks-to: Georgy Yakovlev <gyakovlev AT gentoo.org>
---- a/build/moz.configure/rust.configure
-+++ b/build/moz.configure/rust.configure
-@@ -275,6 +275,7 @@ def rust_supported_targets(rustc):
- return data
-
-
-+@imports('os')
- def detect_rustc_target(
- host_or_target, compiler_info, arm_target, rust_supported_targets
- ):
-@@ -396,7 +397,7 @@ def detect_rustc_target(
-
- return None
-
-- rustc_target = find_candidate(candidates)
-+ rustc_target = os.environ.get('RUST_TARGET', find_candidate(candidates))
-
- if rustc_target is None:
- die("Don't know how to translate {} for
rustc".format(host_or_target.alias))
diff --git
a/http/firefox/patches/0027-bmo-1743144-add-wayland-proxy-cache.patch
b/http/firefox/patches/0027-bmo-1743144-add-wayland-proxy-cache.patch
new file mode 100644
index 0000000..2d62b8a
--- /dev/null
+++ b/http/firefox/patches/0027-bmo-1743144-add-wayland-proxy-cache.patch
@@ -0,0 +1,1029 @@
+
+# HG changeset patch
+# User stransky <stransky AT redhat.com>
+# Date 1704803101 0
+# Node ID 6a0659188d6c3d77231a59f836c1a42462d2725c
+# Parent 051ee8b6b5420d6e2ef877ed6ff3a70306257659
+Bug 1743144 [Wayland] Implement Wayland proxy r=emilio
+
+Differential Revision: https://phabricator.services.mozilla.com/D196554
+
+diff --git a/third_party/wayland-proxy/moz.build
b/third_party/wayland-proxy/moz.build
+new file mode 100644
+--- /dev/null
++++ b/third_party/wayland-proxy/moz.build
+@@ -0,0 +1,16 @@
++# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
++# vim: set filetype=python:
++# This Source Code Form is subject to the terms of the Mozilla Public
++# License, v. 2.0. If a copy of the MPL was not distributed with this
++# file, You can obtain one at http://mozilla.org/MPL/2.0/.
++
++with Files("**"):
++ BUG_COMPONENT = ("Core", "Widget: Gtk")
++
++SOURCES += [
++ "wayland-proxy.cpp",
++]
++EXPORTS += [
++ "wayland-proxy.h",
++]
++FINAL_LIBRARY = "xul"
+diff --git a/third_party/wayland-proxy/wayland-proxy.cpp
b/third_party/wayland-proxy/wayland-proxy.cpp
+new file mode 100644
+--- /dev/null
++++ b/third_party/wayland-proxy/wayland-proxy.cpp
+@@ -0,0 +1,755 @@
++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
++ * This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this
++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++// This code is based on Rust implementation at
++// https://github.com/the8472/weyland-p5000
++
++// Version 1.1
++
++#include <stdio.h>
++#include <stdlib.h>
++#include <stdarg.h>
++#include <sys/ioctl.h>
++#include <sys/socket.h>
++#include <sys/stat.h>
++#include <sys/wait.h>
++#include <sys/un.h>
++#include <spawn.h>
++#include <poll.h>
++#include <vector>
++#include <cerrno>
++#include <fcntl.h>
++#include <unistd.h>
++#include <memory>
++#include <cassert>
++#include <pthread.h>
++#include <sched.h>
++
++#include "wayland-proxy.h"
++
++// The maximum number of fds libwayland can recvmsg at once
++#define MAX_LIBWAY_FDS 28
++#define MAX_DATA_SIZE 4096
++#define POLL_TIMEOUT 30000
++
++// sockaddr_un has hardcoded max len of sun_path
++#define MAX_WAYLAND_DISPLAY_NAME_LEN 108
++
++// Name of Wayland display provided by compositor
++char sWaylandDisplay[MAX_WAYLAND_DISPLAY_NAME_LEN];
++
++// Name of Wayland display provided by us
++char sWaylandProxy[MAX_WAYLAND_DISPLAY_NAME_LEN];
++
++bool sPrintInfo = false;
++
++void Info(const char* aFormat, ...) {
++ if (!sPrintInfo) {
++ return;
++ }
++ va_list args;
++ va_start(args, aFormat);
++ vfprintf(stderr, aFormat, args);
++ va_end(args);
++}
++
++void Warning(const char* aOperation, bool aPrintErrno = true) {
++ fprintf(stderr, "Wayland Proxy warning: %s : %s\n", aOperation,
++ aPrintErrno ? strerror(errno) : "");
++}
++
++void Error(const char* aOperation, bool aPrintErrno = true) {
++ fprintf(stderr, "Wayland Proxy error: %s : %s\n", aOperation,
++ aPrintErrno ? strerror(errno) : "");
++}
++
++void ErrorPlain(const char* aFormat, ...) {
++ va_list args;
++ va_start(args, aFormat);
++ vfprintf(stderr, aFormat, args);
++ va_end(args);
++}
++
++class WaylandMessage {
++ public:
++ bool Write(int aSocket);
++
++ bool Loaded() const { return mLoaded && (mFds.size() || mData.size()); }
++ bool Failed() const { return mFailed; }
++
++ explicit WaylandMessage(int aSocket) { Read(aSocket); }
++ ~WaylandMessage();
++
++ private:
++ bool Read(int aSocket);
++
++ private:
++ bool mLoaded = false;
++ bool mFailed = false;
++
++ std::vector<int> mFds;
++ std::vector<unsigned char> mData;
++};
++
++class ProxiedConnection {
++ public:
++ bool Init(int aChildSocket);
++ bool IsConnected() { return mCompositorConnected; }
++
++ struct pollfd* AddToPollFd(struct pollfd* aPfds);
++ struct pollfd* LoadPollFd(struct pollfd* aPfds);
++
++ // Process this connection (send/receive data).
++ // Returns false if connection is broken and should be removed.
++ bool Process();
++
++ ~ProxiedConnection();
++
++ private:
++ // Try to connect to compositor. Returns false in case of fatal error.
++ bool ConnectToCompositor();
++
++ bool TransferOrQueue(
++ int aSourceSocket, int aSourcePollFlags, int aDestSocket,
++ std::vector<std::unique_ptr<WaylandMessage>>* aMessageQueue);
++ bool FlushQueue(int aDestSocket, int aDestPollFlags,
++ std::vector<std::unique_ptr<WaylandMessage>>&
aMessageQueue);
++
++ // We don't have connected compositor yet. Try to connect
++ bool mCompositorConnected = false;
++
++ // We're disconnected from app or compositor. We will close this
connection.
++ bool mFailed = false;
++
++ int mCompositorSocket = -1;
++ int mCompositorFlags = 0;
++
++ int mApplicationSocket = -1;
++ int mApplicationFlags = 0;
++
++ // Stored proxied data
++ std::vector<std::unique_ptr<WaylandMessage>> mToCompositorQueue;
++ std::vector<std::unique_ptr<WaylandMessage>> mToApplicationQueue;
++};
++
++WaylandMessage::~WaylandMessage() {
++ for (auto const fd : mFds) {
++ close(fd);
++ }
++}
++
++bool WaylandMessage::Read(int aSocket) {
++ // We don't expect WaylandMessage re-read
++ assert(!mLoaded && !mFailed);
++
++ mData.resize(MAX_DATA_SIZE);
++
++ struct msghdr msg = {0};
++ struct iovec iov = {mData.data(), mData.size()};
++ msg.msg_iov = &iov;
++ msg.msg_iovlen = 1;
++
++ char cmsgdata[(CMSG_LEN(MAX_LIBWAY_FDS * sizeof(int32_t)))] = {0};
++ msg.msg_control = &cmsgdata;
++ msg.msg_controllen = sizeof(cmsgdata);
++
++ ssize_t ret = recvmsg(aSocket, &msg, MSG_CMSG_CLOEXEC | MSG_DONTWAIT);
++ if (msg.msg_flags & (MSG_CTRUNC | MSG_TRUNC)) {
++ Error("WaylandMessage::Read() data truncated, small buffer?");
++ mFailed = true;
++ return false;
++ }
++
++ if (ret < 1) {
++ switch (errno) {
++ case EAGAIN:
++ case EINTR:
++ // Neither loaded nor failed, we'll try again later
++ Info("WaylandMessage::Write() failed %s\n", strerror(errno));
++ return false;
++ default:
++ Error("WaylandMessage::Write() failed");
++ mFailed = true;
++ return false;
++ }
++ }
++
++ // Set correct data size
++ mData.resize(ret);
++
++ // Read cmsg
++ struct cmsghdr* header = CMSG_FIRSTHDR(&msg);
++ while (header) {
++ struct cmsghdr* next = CMSG_NXTHDR(&msg, header);
++ if (header->cmsg_level != SOL_SOCKET || header->cmsg_type !=
SCM_RIGHTS) {
++ header = next;
++ continue;
++ }
++
++ int* data = (int*)CMSG_DATA(header);
++ int filenum = (int)((header->cmsg_len - CMSG_LEN(0)) / sizeof(int));
++ for (int i = 0; i < filenum; i++) {
++#ifdef DEBUG
++ int flags = fcntl(data[i], F_GETFL, 0);
++ if (flags == -1 && errno == EBADF) {
++ Error("WaylandMessage::Read() invalid fd");
++ }
++#endif
++ mFds.push_back(data[i]);
++ }
++ header = next;
++ }
++
++ mLoaded = true;
++ return true;
++}
++
++bool WaylandMessage::Write(int aSocket) {
++ if (!mLoaded || mFailed) {
++ return false;
++ }
++
++ struct msghdr msg = {0};
++ struct iovec iov = {mData.data(), mData.size()};
++ msg.msg_iov = &iov;
++ msg.msg_iovlen = 1;
++
++ int filenum = mFds.size();
++ if (filenum) {
++ if (filenum >= MAX_LIBWAY_FDS) {
++ Error("WaylandMessage::Write() too many files to send\n", false);
++ return false;
++ }
++#ifdef DEBUG
++ for (int i = 0; i < filenum; i++) {
++ int flags = fcntl(mFds[i], F_GETFL, 0);
++ if (flags == -1 && errno == EBADF) {
++ Error("WaylandMessage::Write() invalid fd\n");
++ }
++ }
++#endif
++ union {
++ char buf[CMSG_SPACE(sizeof(int) * MAX_LIBWAY_FDS)];
++ struct cmsghdr align;
++ } cmsgu;
++ memset(cmsgu.buf, 0, sizeof(cmsgu.buf));
++
++ msg.msg_control = cmsgu.buf;
++ msg.msg_controllen = sizeof(cmsgu.buf);
++ msg.msg_controllen = CMSG_SPACE(filenum * sizeof(int));
++
++ struct cmsghdr* cmsg = CMSG_FIRSTHDR(&msg);
++ cmsg->cmsg_level = SOL_SOCKET;
++ cmsg->cmsg_type = SCM_RIGHTS;
++ cmsg->cmsg_len = CMSG_LEN(filenum * sizeof(int));
++ memcpy(CMSG_DATA(cmsg), mFds.data(), filenum * sizeof(int));
++ }
++
++ ssize_t ret = sendmsg(aSocket, &msg, MSG_CMSG_CLOEXEC | MSG_DONTWAIT);
++ if (ret < 1) {
++ switch (errno) {
++ case EAGAIN:
++ case EINTR:
++ // Neither loaded nor failed, we'll try again later
++ Info("WaylandMessage::Write() failed %s\n", strerror(errno));
++ return false;
++ default:
++ Warning("WaylandMessage::Write() failed");
++ mFailed = true;
++ return false;
++ }
++ }
++
++ if (ret != (ssize_t)mData.size()) {
++ Info("WaylandMessage::Write() failed to write all data! (%d vs. %d)\n",
ret,
++ mData.size());
++ }
++ return true;
++}
++
++ProxiedConnection::~ProxiedConnection() {
++ if (mCompositorSocket != -1) {
++ close(mCompositorSocket);
++ }
++ if (mApplicationSocket != -1) {
++ close(mApplicationSocket);
++ }
++}
++
++bool ProxiedConnection::Init(int aApplicationSocket) {
++ mApplicationSocket = aApplicationSocket;
++ mCompositorSocket =
++ socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
++ if (mCompositorSocket == -1) {
++ Error("ProxiedConnection::Init() socket()");
++ }
++ return mApplicationSocket >= 0 && mCompositorSocket >= 0;
++}
++
++struct pollfd* ProxiedConnection::AddToPollFd(struct pollfd* aPfds) {
++ // Listen application's requests
++ aPfds->fd = mApplicationSocket;
++ aPfds->events = POLLIN;
++
++ // We're connected and we have data for appplication from compositor.
++ // Add POLLOUT to request write to app socket.
++ if (mCompositorConnected && !mToApplicationQueue.empty()) {
++ aPfds->events |= POLLOUT;
++ }
++ aPfds++;
++
++ aPfds->fd = mCompositorSocket;
++ aPfds->events = 0;
++ // We're waiting for connection or we have data for compositor
++ if (!mCompositorConnected || !mToCompositorQueue.empty()) {
++ aPfds->events |= POLLOUT;
++ }
++ if (mCompositorConnected) {
++ aPfds->events |= POLLIN;
++ }
++ aPfds++;
++
++ return aPfds;
++}
++
++struct pollfd* ProxiedConnection::LoadPollFd(struct pollfd* aPfds) {
++ if (aPfds->fd != mApplicationSocket) {
++ return aPfds;
++ }
++ mApplicationFlags = aPfds->revents;
++ aPfds++;
++ mCompositorFlags = aPfds->revents;
++ aPfds++;
++ return aPfds;
++}
++
++bool ProxiedConnection::ConnectToCompositor() {
++ if (!(mCompositorFlags & POLLOUT)) {
++ // Try again later
++ return true;
++ }
++
++ struct sockaddr_un addr = {};
++ addr.sun_family = AF_UNIX;
++ strcpy(addr.sun_path, sWaylandDisplay);
++
++ mCompositorConnected =
++ connect(mCompositorSocket, (const struct sockaddr*)&addr,
++ sizeof(struct sockaddr_un)) != -1;
++ if (!mCompositorConnected) {
++ switch (errno) {
++ case EAGAIN:
++ case EALREADY:
++ case ECONNREFUSED:
++ case EINPROGRESS:
++ case EINTR:
++ case EISCONN:
++ case ETIMEDOUT:
++ // We can recover from these errors and try again
++ Warning("ConnectToCompositor() try again");
++ return true;
++ default:
++ Error("ConnectToCompositor() connect()");
++ return false;
++ }
++ }
++ return true;
++}
++
++// Read data from aSourceSocket and try to twite them to aDestSocket.
++// If data write fails, append them to aMessageQueue.
++// Return
++bool ProxiedConnection::TransferOrQueue(
++ int aSourceSocket, int aSourcePollFlags, int aDestSocket,
++ std::vector<std::unique_ptr<WaylandMessage>>* aMessageQueue) {
++ // Don't read if we don't have any data ready
++ if (!(aSourcePollFlags & POLLIN)) {
++ return true;
++ }
++
++ while (1) {
++ int availableData = 0;
++ if (ioctl(aSourceSocket, FIONREAD, &availableData) < 0) {
++ // Broken connection, we're finished here
++ Warning("ProxiedConnection::TransferOrQueue() broken source socket
%s\n");
++ return false;
++ }
++ if (availableData == 0) {
++ return true;
++ }
++
++ auto message = std::make_unique<WaylandMessage>(aSourceSocket);
++ if (message->Failed()) {
++ // Failed to read message due to error
++ return false;
++ }
++ if (!message->Loaded()) {
++ // Let's try again
++ return true;
++ }
++ if (!message->Write(aDestSocket)) {
++ if (message->Failed()) {
++ // Failed to write and we can't recover
++ return false;
++ }
++ aMessageQueue->push_back(std::move(message));
++ }
++ }
++}
++
++// Try to flush all data to aMessageQueue.
++bool ProxiedConnection::FlushQueue(
++ int aDestSocket, int aDestPollFlags,
++ std::vector<std::unique_ptr<WaylandMessage>>& aMessageQueue) {
++ // Can't write to destination yet
++ if (!(aDestPollFlags & POLLOUT) || aMessageQueue.empty()) {
++ return true;
++ }
++
++ std::vector<std::unique_ptr<WaylandMessage>>::iterator message;
++ for (message = aMessageQueue.begin(); message != aMessageQueue.end();) {
++ if (!(*message)->Write(aDestSocket)) {
++ // Failed to write the message, remove whole connection
++ // as it's broken.
++ if ((*message)->Failed()) {
++ return false;
++ }
++ break;
++ }
++ message++;
++ }
++
++ // Remove all written messages at once.
++ if (message != aMessageQueue.begin()) {
++ aMessageQueue.erase(aMessageQueue.begin(), message);
++ }
++
++ return true;
++}
++
++bool ProxiedConnection::Process() {
++ if (mFailed) {
++ return false;
++ }
++
++ // Check if appplication is still listening
++ if (mApplicationFlags & (POLLHUP | POLLERR)) {
++ return false;
++ }
++
++ // Check if compositor is still listening
++ if (mCompositorConnected) {
++ if (mCompositorFlags & (POLLHUP | POLLERR)) {
++ return false;
++ }
++ } else {
++ // Try to reconnect to compositor.
++ if (!ConnectToCompositor()) {
++ Info("Failed to connect to compositor\n");
++ return false;
++ }
++ // We're not connected yet but ConnectToCompositor() didn't return
++ // fatal error. Try again later.
++ if (!mCompositorConnected) {
++ return true;
++ }
++ }
++
++ mFailed =
++ !TransferOrQueue(mCompositorSocket, mCompositorFlags,
mApplicationSocket,
++ &mToApplicationQueue) ||
++ !TransferOrQueue(mApplicationSocket, mApplicationFlags,
mCompositorSocket,
++ &mToCompositorQueue) ||
++ !FlushQueue(mCompositorSocket, mCompositorFlags, mToCompositorQueue)
||
++ !FlushQueue(mApplicationSocket, mApplicationFlags,
mToApplicationQueue);
++
++ return !mFailed;
++}
++
++bool WaylandProxy::SetupWaylandDisplays() {
++ char* waylandDisplay = getenv("WAYLAND_DISPLAY");
++ if (!waylandDisplay) {
++ Error("Init(), Missing Wayland display, WAYLAND_DISPLAY is empty.",
false);
++ return false;
++ }
++
++ char* XDGRuntimeDir = getenv("XDG_RUNTIME_DIR");
++ if (!XDGRuntimeDir) {
++ Error("Init() Missing XDG_RUNTIME_DIR", false);
++ return false;
++ }
++
++ // WAYLAND_DISPLAY can be absolute path
++ if (waylandDisplay[0] == '/') {
++ if (strlen(sWaylandDisplay) >= MAX_WAYLAND_DISPLAY_NAME_LEN) {
++ Error("Init() WAYLAND_DISPLAY is too large.", false);
++ return false;
++ }
++ strcpy(sWaylandDisplay, waylandDisplay);
++ } else {
++ int ret = snprintf(sWaylandDisplay, MAX_WAYLAND_DISPLAY_NAME_LEN,
"%s/%s",
++ XDGRuntimeDir, waylandDisplay);
++ if (ret < 0 || ret >= MAX_WAYLAND_DISPLAY_NAME_LEN) {
++ Error("Init() WAYLAND_DISPLAY/XDG_RUNTIME_DIR is too large.", false);
++ return false;
++ }
++ }
++ int ret = snprintf(sWaylandProxy, MAX_WAYLAND_DISPLAY_NAME_LEN,
++ "%s/wayland-proxy-%d", XDGRuntimeDir, getpid());
++ if (ret < 0 || ret >= MAX_WAYLAND_DISPLAY_NAME_LEN) {
++ Error("Init() WAYLAND_DISPLAY/XDG_RUNTIME_DIR is too large.", false);
++ return false;
++ }
++
++ Info("WaylandProxy Wayland '%s' proxy '%s'\n", sWaylandDisplay,
sWaylandProxy);
++ return true;
++}
++
++bool WaylandProxy::StartProxyServer() {
++ mProxyServerSocket =
++ socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
++ if (mProxyServerSocket == -1) {
++ Error("StartProxyServer(): failed to create socket");
++ return false;
++ }
++
++ struct sockaddr_un serverName = {0};
++ serverName.sun_family = AF_UNIX;
++ strcpy(serverName.sun_path, sWaylandProxy);
++
++ if (bind(mProxyServerSocket, (struct sockaddr*)&serverName,
++ sizeof(serverName)) == -1) {
++ Error("StartProxyServer(): bind() error");
++ return false;
++ }
++ if (listen(mProxyServerSocket, 128) == -1) {
++ Error("StartProxyServer(): listen() error");
++ return false;
++ }
++
++ return true;
++}
++
++bool WaylandProxy::Init() {
++ if (!SetupWaylandDisplays()) {
++ return false;
++ }
++
++ if (!StartProxyServer()) {
++ return false;
++ }
++ return true;
++}
++
++void WaylandProxy::SetWaylandProxyDisplay() {
++ setenv("WAYLAND_DISPLAY", sWaylandProxy, true);
++}
++
++void WaylandProxy::SetWaylandDisplay() {
++ setenv("WAYLAND_DISPLAY", sWaylandDisplay, true);
++}
++
++bool WaylandProxy::IsChildAppTerminated() {
++ if (!mApplicationPID) {
++ return false;
++ }
++ int status = 0;
++ int ret = waitpid(mApplicationPID, &status, WNOHANG | WUNTRACED |
WCONTINUED);
++ if (ret == 0) {
++ return false;
++ }
++ if (ret == mApplicationPID) {
++ // Child application is terminated, so quit too.
++ return true;
++ }
++ bool terminate = (errno == ECHILD);
++ Error("IsChildAppTerminated: waitpid() error");
++ return terminate;
++}
++
++bool WaylandProxy::PollConnections() {
++ int nfds_max = mConnections.size() * 2 + 1;
++
++ struct pollfd pollfds[nfds_max];
++ struct pollfd* addedPollfd = pollfds;
++
++ for (auto const& connection : mConnections) {
++ addedPollfd = connection->AddToPollFd(addedPollfd);
++ }
++ int nfds = (addedPollfd - pollfds);
++
++ // If all connections are attached to compositor, add another one
++ // for new potential connection from application.
++ bool addNewConnection = mConnections.empty() ||
++ mConnections.back()->IsConnected();
++ if (addNewConnection) {
++ addedPollfd->fd = mProxyServerSocket;
++ addedPollfd->events = POLLIN;
++ nfds++;
++ }
++ assert(addedPollfd < pollfds + nfds_max);
++
++ while (1) {
++ int ret = poll(pollfds, nfds, POLL_TIMEOUT);
++ if (ret == 0) {
++ // No change on fds
++ continue;
++ } else if (ret > 0) {
++ // We have FD to read
++ break;
++ } else if (ret == -1) {
++ switch (errno) {
++ case EINTR:
++ case EAGAIN:
++ if (IsChildAppTerminated()) {
++ return false;
++ }
++ continue;
++ default:
++ Error("Run: poll() error");
++ return false;
++ }
++ }
++ }
++
++ struct pollfd* loadedPollfd = pollfds;
++ for (auto const& connection : mConnections) {
++ loadedPollfd = connection->LoadPollFd(loadedPollfd);
++ }
++
++ assert(loadedPollfd == addedPollfd);
++ assert(loadedPollfd < pollfds + nfds_max);
++
++ // Create a new connection if there's a new client waiting
++ if (addNewConnection && (loadedPollfd->revents & POLLIN)) {
++ Info("WaylandProxy: new child connection\n");
++ int applicationSocket = accept4(loadedPollfd->fd, nullptr, nullptr,
++ SOCK_NONBLOCK | SOCK_CLOEXEC);
++ if (applicationSocket == -1) {
++ switch (errno) {
++ case EAGAIN:
++ case EINTR:
++ // Try again later
++ break;
++ default:
++ Error("Faild to accept connection from application");
++ return false;
++ }
++ } else {
++ auto connection = std::make_unique<ProxiedConnection>();
++ if (connection->Init(applicationSocket)) {
++ mConnections.push_back(std::move(connection));
++ }
++ }
++ }
++
++ return true;
++}
++
++bool WaylandProxy::ProcessConnections() {
++ std::vector<std::unique_ptr<ProxiedConnection>>::iterator connection;
++ for (connection = mConnections.begin(); connection !=
mConnections.end();) {
++ if (!(*connection)->Process()) {
++ Info("WaylandProxy: remove connection\n");
++ connection = mConnections.erase(connection);
++ if (mConnections.empty()) {
++ // We removed last connection - quit.
++ Info("WaylandProxy: removed last connection, quit\n");
++ return false;
++ }
++ } else {
++ connection++;
++ }
++ }
++ return true;
++}
++
++void WaylandProxy::Run() {
++ while (!IsChildAppTerminated() && PollConnections() &&
ProcessConnections())
++ ;
++}
++
++WaylandProxy::~WaylandProxy() {
++ Info("WaylandProxy terminated\n");
++ if (mThreadRunning) {
++ Info("WaylandProxy thread is still running, terminating.\n");
++ mThreadRunning = false;
++ pthread_cancel(mThread);
++ pthread_join(mThread, nullptr);
++ }
++ unlink(sWaylandProxy);
++ if (mProxyServerSocket != -1) {
++ close(mProxyServerSocket);
++ }
++ SetWaylandDisplay();
++}
++
++void* WaylandProxy::RunProxyThread(WaylandProxy* aProxy) {
++#ifdef __linux__
++ pthread_setname_np(pthread_self(), "WaylandProxy");
++#endif
++ aProxy->Run();
++ Info("WaylandProxy thread exited\n");
++ return nullptr;
++}
++
++std::unique_ptr<WaylandProxy> WaylandProxy::Create() {
++ auto proxy = std::make_unique<WaylandProxy>();
++ if (!proxy->Init()) {
++ return nullptr;
++ }
++
++ Info("WaylandProxyCreated, display %s\n", sWaylandProxy);
++ return proxy;
++}
++
++bool WaylandProxy::RunChildApplication(char* argv[]) {
++ if (!argv[0]) {
++ Error("WaylandProxy::RunChildApplication: missing application to run",
false);
++ return false;
++ }
++
++ mApplicationPID = fork();
++ if (mApplicationPID == -1) {
++ Error("WaylandProxy::RunChildApplication: fork() error");
++ return false;
++ }
++ if (mApplicationPID == 0) {
++ SetWaylandProxyDisplay();
++ if (execv(argv[0], argv) == -1) {
++ ErrorPlain("WaylandProxy::RunChildApplication: failed to run %s error
%s\n", argv[0], strerror(errno));
++ exit(1);
++ }
++ }
++
++ Run();
++ return true;
++}
++
++bool WaylandProxy::RunThread() {
++ pthread_attr_t attr;
++ if (pthread_attr_init(&attr) != 0) {
++ return false;
++ }
++
++ sched_param param;
++ if (pthread_attr_getschedparam(&attr, &param) == 0) {
++ param.sched_priority = sched_get_priority_min(SCHED_RR);
++ pthread_attr_setschedparam(&attr, &param);
++ }
++
++ SetWaylandProxyDisplay();
++
++ mThreadRunning = pthread_create(&mThread, nullptr, (void*
(*)(void*))RunProxyThread, this) == 0;
++ if (!mThreadRunning) {
++ // If we failed to run proxy thread, set WAYLAND_DISPLAY back.
++ SetWaylandDisplay();
++ }
++
++ pthread_attr_destroy(&attr);
++ return mThreadRunning;
++}
++
++void WaylandProxy::SetVerbose(bool aVerbose) { sPrintInfo = aVerbose; }
+diff --git a/third_party/wayland-proxy/wayland-proxy.h
b/third_party/wayland-proxy/wayland-proxy.h
+new file mode 100644
+--- /dev/null
++++ b/third_party/wayland-proxy/wayland-proxy.h
+@@ -0,0 +1,58 @@
++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
++ * This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this
++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++#ifndef _wayland_proxy_h_
++#define _wayland_proxy_h_
++
++#include <poll.h>
++#include <vector>
++#include <fcntl.h>
++#include <atomic>
++#include <memory>
++
++class ProxiedConnection;
++
++class WaylandProxy {
++ public:
++ static std::unique_ptr<WaylandProxy> Create();
++
++ // Launch an application with Wayland proxy set
++ bool RunChildApplication(char* argv[]);
++
++ // Run proxy as part of already running application
++ // and set Wayland proxy display for it.
++ bool RunThread();
++
++ // Set original Wayland display env variable.
++ void SetWaylandDisplay();
++
++ static void SetVerbose(bool aVerbose);
++
++ ~WaylandProxy();
++
++ private:
++ bool Init();
++ void Run();
++
++ void SetWaylandProxyDisplay();
++ static void* RunProxyThread(WaylandProxy* aProxy);
++
++ bool SetupWaylandDisplays();
++ bool StartProxyServer();
++ bool IsChildAppTerminated();
++
++ bool PollConnections();
++ bool ProcessConnections();
++
++ private:
++ // List of all Compositor <-> Application connections
++ std::vector<std::unique_ptr<ProxiedConnection>> mConnections;
++ int mProxyServerSocket = -1;
++ pid_t mApplicationPID = 0;
++ std::atomic<bool> mThreadRunning = false;
++ pthread_t mThread;
++};
++
++#endif // _wayland_proxy_h_
+diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build
+--- a/widget/gtk/moz.build
++++ b/widget/gtk/moz.build
+@@ -18,17 +18,17 @@ with Files("*IMContextWrapper*"):
+
+ with Files("*nsGtkKeyUtils*"):
+ BUG_COMPONENT = ("Core", "DOM: UI Events & Focus Handling")
+
+ if CONFIG["COMPILE_ENVIRONMENT"]:
+ DIRS += ["mozgtk"]
+
+ if CONFIG["MOZ_WAYLAND"]:
+- DIRS += ["wayland", "mozwayland"]
++ DIRS += ["wayland", "mozwayland", "../../third_party/wayland-proxy"]
+
+ if CONFIG["MOZ_ENABLE_VAAPI"]:
+ DIRS += ["vaapitest"]
+
+ if CONFIG["MOZ_ENABLE_V4L2"]:
+ DIRS += ["v4l2test"]
+
+ EXPORTS += [
+
+
+# HG changeset patch
+# User stransky <stransky AT redhat.com>
+# Date 1704803102 0
+# Node ID b0d2efdcd6cc0254d9c02cf82e7fe83c09d32e89
+# Parent 6a0659188d6c3d77231a59f836c1a42462d2725c
+Bug 1743144 [Wayland] Enable Wayland proxy on start r=emilio
+
+Differential Revision: https://phabricator.services.mozilla.com/D196555
+
+diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
+--- a/toolkit/xre/nsAppRunner.cpp
++++ b/toolkit/xre/nsAppRunner.cpp
+@@ -339,23 +339,34 @@ nsString gProcessStartupShortcut;
+
+ #if defined(MOZ_WIDGET_GTK)
+ # include <glib.h>
+ # include "mozilla/WidgetUtilsGtk.h"
+ # include <gtk/gtk.h>
+ # ifdef MOZ_WAYLAND
+ # include <gdk/gdkwayland.h>
+ # include "mozilla/widget/nsWaylandDisplay.h"
++# include "wayland-proxy.h"
+ # endif
+ # ifdef MOZ_X11
+ # include <gdk/gdkx.h>
+ # endif /* MOZ_X11 */
+ #endif
++
++#if defined(MOZ_WAYLAND)
++std::unique_ptr<WaylandProxy> gWaylandProxy;
++#endif
++
+ #include "BinaryPath.h"
+
++#ifdef MOZ_LOGGING
++# include "mozilla/Logging.h"
++extern mozilla::LazyLogModule gWidgetWaylandLog;
++#endif /* MOZ_LOGGING */
++
+ #ifdef FUZZING
+ # include "FuzzerRunner.h"
+
+ namespace mozilla {
+ FuzzerRunner* fuzzerRunner = 0;
+ } // namespace mozilla
+
+ # ifdef LIBFUZZER
+@@ -2787,16 +2798,19 @@ static ReturnAbortOnError ProfileLockedD
+ SaveFileToEnv("XRE_PROFILE_LOCAL_PATH", aProfileLocalDir);
+
+ #if defined(MOZ_HAS_REMOTE)
+ if (gRemoteService) {
+ gRemoteService->UnlockStartup();
+ gRemoteService = nullptr;
+ }
+ #endif
++#if defined(MOZ_WAYLAND)
++ gWaylandProxy = nullptr;
++#endif
+ return LaunchChild(false, true);
+ }
+ } else {
+ rv = ps->Alert(nullptr, killTitle.get(), killMessage.get());
+ NS_ENSURE_SUCCESS_LOG(rv, rv);
+ }
+
+ return NS_ERROR_ABORT;
+@@ -2901,16 +2915,19 @@ static ReturnAbortOnError ShowProfileMan
+ gRestartArgv[gRestartArgc] = nullptr;
+ }
+ #if defined(MOZ_HAS_REMOTE)
+ if (gRemoteService) {
+ gRemoteService->UnlockStartup();
+ gRemoteService = nullptr;
+ }
+ #endif
++#if defined(MOZ_WAYLAND)
++ gWaylandProxy = nullptr;
++#endif
+ return LaunchChild(false, true);
+ }
+
+ static bool gDoMigration = false;
+ static bool gDoProfileReset = false;
+ static nsCOMPtr<nsIToolkitProfile> gResetOldProfile;
+
+ static nsresult LockProfile(nsINativeAppSupport* aNative, nsIFile* aRootDir,
+@@ -4706,26 +4723,42 @@ int XREMain::XRE_mainStartup(bool* aExit
+ XInitThreads();
+ }
+ #endif
+ #if defined(MOZ_WIDGET_GTK)
+ if (!isBackgroundTaskMode && !gfxPlatform::IsHeadless()) {
+ const char* display_name = nullptr;
+ bool saveDisplayArg = false;
+
++ bool waylandEnabled = IsWaylandEnabled();
++# ifdef MOZ_WAYLAND
++ auto* proxyEnv = getenv("MOZ_DISABLE_WAYLAND_PROXY");
++ bool disableWaylandProxy = proxyEnv && *proxyEnv;
++ if (!disableWaylandProxy && XRE_IsParentProcess() && waylandEnabled) {
++# ifdef MOZ_LOGGING
++ if (MOZ_LOG_TEST(gWidgetWaylandLog, mozilla::LogLevel::Debug)) {
++ WaylandProxy::SetVerbose(true);
++ }
++# endif
++ gWaylandProxy = WaylandProxy::Create();
++ if (gWaylandProxy) {
++ gWaylandProxy->RunThread();
++ }
++ }
++# endif
++
+ // display_name is owned by gdk.
+ display_name = gdk_get_display_arg_name();
+ // if --display argument is given make sure it's
+ // also passed to ContentChild::Init() by MOZ_GDK_DISPLAY.
+ if (display_name) {
+ SaveWordToEnv("MOZ_GDK_DISPLAY", nsDependentCString(display_name));
+ saveDisplayArg = true;
+ }
+
+- bool waylandEnabled = IsWaylandEnabled();
+ // On Wayland disabled builds read X11 DISPLAY env exclusively
+ // and don't care about different displays.
+ if (!waylandEnabled && !display_name) {
+ display_name = PR_GetEnv("DISPLAY");
+ if (!display_name) {
+ PR_fprintf(PR_STDERR,
+ "Error: no DISPLAY environment variable specified\n");
+ return 1;
+@@ -5954,16 +5987,17 @@ int XREMain::XRE_main(int argc, char* ar
+ mozilla::AppShutdown::MaybeDoRestart();
+
+ #ifdef MOZ_WIDGET_GTK
+ // gdk_display_close also calls gdk_display_manager_set_default_display
+ // appropriately when necessary.
+ if (!gfxPlatform::IsHeadless()) {
+ # ifdef MOZ_WAYLAND
+ WaylandDisplayRelease();
++ gWaylandProxy = nullptr;
+ # endif
+ }
+ #endif
+
+ XRE_DeinitCommandLine();
+
+ if (NS_FAILED(rv)) {
+ return 1;
+
+
diff --git
a/http/firefox/patches/0028-bgo-919418-ppc64-flac-decoder-unsupported.patch
b/http/firefox/patches/0028-bgo-919418-ppc64-flac-decoder-unsupported.patch
new file mode 100644
index 0000000..660b1ff
--- /dev/null
+++
b/http/firefox/patches/0028-bgo-919418-ppc64-flac-decoder-unsupported.patch
@@ -0,0 +1,11 @@
+--- a/dom/media/flac/FlacDecoder.cpp 2023-11-23 07:59:17.466486168 -0500
++++ b/dom/media/flac/FlacDecoder.cpp 2023-11-23 08:00:49.048026379 -0500
+@@ -18,7 +18,7 @@
+ #elif defined(MOZ_FFMPEG)
+ RefPtr<PDMFactory> platform = new PDMFactory();
+ return StaticPrefs::media_flac_enabled() &&
+- (platform->SupportsMimeType("audio/flac"_ns) !=
media::DecodeSupport::Unsupported);
++ !(platform->SupportsMimeType("audio/flac"_ns).isEmpty());
+ #else
+ return false;
+ #endif
diff --git
a/http/firefox/patches/0028-bmo-1743144-add-wayland-proxy-cache.patch
b/http/firefox/patches/0028-bmo-1743144-add-wayland-proxy-cache.patch
deleted file mode 100644
index 2d62b8a..0000000
--- a/http/firefox/patches/0028-bmo-1743144-add-wayland-proxy-cache.patch
+++ /dev/null
@@ -1,1029 +0,0 @@
-
-# HG changeset patch
-# User stransky <stransky AT redhat.com>
-# Date 1704803101 0
-# Node ID 6a0659188d6c3d77231a59f836c1a42462d2725c
-# Parent 051ee8b6b5420d6e2ef877ed6ff3a70306257659
-Bug 1743144 [Wayland] Implement Wayland proxy r=emilio
-
-Differential Revision: https://phabricator.services.mozilla.com/D196554
-
-diff --git a/third_party/wayland-proxy/moz.build
b/third_party/wayland-proxy/moz.build
-new file mode 100644
---- /dev/null
-+++ b/third_party/wayland-proxy/moz.build
-@@ -0,0 +1,16 @@
-+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-+# vim: set filetype=python:
-+# This Source Code Form is subject to the terms of the Mozilla Public
-+# License, v. 2.0. If a copy of the MPL was not distributed with this
-+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-+
-+with Files("**"):
-+ BUG_COMPONENT = ("Core", "Widget: Gtk")
-+
-+SOURCES += [
-+ "wayland-proxy.cpp",
-+]
-+EXPORTS += [
-+ "wayland-proxy.h",
-+]
-+FINAL_LIBRARY = "xul"
-diff --git a/third_party/wayland-proxy/wayland-proxy.cpp
b/third_party/wayland-proxy/wayland-proxy.cpp
-new file mode 100644
---- /dev/null
-+++ b/third_party/wayland-proxy/wayland-proxy.cpp
-@@ -0,0 +1,755 @@
-+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
-+ * This Source Code Form is subject to the terms of the Mozilla Public
-+ * License, v. 2.0. If a copy of the MPL was not distributed with this
-+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-+
-+// This code is based on Rust implementation at
-+// https://github.com/the8472/weyland-p5000
-+
-+// Version 1.1
-+
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <stdarg.h>
-+#include <sys/ioctl.h>
-+#include <sys/socket.h>
-+#include <sys/stat.h>
-+#include <sys/wait.h>
-+#include <sys/un.h>
-+#include <spawn.h>
-+#include <poll.h>
-+#include <vector>
-+#include <cerrno>
-+#include <fcntl.h>
-+#include <unistd.h>
-+#include <memory>
-+#include <cassert>
-+#include <pthread.h>
-+#include <sched.h>
-+
-+#include "wayland-proxy.h"
-+
-+// The maximum number of fds libwayland can recvmsg at once
-+#define MAX_LIBWAY_FDS 28
-+#define MAX_DATA_SIZE 4096
-+#define POLL_TIMEOUT 30000
-+
-+// sockaddr_un has hardcoded max len of sun_path
-+#define MAX_WAYLAND_DISPLAY_NAME_LEN 108
-+
-+// Name of Wayland display provided by compositor
-+char sWaylandDisplay[MAX_WAYLAND_DISPLAY_NAME_LEN];
-+
-+// Name of Wayland display provided by us
-+char sWaylandProxy[MAX_WAYLAND_DISPLAY_NAME_LEN];
-+
-+bool sPrintInfo = false;
-+
-+void Info(const char* aFormat, ...) {
-+ if (!sPrintInfo) {
-+ return;
-+ }
-+ va_list args;
-+ va_start(args, aFormat);
-+ vfprintf(stderr, aFormat, args);
-+ va_end(args);
-+}
-+
-+void Warning(const char* aOperation, bool aPrintErrno = true) {
-+ fprintf(stderr, "Wayland Proxy warning: %s : %s\n", aOperation,
-+ aPrintErrno ? strerror(errno) : "");
-+}
-+
-+void Error(const char* aOperation, bool aPrintErrno = true) {
-+ fprintf(stderr, "Wayland Proxy error: %s : %s\n", aOperation,
-+ aPrintErrno ? strerror(errno) : "");
-+}
-+
-+void ErrorPlain(const char* aFormat, ...) {
-+ va_list args;
-+ va_start(args, aFormat);
-+ vfprintf(stderr, aFormat, args);
-+ va_end(args);
-+}
-+
-+class WaylandMessage {
-+ public:
-+ bool Write(int aSocket);
-+
-+ bool Loaded() const { return mLoaded && (mFds.size() || mData.size()); }
-+ bool Failed() const { return mFailed; }
-+
-+ explicit WaylandMessage(int aSocket) { Read(aSocket); }
-+ ~WaylandMessage();
-+
-+ private:
-+ bool Read(int aSocket);
-+
-+ private:
-+ bool mLoaded = false;
-+ bool mFailed = false;
-+
-+ std::vector<int> mFds;
-+ std::vector<unsigned char> mData;
-+};
-+
-+class ProxiedConnection {
-+ public:
-+ bool Init(int aChildSocket);
-+ bool IsConnected() { return mCompositorConnected; }
-+
-+ struct pollfd* AddToPollFd(struct pollfd* aPfds);
-+ struct pollfd* LoadPollFd(struct pollfd* aPfds);
-+
-+ // Process this connection (send/receive data).
-+ // Returns false if connection is broken and should be removed.
-+ bool Process();
-+
-+ ~ProxiedConnection();
-+
-+ private:
-+ // Try to connect to compositor. Returns false in case of fatal error.
-+ bool ConnectToCompositor();
-+
-+ bool TransferOrQueue(
-+ int aSourceSocket, int aSourcePollFlags, int aDestSocket,
-+ std::vector<std::unique_ptr<WaylandMessage>>* aMessageQueue);
-+ bool FlushQueue(int aDestSocket, int aDestPollFlags,
-+ std::vector<std::unique_ptr<WaylandMessage>>&
aMessageQueue);
-+
-+ // We don't have connected compositor yet. Try to connect
-+ bool mCompositorConnected = false;
-+
-+ // We're disconnected from app or compositor. We will close this
connection.
-+ bool mFailed = false;
-+
-+ int mCompositorSocket = -1;
-+ int mCompositorFlags = 0;
-+
-+ int mApplicationSocket = -1;
-+ int mApplicationFlags = 0;
-+
-+ // Stored proxied data
-+ std::vector<std::unique_ptr<WaylandMessage>> mToCompositorQueue;
-+ std::vector<std::unique_ptr<WaylandMessage>> mToApplicationQueue;
-+};
-+
-+WaylandMessage::~WaylandMessage() {
-+ for (auto const fd : mFds) {
-+ close(fd);
-+ }
-+}
-+
-+bool WaylandMessage::Read(int aSocket) {
-+ // We don't expect WaylandMessage re-read
-+ assert(!mLoaded && !mFailed);
-+
-+ mData.resize(MAX_DATA_SIZE);
-+
-+ struct msghdr msg = {0};
-+ struct iovec iov = {mData.data(), mData.size()};
-+ msg.msg_iov = &iov;
-+ msg.msg_iovlen = 1;
-+
-+ char cmsgdata[(CMSG_LEN(MAX_LIBWAY_FDS * sizeof(int32_t)))] = {0};
-+ msg.msg_control = &cmsgdata;
-+ msg.msg_controllen = sizeof(cmsgdata);
-+
-+ ssize_t ret = recvmsg(aSocket, &msg, MSG_CMSG_CLOEXEC | MSG_DONTWAIT);
-+ if (msg.msg_flags & (MSG_CTRUNC | MSG_TRUNC)) {
-+ Error("WaylandMessage::Read() data truncated, small buffer?");
-+ mFailed = true;
-+ return false;
-+ }
-+
-+ if (ret < 1) {
-+ switch (errno) {
-+ case EAGAIN:
-+ case EINTR:
-+ // Neither loaded nor failed, we'll try again later
-+ Info("WaylandMessage::Write() failed %s\n", strerror(errno));
-+ return false;
-+ default:
-+ Error("WaylandMessage::Write() failed");
-+ mFailed = true;
-+ return false;
-+ }
-+ }
-+
-+ // Set correct data size
-+ mData.resize(ret);
-+
-+ // Read cmsg
-+ struct cmsghdr* header = CMSG_FIRSTHDR(&msg);
-+ while (header) {
-+ struct cmsghdr* next = CMSG_NXTHDR(&msg, header);
-+ if (header->cmsg_level != SOL_SOCKET || header->cmsg_type !=
SCM_RIGHTS) {
-+ header = next;
-+ continue;
-+ }
-+
-+ int* data = (int*)CMSG_DATA(header);
-+ int filenum = (int)((header->cmsg_len - CMSG_LEN(0)) / sizeof(int));
-+ for (int i = 0; i < filenum; i++) {
-+#ifdef DEBUG
-+ int flags = fcntl(data[i], F_GETFL, 0);
-+ if (flags == -1 && errno == EBADF) {
-+ Error("WaylandMessage::Read() invalid fd");
-+ }
-+#endif
-+ mFds.push_back(data[i]);
-+ }
-+ header = next;
-+ }
-+
-+ mLoaded = true;
-+ return true;
-+}
-+
-+bool WaylandMessage::Write(int aSocket) {
-+ if (!mLoaded || mFailed) {
-+ return false;
-+ }
-+
-+ struct msghdr msg = {0};
-+ struct iovec iov = {mData.data(), mData.size()};
-+ msg.msg_iov = &iov;
-+ msg.msg_iovlen = 1;
-+
-+ int filenum = mFds.size();
-+ if (filenum) {
-+ if (filenum >= MAX_LIBWAY_FDS) {
-+ Error("WaylandMessage::Write() too many files to send\n", false);
-+ return false;
-+ }
-+#ifdef DEBUG
-+ for (int i = 0; i < filenum; i++) {
-+ int flags = fcntl(mFds[i], F_GETFL, 0);
-+ if (flags == -1 && errno == EBADF) {
-+ Error("WaylandMessage::Write() invalid fd\n");
-+ }
-+ }
-+#endif
-+ union {
-+ char buf[CMSG_SPACE(sizeof(int) * MAX_LIBWAY_FDS)];
-+ struct cmsghdr align;
-+ } cmsgu;
-+ memset(cmsgu.buf, 0, sizeof(cmsgu.buf));
-+
-+ msg.msg_control = cmsgu.buf;
-+ msg.msg_controllen = sizeof(cmsgu.buf);
-+ msg.msg_controllen = CMSG_SPACE(filenum * sizeof(int));
-+
-+ struct cmsghdr* cmsg = CMSG_FIRSTHDR(&msg);
-+ cmsg->cmsg_level = SOL_SOCKET;
-+ cmsg->cmsg_type = SCM_RIGHTS;
-+ cmsg->cmsg_len = CMSG_LEN(filenum * sizeof(int));
-+ memcpy(CMSG_DATA(cmsg), mFds.data(), filenum * sizeof(int));
-+ }
-+
-+ ssize_t ret = sendmsg(aSocket, &msg, MSG_CMSG_CLOEXEC | MSG_DONTWAIT);
-+ if (ret < 1) {
-+ switch (errno) {
-+ case EAGAIN:
-+ case EINTR:
-+ // Neither loaded nor failed, we'll try again later
-+ Info("WaylandMessage::Write() failed %s\n", strerror(errno));
-+ return false;
-+ default:
-+ Warning("WaylandMessage::Write() failed");
-+ mFailed = true;
-+ return false;
-+ }
-+ }
-+
-+ if (ret != (ssize_t)mData.size()) {
-+ Info("WaylandMessage::Write() failed to write all data! (%d vs. %d)\n",
ret,
-+ mData.size());
-+ }
-+ return true;
-+}
-+
-+ProxiedConnection::~ProxiedConnection() {
-+ if (mCompositorSocket != -1) {
-+ close(mCompositorSocket);
-+ }
-+ if (mApplicationSocket != -1) {
-+ close(mApplicationSocket);
-+ }
-+}
-+
-+bool ProxiedConnection::Init(int aApplicationSocket) {
-+ mApplicationSocket = aApplicationSocket;
-+ mCompositorSocket =
-+ socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
-+ if (mCompositorSocket == -1) {
-+ Error("ProxiedConnection::Init() socket()");
-+ }
-+ return mApplicationSocket >= 0 && mCompositorSocket >= 0;
-+}
-+
-+struct pollfd* ProxiedConnection::AddToPollFd(struct pollfd* aPfds) {
-+ // Listen application's requests
-+ aPfds->fd = mApplicationSocket;
-+ aPfds->events = POLLIN;
-+
-+ // We're connected and we have data for appplication from compositor.
-+ // Add POLLOUT to request write to app socket.
-+ if (mCompositorConnected && !mToApplicationQueue.empty()) {
-+ aPfds->events |= POLLOUT;
-+ }
-+ aPfds++;
-+
-+ aPfds->fd = mCompositorSocket;
-+ aPfds->events = 0;
-+ // We're waiting for connection or we have data for compositor
-+ if (!mCompositorConnected || !mToCompositorQueue.empty()) {
-+ aPfds->events |= POLLOUT;
-+ }
-+ if (mCompositorConnected) {
-+ aPfds->events |= POLLIN;
-+ }
-+ aPfds++;
-+
-+ return aPfds;
-+}
-+
-+struct pollfd* ProxiedConnection::LoadPollFd(struct pollfd* aPfds) {
-+ if (aPfds->fd != mApplicationSocket) {
-+ return aPfds;
-+ }
-+ mApplicationFlags = aPfds->revents;
-+ aPfds++;
-+ mCompositorFlags = aPfds->revents;
-+ aPfds++;
-+ return aPfds;
-+}
-+
-+bool ProxiedConnection::ConnectToCompositor() {
-+ if (!(mCompositorFlags & POLLOUT)) {
-+ // Try again later
-+ return true;
-+ }
-+
-+ struct sockaddr_un addr = {};
-+ addr.sun_family = AF_UNIX;
-+ strcpy(addr.sun_path, sWaylandDisplay);
-+
-+ mCompositorConnected =
-+ connect(mCompositorSocket, (const struct sockaddr*)&addr,
-+ sizeof(struct sockaddr_un)) != -1;
-+ if (!mCompositorConnected) {
-+ switch (errno) {
-+ case EAGAIN:
-+ case EALREADY:
-+ case ECONNREFUSED:
-+ case EINPROGRESS:
-+ case EINTR:
-+ case EISCONN:
-+ case ETIMEDOUT:
-+ // We can recover from these errors and try again
-+ Warning("ConnectToCompositor() try again");
-+ return true;
-+ default:
-+ Error("ConnectToCompositor() connect()");
-+ return false;
-+ }
-+ }
-+ return true;
-+}
-+
-+// Read data from aSourceSocket and try to twite them to aDestSocket.
-+// If data write fails, append them to aMessageQueue.
-+// Return
-+bool ProxiedConnection::TransferOrQueue(
-+ int aSourceSocket, int aSourcePollFlags, int aDestSocket,
-+ std::vector<std::unique_ptr<WaylandMessage>>* aMessageQueue) {
-+ // Don't read if we don't have any data ready
-+ if (!(aSourcePollFlags & POLLIN)) {
-+ return true;
-+ }
-+
-+ while (1) {
-+ int availableData = 0;
-+ if (ioctl(aSourceSocket, FIONREAD, &availableData) < 0) {
-+ // Broken connection, we're finished here
-+ Warning("ProxiedConnection::TransferOrQueue() broken source socket
%s\n");
-+ return false;
-+ }
-+ if (availableData == 0) {
-+ return true;
-+ }
-+
-+ auto message = std::make_unique<WaylandMessage>(aSourceSocket);
-+ if (message->Failed()) {
-+ // Failed to read message due to error
-+ return false;
-+ }
-+ if (!message->Loaded()) {
-+ // Let's try again
-+ return true;
-+ }
-+ if (!message->Write(aDestSocket)) {
-+ if (message->Failed()) {
-+ // Failed to write and we can't recover
-+ return false;
-+ }
-+ aMessageQueue->push_back(std::move(message));
-+ }
-+ }
-+}
-+
-+// Try to flush all data to aMessageQueue.
-+bool ProxiedConnection::FlushQueue(
-+ int aDestSocket, int aDestPollFlags,
-+ std::vector<std::unique_ptr<WaylandMessage>>& aMessageQueue) {
-+ // Can't write to destination yet
-+ if (!(aDestPollFlags & POLLOUT) || aMessageQueue.empty()) {
-+ return true;
-+ }
-+
-+ std::vector<std::unique_ptr<WaylandMessage>>::iterator message;
-+ for (message = aMessageQueue.begin(); message != aMessageQueue.end();) {
-+ if (!(*message)->Write(aDestSocket)) {
-+ // Failed to write the message, remove whole connection
-+ // as it's broken.
-+ if ((*message)->Failed()) {
-+ return false;
-+ }
-+ break;
-+ }
-+ message++;
-+ }
-+
-+ // Remove all written messages at once.
-+ if (message != aMessageQueue.begin()) {
-+ aMessageQueue.erase(aMessageQueue.begin(), message);
-+ }
-+
-+ return true;
-+}
-+
-+bool ProxiedConnection::Process() {
-+ if (mFailed) {
-+ return false;
-+ }
-+
-+ // Check if appplication is still listening
-+ if (mApplicationFlags & (POLLHUP | POLLERR)) {
-+ return false;
-+ }
-+
-+ // Check if compositor is still listening
-+ if (mCompositorConnected) {
-+ if (mCompositorFlags & (POLLHUP | POLLERR)) {
-+ return false;
-+ }
-+ } else {
-+ // Try to reconnect to compositor.
-+ if (!ConnectToCompositor()) {
-+ Info("Failed to connect to compositor\n");
-+ return false;
-+ }
-+ // We're not connected yet but ConnectToCompositor() didn't return
-+ // fatal error. Try again later.
-+ if (!mCompositorConnected) {
-+ return true;
-+ }
-+ }
-+
-+ mFailed =
-+ !TransferOrQueue(mCompositorSocket, mCompositorFlags,
mApplicationSocket,
-+ &mToApplicationQueue) ||
-+ !TransferOrQueue(mApplicationSocket, mApplicationFlags,
mCompositorSocket,
-+ &mToCompositorQueue) ||
-+ !FlushQueue(mCompositorSocket, mCompositorFlags, mToCompositorQueue)
||
-+ !FlushQueue(mApplicationSocket, mApplicationFlags,
mToApplicationQueue);
-+
-+ return !mFailed;
-+}
-+
-+bool WaylandProxy::SetupWaylandDisplays() {
-+ char* waylandDisplay = getenv("WAYLAND_DISPLAY");
-+ if (!waylandDisplay) {
-+ Error("Init(), Missing Wayland display, WAYLAND_DISPLAY is empty.",
false);
-+ return false;
-+ }
-+
-+ char* XDGRuntimeDir = getenv("XDG_RUNTIME_DIR");
-+ if (!XDGRuntimeDir) {
-+ Error("Init() Missing XDG_RUNTIME_DIR", false);
-+ return false;
-+ }
-+
-+ // WAYLAND_DISPLAY can be absolute path
-+ if (waylandDisplay[0] == '/') {
-+ if (strlen(sWaylandDisplay) >= MAX_WAYLAND_DISPLAY_NAME_LEN) {
-+ Error("Init() WAYLAND_DISPLAY is too large.", false);
-+ return false;
-+ }
-+ strcpy(sWaylandDisplay, waylandDisplay);
-+ } else {
-+ int ret = snprintf(sWaylandDisplay, MAX_WAYLAND_DISPLAY_NAME_LEN,
"%s/%s",
-+ XDGRuntimeDir, waylandDisplay);
-+ if (ret < 0 || ret >= MAX_WAYLAND_DISPLAY_NAME_LEN) {
-+ Error("Init() WAYLAND_DISPLAY/XDG_RUNTIME_DIR is too large.", false);
-+ return false;
-+ }
-+ }
-+ int ret = snprintf(sWaylandProxy, MAX_WAYLAND_DISPLAY_NAME_LEN,
-+ "%s/wayland-proxy-%d", XDGRuntimeDir, getpid());
-+ if (ret < 0 || ret >= MAX_WAYLAND_DISPLAY_NAME_LEN) {
-+ Error("Init() WAYLAND_DISPLAY/XDG_RUNTIME_DIR is too large.", false);
-+ return false;
-+ }
-+
-+ Info("WaylandProxy Wayland '%s' proxy '%s'\n", sWaylandDisplay,
sWaylandProxy);
-+ return true;
-+}
-+
-+bool WaylandProxy::StartProxyServer() {
-+ mProxyServerSocket =
-+ socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
-+ if (mProxyServerSocket == -1) {
-+ Error("StartProxyServer(): failed to create socket");
-+ return false;
-+ }
-+
-+ struct sockaddr_un serverName = {0};
-+ serverName.sun_family = AF_UNIX;
-+ strcpy(serverName.sun_path, sWaylandProxy);
-+
-+ if (bind(mProxyServerSocket, (struct sockaddr*)&serverName,
-+ sizeof(serverName)) == -1) {
-+ Error("StartProxyServer(): bind() error");
-+ return false;
-+ }
-+ if (listen(mProxyServerSocket, 128) == -1) {
-+ Error("StartProxyServer(): listen() error");
-+ return false;
-+ }
-+
-+ return true;
-+}
-+
-+bool WaylandProxy::Init() {
-+ if (!SetupWaylandDisplays()) {
-+ return false;
-+ }
-+
-+ if (!StartProxyServer()) {
-+ return false;
-+ }
-+ return true;
-+}
-+
-+void WaylandProxy::SetWaylandProxyDisplay() {
-+ setenv("WAYLAND_DISPLAY", sWaylandProxy, true);
-+}
-+
-+void WaylandProxy::SetWaylandDisplay() {
-+ setenv("WAYLAND_DISPLAY", sWaylandDisplay, true);
-+}
-+
-+bool WaylandProxy::IsChildAppTerminated() {
-+ if (!mApplicationPID) {
-+ return false;
-+ }
-+ int status = 0;
-+ int ret = waitpid(mApplicationPID, &status, WNOHANG | WUNTRACED |
WCONTINUED);
-+ if (ret == 0) {
-+ return false;
-+ }
-+ if (ret == mApplicationPID) {
-+ // Child application is terminated, so quit too.
-+ return true;
-+ }
-+ bool terminate = (errno == ECHILD);
-+ Error("IsChildAppTerminated: waitpid() error");
-+ return terminate;
-+}
-+
-+bool WaylandProxy::PollConnections() {
-+ int nfds_max = mConnections.size() * 2 + 1;
-+
-+ struct pollfd pollfds[nfds_max];
-+ struct pollfd* addedPollfd = pollfds;
-+
-+ for (auto const& connection : mConnections) {
-+ addedPollfd = connection->AddToPollFd(addedPollfd);
-+ }
-+ int nfds = (addedPollfd - pollfds);
-+
-+ // If all connections are attached to compositor, add another one
-+ // for new potential connection from application.
-+ bool addNewConnection = mConnections.empty() ||
-+ mConnections.back()->IsConnected();
-+ if (addNewConnection) {
-+ addedPollfd->fd = mProxyServerSocket;
-+ addedPollfd->events = POLLIN;
-+ nfds++;
-+ }
-+ assert(addedPollfd < pollfds + nfds_max);
-+
-+ while (1) {
-+ int ret = poll(pollfds, nfds, POLL_TIMEOUT);
-+ if (ret == 0) {
-+ // No change on fds
-+ continue;
-+ } else if (ret > 0) {
-+ // We have FD to read
-+ break;
-+ } else if (ret == -1) {
-+ switch (errno) {
-+ case EINTR:
-+ case EAGAIN:
-+ if (IsChildAppTerminated()) {
-+ return false;
-+ }
-+ continue;
-+ default:
-+ Error("Run: poll() error");
-+ return false;
-+ }
-+ }
-+ }
-+
-+ struct pollfd* loadedPollfd = pollfds;
-+ for (auto const& connection : mConnections) {
-+ loadedPollfd = connection->LoadPollFd(loadedPollfd);
-+ }
-+
-+ assert(loadedPollfd == addedPollfd);
-+ assert(loadedPollfd < pollfds + nfds_max);
-+
-+ // Create a new connection if there's a new client waiting
-+ if (addNewConnection && (loadedPollfd->revents & POLLIN)) {
-+ Info("WaylandProxy: new child connection\n");
-+ int applicationSocket = accept4(loadedPollfd->fd, nullptr, nullptr,
-+ SOCK_NONBLOCK | SOCK_CLOEXEC);
-+ if (applicationSocket == -1) {
-+ switch (errno) {
-+ case EAGAIN:
-+ case EINTR:
-+ // Try again later
-+ break;
-+ default:
-+ Error("Faild to accept connection from application");
-+ return false;
-+ }
-+ } else {
-+ auto connection = std::make_unique<ProxiedConnection>();
-+ if (connection->Init(applicationSocket)) {
-+ mConnections.push_back(std::move(connection));
-+ }
-+ }
-+ }
-+
-+ return true;
-+}
-+
-+bool WaylandProxy::ProcessConnections() {
-+ std::vector<std::unique_ptr<ProxiedConnection>>::iterator connection;
-+ for (connection = mConnections.begin(); connection !=
mConnections.end();) {
-+ if (!(*connection)->Process()) {
-+ Info("WaylandProxy: remove connection\n");
-+ connection = mConnections.erase(connection);
-+ if (mConnections.empty()) {
-+ // We removed last connection - quit.
-+ Info("WaylandProxy: removed last connection, quit\n");
-+ return false;
-+ }
-+ } else {
-+ connection++;
-+ }
-+ }
-+ return true;
-+}
-+
-+void WaylandProxy::Run() {
-+ while (!IsChildAppTerminated() && PollConnections() &&
ProcessConnections())
-+ ;
-+}
-+
-+WaylandProxy::~WaylandProxy() {
-+ Info("WaylandProxy terminated\n");
-+ if (mThreadRunning) {
-+ Info("WaylandProxy thread is still running, terminating.\n");
-+ mThreadRunning = false;
-+ pthread_cancel(mThread);
-+ pthread_join(mThread, nullptr);
-+ }
-+ unlink(sWaylandProxy);
-+ if (mProxyServerSocket != -1) {
-+ close(mProxyServerSocket);
-+ }
-+ SetWaylandDisplay();
-+}
-+
-+void* WaylandProxy::RunProxyThread(WaylandProxy* aProxy) {
-+#ifdef __linux__
-+ pthread_setname_np(pthread_self(), "WaylandProxy");
-+#endif
-+ aProxy->Run();
-+ Info("WaylandProxy thread exited\n");
-+ return nullptr;
-+}
-+
-+std::unique_ptr<WaylandProxy> WaylandProxy::Create() {
-+ auto proxy = std::make_unique<WaylandProxy>();
-+ if (!proxy->Init()) {
-+ return nullptr;
-+ }
-+
-+ Info("WaylandProxyCreated, display %s\n", sWaylandProxy);
-+ return proxy;
-+}
-+
-+bool WaylandProxy::RunChildApplication(char* argv[]) {
-+ if (!argv[0]) {
-+ Error("WaylandProxy::RunChildApplication: missing application to run",
false);
-+ return false;
-+ }
-+
-+ mApplicationPID = fork();
-+ if (mApplicationPID == -1) {
-+ Error("WaylandProxy::RunChildApplication: fork() error");
-+ return false;
-+ }
-+ if (mApplicationPID == 0) {
-+ SetWaylandProxyDisplay();
-+ if (execv(argv[0], argv) == -1) {
-+ ErrorPlain("WaylandProxy::RunChildApplication: failed to run %s error
%s\n", argv[0], strerror(errno));
-+ exit(1);
-+ }
-+ }
-+
-+ Run();
-+ return true;
-+}
-+
-+bool WaylandProxy::RunThread() {
-+ pthread_attr_t attr;
-+ if (pthread_attr_init(&attr) != 0) {
-+ return false;
-+ }
-+
-+ sched_param param;
-+ if (pthread_attr_getschedparam(&attr, &param) == 0) {
-+ param.sched_priority = sched_get_priority_min(SCHED_RR);
-+ pthread_attr_setschedparam(&attr, &param);
-+ }
-+
-+ SetWaylandProxyDisplay();
-+
-+ mThreadRunning = pthread_create(&mThread, nullptr, (void*
(*)(void*))RunProxyThread, this) == 0;
-+ if (!mThreadRunning) {
-+ // If we failed to run proxy thread, set WAYLAND_DISPLAY back.
-+ SetWaylandDisplay();
-+ }
-+
-+ pthread_attr_destroy(&attr);
-+ return mThreadRunning;
-+}
-+
-+void WaylandProxy::SetVerbose(bool aVerbose) { sPrintInfo = aVerbose; }
-diff --git a/third_party/wayland-proxy/wayland-proxy.h
b/third_party/wayland-proxy/wayland-proxy.h
-new file mode 100644
---- /dev/null
-+++ b/third_party/wayland-proxy/wayland-proxy.h
-@@ -0,0 +1,58 @@
-+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
-+ * This Source Code Form is subject to the terms of the Mozilla Public
-+ * License, v. 2.0. If a copy of the MPL was not distributed with this
-+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-+
-+#ifndef _wayland_proxy_h_
-+#define _wayland_proxy_h_
-+
-+#include <poll.h>
-+#include <vector>
-+#include <fcntl.h>
-+#include <atomic>
-+#include <memory>
-+
-+class ProxiedConnection;
-+
-+class WaylandProxy {
-+ public:
-+ static std::unique_ptr<WaylandProxy> Create();
-+
-+ // Launch an application with Wayland proxy set
-+ bool RunChildApplication(char* argv[]);
-+
-+ // Run proxy as part of already running application
-+ // and set Wayland proxy display for it.
-+ bool RunThread();
-+
-+ // Set original Wayland display env variable.
-+ void SetWaylandDisplay();
-+
-+ static void SetVerbose(bool aVerbose);
-+
-+ ~WaylandProxy();
-+
-+ private:
-+ bool Init();
-+ void Run();
-+
-+ void SetWaylandProxyDisplay();
-+ static void* RunProxyThread(WaylandProxy* aProxy);
-+
-+ bool SetupWaylandDisplays();
-+ bool StartProxyServer();
-+ bool IsChildAppTerminated();
-+
-+ bool PollConnections();
-+ bool ProcessConnections();
-+
-+ private:
-+ // List of all Compositor <-> Application connections
-+ std::vector<std::unique_ptr<ProxiedConnection>> mConnections;
-+ int mProxyServerSocket = -1;
-+ pid_t mApplicationPID = 0;
-+ std::atomic<bool> mThreadRunning = false;
-+ pthread_t mThread;
-+};
-+
-+#endif // _wayland_proxy_h_
-diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build
---- a/widget/gtk/moz.build
-+++ b/widget/gtk/moz.build
-@@ -18,17 +18,17 @@ with Files("*IMContextWrapper*"):
-
- with Files("*nsGtkKeyUtils*"):
- BUG_COMPONENT = ("Core", "DOM: UI Events & Focus Handling")
-
- if CONFIG["COMPILE_ENVIRONMENT"]:
- DIRS += ["mozgtk"]
-
- if CONFIG["MOZ_WAYLAND"]:
-- DIRS += ["wayland", "mozwayland"]
-+ DIRS += ["wayland", "mozwayland", "../../third_party/wayland-proxy"]
-
- if CONFIG["MOZ_ENABLE_VAAPI"]:
- DIRS += ["vaapitest"]
-
- if CONFIG["MOZ_ENABLE_V4L2"]:
- DIRS += ["v4l2test"]
-
- EXPORTS += [
-
-
-# HG changeset patch
-# User stransky <stransky AT redhat.com>
-# Date 1704803102 0
-# Node ID b0d2efdcd6cc0254d9c02cf82e7fe83c09d32e89
-# Parent 6a0659188d6c3d77231a59f836c1a42462d2725c
-Bug 1743144 [Wayland] Enable Wayland proxy on start r=emilio
-
-Differential Revision: https://phabricator.services.mozilla.com/D196555
-
-diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
---- a/toolkit/xre/nsAppRunner.cpp
-+++ b/toolkit/xre/nsAppRunner.cpp
-@@ -339,23 +339,34 @@ nsString gProcessStartupShortcut;
-
- #if defined(MOZ_WIDGET_GTK)
- # include <glib.h>
- # include "mozilla/WidgetUtilsGtk.h"
- # include <gtk/gtk.h>
- # ifdef MOZ_WAYLAND
- # include <gdk/gdkwayland.h>
- # include "mozilla/widget/nsWaylandDisplay.h"
-+# include "wayland-proxy.h"
- # endif
- # ifdef MOZ_X11
- # include <gdk/gdkx.h>
- # endif /* MOZ_X11 */
- #endif
-+
-+#if defined(MOZ_WAYLAND)
-+std::unique_ptr<WaylandProxy> gWaylandProxy;
-+#endif
-+
- #include "BinaryPath.h"
-
-+#ifdef MOZ_LOGGING
-+# include "mozilla/Logging.h"
-+extern mozilla::LazyLogModule gWidgetWaylandLog;
-+#endif /* MOZ_LOGGING */
-+
- #ifdef FUZZING
- # include "FuzzerRunner.h"
-
- namespace mozilla {
- FuzzerRunner* fuzzerRunner = 0;
- } // namespace mozilla
-
- # ifdef LIBFUZZER
-@@ -2787,16 +2798,19 @@ static ReturnAbortOnError ProfileLockedD
- SaveFileToEnv("XRE_PROFILE_LOCAL_PATH", aProfileLocalDir);
-
- #if defined(MOZ_HAS_REMOTE)
- if (gRemoteService) {
- gRemoteService->UnlockStartup();
- gRemoteService = nullptr;
- }
- #endif
-+#if defined(MOZ_WAYLAND)
-+ gWaylandProxy = nullptr;
-+#endif
- return LaunchChild(false, true);
- }
- } else {
- rv = ps->Alert(nullptr, killTitle.get(), killMessage.get());
- NS_ENSURE_SUCCESS_LOG(rv, rv);
- }
-
- return NS_ERROR_ABORT;
-@@ -2901,16 +2915,19 @@ static ReturnAbortOnError ShowProfileMan
- gRestartArgv[gRestartArgc] = nullptr;
- }
- #if defined(MOZ_HAS_REMOTE)
- if (gRemoteService) {
- gRemoteService->UnlockStartup();
- gRemoteService = nullptr;
- }
- #endif
-+#if defined(MOZ_WAYLAND)
-+ gWaylandProxy = nullptr;
-+#endif
- return LaunchChild(false, true);
- }
-
- static bool gDoMigration = false;
- static bool gDoProfileReset = false;
- static nsCOMPtr<nsIToolkitProfile> gResetOldProfile;
-
- static nsresult LockProfile(nsINativeAppSupport* aNative, nsIFile* aRootDir,
-@@ -4706,26 +4723,42 @@ int XREMain::XRE_mainStartup(bool* aExit
- XInitThreads();
- }
- #endif
- #if defined(MOZ_WIDGET_GTK)
- if (!isBackgroundTaskMode && !gfxPlatform::IsHeadless()) {
- const char* display_name = nullptr;
- bool saveDisplayArg = false;
-
-+ bool waylandEnabled = IsWaylandEnabled();
-+# ifdef MOZ_WAYLAND
-+ auto* proxyEnv = getenv("MOZ_DISABLE_WAYLAND_PROXY");
-+ bool disableWaylandProxy = proxyEnv && *proxyEnv;
-+ if (!disableWaylandProxy && XRE_IsParentProcess() && waylandEnabled) {
-+# ifdef MOZ_LOGGING
-+ if (MOZ_LOG_TEST(gWidgetWaylandLog, mozilla::LogLevel::Debug)) {
-+ WaylandProxy::SetVerbose(true);
-+ }
-+# endif
-+ gWaylandProxy = WaylandProxy::Create();
-+ if (gWaylandProxy) {
-+ gWaylandProxy->RunThread();
-+ }
-+ }
-+# endif
-+
- // display_name is owned by gdk.
- display_name = gdk_get_display_arg_name();
- // if --display argument is given make sure it's
- // also passed to ContentChild::Init() by MOZ_GDK_DISPLAY.
- if (display_name) {
- SaveWordToEnv("MOZ_GDK_DISPLAY", nsDependentCString(display_name));
- saveDisplayArg = true;
- }
-
-- bool waylandEnabled = IsWaylandEnabled();
- // On Wayland disabled builds read X11 DISPLAY env exclusively
- // and don't care about different displays.
- if (!waylandEnabled && !display_name) {
- display_name = PR_GetEnv("DISPLAY");
- if (!display_name) {
- PR_fprintf(PR_STDERR,
- "Error: no DISPLAY environment variable specified\n");
- return 1;
-@@ -5954,16 +5987,17 @@ int XREMain::XRE_main(int argc, char* ar
- mozilla::AppShutdown::MaybeDoRestart();
-
- #ifdef MOZ_WIDGET_GTK
- // gdk_display_close also calls gdk_display_manager_set_default_display
- // appropriately when necessary.
- if (!gfxPlatform::IsHeadless()) {
- # ifdef MOZ_WAYLAND
- WaylandDisplayRelease();
-+ gWaylandProxy = nullptr;
- # endif
- }
- #endif
-
- XRE_DeinitCommandLine();
-
- if (NS_FAILED(rv)) {
- return 1;
-
-
diff --git
a/http/firefox/patches/0029-bgo-919418-ppc64-flac-decoder-unsupported.patch
b/http/firefox/patches/0029-bgo-919418-ppc64-flac-decoder-unsupported.patch
deleted file mode 100644
index 660b1ff..0000000
---
a/http/firefox/patches/0029-bgo-919418-ppc64-flac-decoder-unsupported.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/dom/media/flac/FlacDecoder.cpp 2023-11-23 07:59:17.466486168 -0500
-+++ b/dom/media/flac/FlacDecoder.cpp 2023-11-23 08:00:49.048026379 -0500
-@@ -18,7 +18,7 @@
- #elif defined(MOZ_FFMPEG)
- RefPtr<PDMFactory> platform = new PDMFactory();
- return StaticPrefs::media_flac_enabled() &&
-- (platform->SupportsMimeType("audio/flac"_ns) !=
media::DecodeSupport::Unsupported);
-+ !(platform->SupportsMimeType("audio/flac"_ns).isEmpty());
- #else
- return false;
- #endif
diff --git
a/http/firefox/patches/0029-bmo-1793001-switch-egrep-to-grepE.patch
b/http/firefox/patches/0029-bmo-1793001-switch-egrep-to-grepE.patch
new file mode 100644
index 0000000..6f8bb92
--- /dev/null
+++ b/http/firefox/patches/0029-bmo-1793001-switch-egrep-to-grepE.patch
@@ -0,0 +1,171 @@
+
+# HG changeset patch
+# User serge-sans-paille <sguelton AT mozilla.com>
+# Date 1705502237 0
+# Node ID fba2b83c6fe029b15ea8d4573961321908eb9a4c
+# Parent 0a29fd63bff9404c9db0783f0b16b2b76d39ddb4
+Bug 1793001 - s/egrep/grep -E/ r=ahochheiden
+
+Differential Revision: https://phabricator.services.mozilla.com/D197508
+
+diff --git a/build/autoconf/acgeneral.m4 b/build/autoconf/acgeneral.m4
+--- a/build/autoconf/acgeneral.m4
++++ b/build/autoconf/acgeneral.m4
+@@ -1699,17 +1699,17 @@ cat > conftest.$ac_ext <<EOF
+ #include "confdefs.h"
+ [$2]
+ EOF
+ dnl eval is necessary to expand ac_cpp.
+ dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use
subshell.
+ if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC |
+ dnl Prevent m4 from eating character classes:
+ changequote(, )dnl
+- egrep "$1" >/dev/null 2>&1; then
++ grep -E "$1" >/dev/null 2>&1; then
+ changequote([, ])dnl
+ ifelse([$3], , :, [rm -rf conftest*
+ $3])
+ ifelse([$4], , , [else
+ rm -rf conftest*
+ $4
+ ])dnl
+ fi
+diff --git a/build/autoconf/acspecific.m4 b/build/autoconf/acspecific.m4
+--- a/build/autoconf/acspecific.m4
++++ b/build/autoconf/acspecific.m4
+@@ -255,31 +255,31 @@ cross_compiling=$ac_cv_prog_f77_cross
+ AC_DEFUN(AC_PROG_CC_GNU,
+ [AC_CACHE_CHECK(whether we are using GNU C, ac_cv_prog_gcc,
+ [dnl The semicolon is to pacify NeXT's syntax-checking cpp.
+ cat > conftest.c <<EOF
+ #ifdef __GNUC__
+ yes;
+ #endif
+ EOF
+-if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
++if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | grep -E yes >/dev/null 2>&1;
then
+ ac_cv_prog_gcc=yes
+ else
+ ac_cv_prog_gcc=no
+ fi])])
+
+ AC_DEFUN(AC_PROG_CXX_GNU,
+ [AC_CACHE_CHECK(whether we are using GNU C++, ac_cv_prog_gxx,
+ [dnl The semicolon is to pacify NeXT's syntax-checking cpp.
+ cat > conftest.C <<EOF
+ #ifdef __GNUC__
+ yes;
+ #endif
+ EOF
+-if AC_TRY_COMMAND(${CXX-g++} -E conftest.C) | egrep yes >/dev/null 2>&1;
then
++if AC_TRY_COMMAND(${CXX-g++} -E conftest.C) | grep -E yes >/dev/null 2>&1;
then
+ ac_cv_prog_gxx=yes
+ else
+ ac_cv_prog_gxx=no
+ fi])])
+
+ dnl Test whether for Fortran 77 compiler is `g77' (the GNU Fortran 77
+ dnl Compiler). This test depends on whether the Fortran 77 compiler can
+ dnl do CPP pre-processing.
+@@ -287,17 +287,17 @@ dnl
+ dnl AC_PROG_F77_GNU()
+ AC_DEFUN(AC_PROG_F77_GNU,
+ [AC_CACHE_CHECK(whether we are using GNU Fortran 77, ac_cv_prog_g77,
+ [cat > conftest.fpp <<EOF
+ #ifdef __GNUC__
+ yes
+ #endif
+ EOF
+-if AC_TRY_COMMAND($F77 -E conftest.fpp) | egrep yes >/dev/null 2>&1; then
++if AC_TRY_COMMAND($F77 -E conftest.fpp) | grep -E yes >/dev/null 2>&1; then
+ ac_cv_prog_g77=yes
+ else
+ ac_cv_prog_g77=no
+ fi])])
+
+ AC_DEFUN(AC_PROG_CC_G,
+ [AC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_cc_g,
+ [echo 'void f(){}' > conftest.c
+diff --git a/js/src/old-configure.in b/js/src/old-configure.in
+--- a/js/src/old-configure.in
++++ b/js/src/old-configure.in
+@@ -613,17 +613,17 @@ then
+ dnl See if -pthread is supported.
+ dnl
+ rm -f conftest*
+ ac_cv_have_dash_pthread=no
+ AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
+ echo 'int main() { return 0; }' | cat > conftest.c
+ ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
+ if test $? -eq 0; then
+- if test -z "`egrep -i '(unrecognize|unknown)' conftest.out |
grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
++ if test -z "`grep -E -i '(unrecognize|unknown)' conftest.out
| grep pthread`" -a -z "`grep -E -i '(error|incorrect)' conftest.out`" ; then
+ ac_cv_have_dash_pthread=yes
+ case "$target_os" in
+ freebsd*)
+ # Freebsd doesn't use -pthread for compiles, it uses them for linking
+ ;;
+ *)
+ CFLAGS="$CFLAGS -pthread"
+ CXXFLAGS="$CXXFLAGS -pthread"
+@@ -638,17 +638,17 @@ then
+ dnl See if -pthreads is supported.
+ dnl
+ ac_cv_have_dash_pthreads=no
+ if test "$ac_cv_have_dash_pthread" = "no"; then
+ AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
+ echo 'int main() { return 0; }' | cat > conftest.c
+ ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
+ if test $? -eq 0; then
+- if test -z "`egrep -i '(unrecognize|unknown)' conftest.out |
grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
++ if test -z "`grep -E -i '(unrecognize|unknown)' conftest.out
| grep pthreads`" -a -z "`grep -E -i '(error|incorrect)' conftest.out`" ; then
+ ac_cv_have_dash_pthreads=yes
+ CFLAGS="$CFLAGS -pthreads"
+ CXXFLAGS="$CXXFLAGS -pthreads"
+ fi
+ fi
+ rm -f conftest*
+ AC_MSG_RESULT($ac_cv_have_dash_pthreads)
+ fi
+diff --git a/old-configure.in b/old-configure.in
+--- a/old-configure.in
++++ b/old-configure.in
+@@ -652,17 +652,17 @@ then
+ dnl See if -pthread is supported.
+ dnl
+ rm -f conftest*
+ ac_cv_have_dash_pthread=no
+ AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
+ echo 'int main() { return 0; }' | cat > conftest.c
+ ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
+ if test $? -eq 0; then
+- if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep
pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
++ if test -z "`grep -E -i '(unrecognize|unknown)' conftest.out | grep
pthread`" -a -z "`grep -E -i '(error|incorrect)' conftest.out`" ; then
+ ac_cv_have_dash_pthread=yes
+ case "$target_os" in
+ freebsd*)
+ # Freebsd doesn't use -pthread for compiles, it uses them for linking
+ ;;
+ *)
+ CFLAGS="$CFLAGS -pthread"
+ CXXFLAGS="$CXXFLAGS -pthread"
+@@ -677,17 +677,17 @@ then
+ dnl See if -pthreads is supported.
+ dnl
+ ac_cv_have_dash_pthreads=no
+ if test "$ac_cv_have_dash_pthread" = "no"; then
+ AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
+ echo 'int main() { return 0; }' | cat > conftest.c
+ ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
+ if test $? -eq 0; then
+- if test -z "`egrep -i '(unrecognize|unknown)' conftest.out |
grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
++ if test -z "`grep -E -i '(unrecognize|unknown)' conftest.out |
grep pthreads`" -a -z "`grep -E -i '(error|incorrect)' conftest.out`" ; then
+ ac_cv_have_dash_pthreads=yes
+ CFLAGS="$CFLAGS -pthreads"
+ CXXFLAGS="$CXXFLAGS -pthreads"
+ fi
+ fi
+ rm -f conftest*
+ AC_MSG_RESULT($ac_cv_have_dash_pthreads)
+ fi
+
diff --git
a/http/firefox/patches/0030-bmo-1793001-switch-egrep-to-grepE.patch
b/http/firefox/patches/0030-bmo-1793001-switch-egrep-to-grepE.patch
deleted file mode 100644
index 6f8bb92..0000000
--- a/http/firefox/patches/0030-bmo-1793001-switch-egrep-to-grepE.patch
+++ /dev/null
@@ -1,171 +0,0 @@
-
-# HG changeset patch
-# User serge-sans-paille <sguelton AT mozilla.com>
-# Date 1705502237 0
-# Node ID fba2b83c6fe029b15ea8d4573961321908eb9a4c
-# Parent 0a29fd63bff9404c9db0783f0b16b2b76d39ddb4
-Bug 1793001 - s/egrep/grep -E/ r=ahochheiden
-
-Differential Revision: https://phabricator.services.mozilla.com/D197508
-
-diff --git a/build/autoconf/acgeneral.m4 b/build/autoconf/acgeneral.m4
---- a/build/autoconf/acgeneral.m4
-+++ b/build/autoconf/acgeneral.m4
-@@ -1699,17 +1699,17 @@ cat > conftest.$ac_ext <<EOF
- #include "confdefs.h"
- [$2]
- EOF
- dnl eval is necessary to expand ac_cpp.
- dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use
subshell.
- if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC |
- dnl Prevent m4 from eating character classes:
- changequote(, )dnl
-- egrep "$1" >/dev/null 2>&1; then
-+ grep -E "$1" >/dev/null 2>&1; then
- changequote([, ])dnl
- ifelse([$3], , :, [rm -rf conftest*
- $3])
- ifelse([$4], , , [else
- rm -rf conftest*
- $4
- ])dnl
- fi
-diff --git a/build/autoconf/acspecific.m4 b/build/autoconf/acspecific.m4
---- a/build/autoconf/acspecific.m4
-+++ b/build/autoconf/acspecific.m4
-@@ -255,31 +255,31 @@ cross_compiling=$ac_cv_prog_f77_cross
- AC_DEFUN(AC_PROG_CC_GNU,
- [AC_CACHE_CHECK(whether we are using GNU C, ac_cv_prog_gcc,
- [dnl The semicolon is to pacify NeXT's syntax-checking cpp.
- cat > conftest.c <<EOF
- #ifdef __GNUC__
- yes;
- #endif
- EOF
--if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
-+if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | grep -E yes >/dev/null 2>&1;
then
- ac_cv_prog_gcc=yes
- else
- ac_cv_prog_gcc=no
- fi])])
-
- AC_DEFUN(AC_PROG_CXX_GNU,
- [AC_CACHE_CHECK(whether we are using GNU C++, ac_cv_prog_gxx,
- [dnl The semicolon is to pacify NeXT's syntax-checking cpp.
- cat > conftest.C <<EOF
- #ifdef __GNUC__
- yes;
- #endif
- EOF
--if AC_TRY_COMMAND(${CXX-g++} -E conftest.C) | egrep yes >/dev/null 2>&1;
then
-+if AC_TRY_COMMAND(${CXX-g++} -E conftest.C) | grep -E yes >/dev/null 2>&1;
then
- ac_cv_prog_gxx=yes
- else
- ac_cv_prog_gxx=no
- fi])])
-
- dnl Test whether for Fortran 77 compiler is `g77' (the GNU Fortran 77
- dnl Compiler). This test depends on whether the Fortran 77 compiler can
- dnl do CPP pre-processing.
-@@ -287,17 +287,17 @@ dnl
- dnl AC_PROG_F77_GNU()
- AC_DEFUN(AC_PROG_F77_GNU,
- [AC_CACHE_CHECK(whether we are using GNU Fortran 77, ac_cv_prog_g77,
- [cat > conftest.fpp <<EOF
- #ifdef __GNUC__
- yes
- #endif
- EOF
--if AC_TRY_COMMAND($F77 -E conftest.fpp) | egrep yes >/dev/null 2>&1; then
-+if AC_TRY_COMMAND($F77 -E conftest.fpp) | grep -E yes >/dev/null 2>&1; then
- ac_cv_prog_g77=yes
- else
- ac_cv_prog_g77=no
- fi])])
-
- AC_DEFUN(AC_PROG_CC_G,
- [AC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_cc_g,
- [echo 'void f(){}' > conftest.c
-diff --git a/js/src/old-configure.in b/js/src/old-configure.in
---- a/js/src/old-configure.in
-+++ b/js/src/old-configure.in
-@@ -613,17 +613,17 @@ then
- dnl See if -pthread is supported.
- dnl
- rm -f conftest*
- ac_cv_have_dash_pthread=no
- AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
- echo 'int main() { return 0; }' | cat > conftest.c
- ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
- if test $? -eq 0; then
-- if test -z "`egrep -i '(unrecognize|unknown)' conftest.out |
grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
-+ if test -z "`grep -E -i '(unrecognize|unknown)' conftest.out
| grep pthread`" -a -z "`grep -E -i '(error|incorrect)' conftest.out`" ; then
- ac_cv_have_dash_pthread=yes
- case "$target_os" in
- freebsd*)
- # Freebsd doesn't use -pthread for compiles, it uses them for linking
- ;;
- *)
- CFLAGS="$CFLAGS -pthread"
- CXXFLAGS="$CXXFLAGS -pthread"
-@@ -638,17 +638,17 @@ then
- dnl See if -pthreads is supported.
- dnl
- ac_cv_have_dash_pthreads=no
- if test "$ac_cv_have_dash_pthread" = "no"; then
- AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
- echo 'int main() { return 0; }' | cat > conftest.c
- ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
- if test $? -eq 0; then
-- if test -z "`egrep -i '(unrecognize|unknown)' conftest.out |
grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
-+ if test -z "`grep -E -i '(unrecognize|unknown)' conftest.out
| grep pthreads`" -a -z "`grep -E -i '(error|incorrect)' conftest.out`" ; then
- ac_cv_have_dash_pthreads=yes
- CFLAGS="$CFLAGS -pthreads"
- CXXFLAGS="$CXXFLAGS -pthreads"
- fi
- fi
- rm -f conftest*
- AC_MSG_RESULT($ac_cv_have_dash_pthreads)
- fi
-diff --git a/old-configure.in b/old-configure.in
---- a/old-configure.in
-+++ b/old-configure.in
-@@ -652,17 +652,17 @@ then
- dnl See if -pthread is supported.
- dnl
- rm -f conftest*
- ac_cv_have_dash_pthread=no
- AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
- echo 'int main() { return 0; }' | cat > conftest.c
- ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
- if test $? -eq 0; then
-- if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep
pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
-+ if test -z "`grep -E -i '(unrecognize|unknown)' conftest.out | grep
pthread`" -a -z "`grep -E -i '(error|incorrect)' conftest.out`" ; then
- ac_cv_have_dash_pthread=yes
- case "$target_os" in
- freebsd*)
- # Freebsd doesn't use -pthread for compiles, it uses them for linking
- ;;
- *)
- CFLAGS="$CFLAGS -pthread"
- CXXFLAGS="$CXXFLAGS -pthread"
-@@ -677,17 +677,17 @@ then
- dnl See if -pthreads is supported.
- dnl
- ac_cv_have_dash_pthreads=no
- if test "$ac_cv_have_dash_pthread" = "no"; then
- AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
- echo 'int main() { return 0; }' | cat > conftest.c
- ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
- if test $? -eq 0; then
-- if test -z "`egrep -i '(unrecognize|unknown)' conftest.out |
grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
-+ if test -z "`grep -E -i '(unrecognize|unknown)' conftest.out |
grep pthreads`" -a -z "`grep -E -i '(error|incorrect)' conftest.out`" ; then
- ac_cv_have_dash_pthreads=yes
- CFLAGS="$CFLAGS -pthreads"
- CXXFLAGS="$CXXFLAGS -pthreads"
- fi
- fi
- rm -f conftest*
- AC_MSG_RESULT($ac_cv_have_dash_pthreads)
- fi
-


  • [[SM-Commit] ] GIT changes to master grimoire by Pavel Vinogradov (c3c1ccdff8fe43e28b21653bd4238e80ddb1d775), Pavel Vinogradov, 02/02/2024

Archive powered by MHonArc 2.6.24.

Top of Page