git: a9097e0cd9ee - main - mail/thunderbird-esr: copy thunderbird 128.9.0

From: Christoph Moench-Tegeder <cmt_at_FreeBSD.org>
Date: Thu, 27 Mar 2025 19:10:36 UTC
The branch main has been updated by cmt:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a9097e0cd9ee6794deea0015289aae24f8176916

commit a9097e0cd9ee6794deea0015289aae24f8176916
Author:     Christoph Moench-Tegeder <cmt@FreeBSD.org>
AuthorDate: 2025-03-27 19:06:37 +0000
Commit:     Christoph Moench-Tegeder <cmt@FreeBSD.org>
CommitDate: 2025-03-27 19:06:37 +0000

    mail/thunderbird-esr: copy thunderbird 128.9.0
    
    in preparation for importing Thunderbird 137.0
    
    Release Notes (soon):
      https://www.thunderbird.net/en-US/thunderbird/128.9.0esr/releasenotes/
---
 mail/Makefile                                      |     1 +
 mail/thunderbird-esr/Makefile                      |    72 +
 mail/thunderbird-esr/distinfo                      |     3 +
 mail/thunderbird-esr/files/patch-addon-search      |    29 +
 .../files/patch-browser-app-nsBrowserApp.cpp       |    14 +
 .../files/patch-bug1269654_comment5                |    43 +
 .../files/patch-bug1504834_comment10               |    36 +
 .../files/patch-bug1504834_comment5                |    83 +
 mail/thunderbird-esr/files/patch-bug1559213        |   131 +
 .../files/patch-bug1612181_comment1                |   191 +
 mail/thunderbird-esr/files/patch-bug1626236        |    88 +
 mail/thunderbird-esr/files/patch-bug1659612        |    41 +
 mail/thunderbird-esr/files/patch-bug1716707        |    56 +
 mail/thunderbird-esr/files/patch-bug1874059        |    25 +
 mail/thunderbird-esr/files/patch-bug1876366        |    23 +
 mail/thunderbird-esr/files/patch-bug847568         |   260 +
 .../patch-comm__third_party__rnpdefs.mozbuild      |    10 +
 mail/thunderbird-esr/files/patch-env-api-keys      |    21 +
 .../files/patch-gfx_skia_skia_src_base_SkEndian.h  |    13 +
 ...patch-gfx_skia_skia_src_core_SkRasterPipeline.h |    13 +
 .../files/patch-i386-protobuf-alignment            |    15 +
 .../files/patch-js_public_Utility.h                |    35 +
 .../files/patch-libwebrtc-generated                | 98851 +++++++++++++++++++
 .../files/patch-libwebrtc-powerpc64                |   264 +
 .../files/patch-mail-app-nsMailApp.cpp             |    14 +
 .../files/patch-memory_mozalloc_throw__gcc.h       |    69 +
 .../files/patch-modules_fdlibm_src_math__private.h |    27 +
 .../thunderbird-esr/files/patch-mozglue_misc_SSE.h |    84 +
 mail/thunderbird-esr/files/patch-pipewire_init     |   118 +
 ...patch-python_mozbuild_mozbuild_gn__processor.py |    49 +
 mail/thunderbird-esr/files/patch-rnp-clang19       |   200 +
 ...rd__party_libwebrtc_build_config_BUILDCONFIG.gn |   141 +
 ..._desktop__capture_linux_wayland__egl__dmabuf.cc |    26 +
 ..._party_libwebrtc_third__party_pffft_src_pffft.c |    10 +
 .../files/patch-third__party_sqlite3_src_moz.build |    12 +
 ...toolkit_components_processtools_procinfo__bsd.c |   104 +
 mail/thunderbird-esr/files/thunderbird.desktop.in  |    11 +
 mail/thunderbird-esr/pkg-descr                     |     4 +
 38 files changed, 101187 insertions(+)

diff --git a/mail/Makefile b/mail/Makefile
index 4b3ed4f9aeb2..fc5773b5abf5 100644
--- a/mail/Makefile
+++ b/mail/Makefile
@@ -736,6 +736,7 @@
     SUBDIR += textmail
     SUBDIR += thunderbird
     SUBDIR += thunderbird-dictionaries
+    SUBDIR += thunderbird-esr
     SUBDIR += tlb
     SUBDIR += tmpmail
     SUBDIR += tpop3d
diff --git a/mail/thunderbird-esr/Makefile b/mail/thunderbird-esr/Makefile
new file mode 100644
index 000000000000..e5c016bb169a
--- /dev/null
+++ b/mail/thunderbird-esr/Makefile
@@ -0,0 +1,72 @@
+PORTNAME=	thunderbird
+DISTVERSION=	128.9.0
+CATEGORIES=	mail news net-im wayland
+MASTER_SITES=	MOZILLA/${PORTNAME}/releases/${DISTVERSION}esr/source \
+		MOZILLA/${PORTNAME}/candidates/${DISTVERSION}esr-candidates/build1/source
+PKGNAMESUFFIX=	-esr
+DISTFILES=	${DISTNAME}esr.source${EXTRACT_SUFX}
+
+MAINTAINER=	gecko@FreeBSD.org
+COMMENT=	Mozilla Thunderbird is standalone mail and news that stands above
+WWW=		https://www.mozilla.com/thunderbird/
+
+BUILD_DEPENDS=	nspr>=4.32:devel/nspr \
+		nss>=3.101:security/nss \
+		libevent>=2.1.8:devel/libevent \
+		harfbuzz>=8.5.0:print/harfbuzz \
+		graphite2>=1.3.14:graphics/graphite2 \
+		png>=1.6.43:graphics/png \
+		dav1d>=1.0.0:multimedia/dav1d \
+		libvpx>=1.14.0:multimedia/libvpx \
+		${PYTHON_PKGNAMEPREFIX}sqlite3>0:databases/py-sqlite3@${PY_FLAVOR} \
+		v4l_compat>0:multimedia/v4l_compat \
+		autoconf2.13:devel/autoconf2.13 \
+		nasm:devel/nasm \
+		yasm:devel/yasm \
+		zip:archivers/zip \
+		${LOCALBASE}/share/wasi-sysroot/lib/wasm32-wasi/libc++abi.a:devel/wasi-libcxx${LLVM_VERSION} \
+		${LOCALBASE}/share/wasi-sysroot/lib/wasm32-wasi/libc.a:devel/wasi-libc@${LLVM_VERSION} \
+		wasi-compiler-rt${LLVM_VERSION}>0:devel/wasi-compiler-rt${LLVM_VERSION}
+LIB_DEPENDS=	libjson-c.so:devel/json-c
+
+USE_GECKO=	gecko
+CPE_PRODUCT=	${PORTNAME}_esr
+CONFLICTS_INSTALL=	thunderbird
+# cannot use system icu: calendar is completely broken by
+# https://unicode-org.atlassian.net/browse/ICU-22132 (fix not in 74.1)
+USE_MOZILLA=	-icu -sqlite
+CFLAGS_powerpc64le=	-DSQLITE_BYTEORDER=1234
+
+USES=		tar:xz
+
+MOZ_OPTIONS=	--enable-application=comm/mail --enable-official-branding
+MOZ_OPTIONS+=	--with-system-bz2 --with-system-jsonc
+MOZ_OPTIONS+=	--with-wasi-sysroot=${LOCALBASE}/share/wasi-sysroot
+MOZ_MK_OPTIONS=	MOZ_THUNDERBIRD=1 MAIL_PKG_SHARED=1
+MOZ_EXPORT=		MOZ_THUNDERBIRD=1 MAIL_PKG_SHARED=1
+
+PORTNAME_ICON=	${MOZILLA}.png
+PORTNAME_ICON_SRC=	${PREFIX}/lib/${MOZILLA}/chrome/icons/default/default48.png
+
+SYSTEM_PREFS=	${FAKEDIR}/lib/${PORTNAME}/defaults/pref/${PORTNAME}.js
+
+OPTIONS_DEFAULT=CANBERRA
+
+.include "${.CURDIR}/../../www/firefox/Makefile.options"
+
+post-extract:
+	@${SED} -e 's|@PORTNAME_ICON@|${PORTNAME_ICON:R}|;s|@MOZILLA@|${MOZILLA}|' \
+		<${FILESDIR}/thunderbird.desktop.in >${WRKDIR}/${MOZILLA_EXEC_NAME}.desktop
+
+post-patch:
+	@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
+		${WRKSRC}/comm/mail/app/nsMailApp.cpp
+
+port-pre-install:
+	${MKDIR} ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/defaults
+
+post-install:
+	${INSTALL_DATA} ${WRKDIR}/${MOZILLA_EXEC_NAME}.desktop ${STAGEDIR}${PREFIX}/share/applications
+	${LN} -sf ${PORTNAME_ICON_SRC} ${STAGEDIR}${PREFIX}/share/pixmaps/${PORTNAME_ICON}
+
+.include <bsd.port.mk>
diff --git a/mail/thunderbird-esr/distinfo b/mail/thunderbird-esr/distinfo
new file mode 100644
index 000000000000..7e1af6780a2d
--- /dev/null
+++ b/mail/thunderbird-esr/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1742857279
+SHA256 (thunderbird-128.9.0esr.source.tar.xz) = 735579c7fd7018ef16ad3b28ba3f254d957da33435b3b1af945d95fd20f9407b
+SIZE (thunderbird-128.9.0esr.source.tar.xz) = 676939592
diff --git a/mail/thunderbird-esr/files/patch-addon-search b/mail/thunderbird-esr/files/patch-addon-search
new file mode 100644
index 000000000000..f7d58e3d385a
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-addon-search
@@ -0,0 +1,29 @@
+https://github.com/mozilla/addons/issues/708
+https://github.com/mozilla/addons-frontend/issues/4610
+
+diff --git toolkit/mozapps/extensions/internal/AddonRepository.sys.mjs toolkit/mozapps/extensions/internal/AddonRepository.sys.mjs
+index 8d4d178924..500eaef103 100644
+--- toolkit/mozapps/extensions/internal/AddonRepository.sys.mjs
++++ toolkit/mozapps/extensions/internal/AddonRepository.sys.mjs
+@@ -715,7 +715,7 @@ export var AddonRepository = {
+       addon.version = String(aEntry.current_version.version);
+       if (Array.isArray(aEntry.current_version.files)) {
+         for (let file of aEntry.current_version.files) {
+-          if (file.platform == "all" || file.platform == lazy.PLATFORM) {
++          if (file.platform == "all" || file.platform == "linux" || file.platform == lazy.PLATFORM) {
+             if (file.url) {
+               addon.sourceURI = lazy.NetUtil.newURI(file.url);
+             }
+diff --git toolkit/mozapps/extensions/internal/XPIDatabase.sys.mjs toolkit/mozapps/extensions/internal/XPIDatabase.sys.mjs
+index 0b81770b94..19669951dc 100644
+--- toolkit/mozapps/extensions/internal/XPIDatabase.sys.mjs
++++ toolkit/mozapps/extensions/internal/XPIDatabase.sys.mjs
+@@ -635,7 +635,7 @@ export class AddonInternal {
+     // Something is causing errors in here
+     try {
+       for (let platform of this.targetPlatforms) {
+-        if (platform.os == Services.appinfo.OS) {
++        if (platform.os == "Linux" || platform.os == Services.appinfo.OS) {
+           if (platform.abi) {
+             needsABI = true;
+             if (platform.abi === abi) {
diff --git a/mail/thunderbird-esr/files/patch-browser-app-nsBrowserApp.cpp b/mail/thunderbird-esr/files/patch-browser-app-nsBrowserApp.cpp
new file mode 100644
index 000000000000..e2d004413358
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-browser-app-nsBrowserApp.cpp
@@ -0,0 +1,14 @@
+diff --git browser/app/nsBrowserApp.cpp browser/app/nsBrowserApp.cpp
+index e1f11b9cfd..a15b129402 100644
+--- browser/app/nsBrowserApp.cpp
++++ browser/app/nsBrowserApp.cpp
+@@ -341,6 +341,9 @@ int main(int argc, char* argv[], char* envp[]) {
+     }
+ #  endif
+ 
++    setenv("MOZ_GMP_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
++    setenv("MOZ_PLUGIN_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
++
+ #  ifdef HAS_DLL_BLOCKLIST
+     uint32_t initFlags =
+         gBlocklistInitFlags | eDllBlocklistInitFlagIsChildProcess;
diff --git a/mail/thunderbird-esr/files/patch-bug1269654_comment5 b/mail/thunderbird-esr/files/patch-bug1269654_comment5
new file mode 100644
index 000000000000..0aa2d639d352
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-bug1269654_comment5
@@ -0,0 +1,43 @@
+https://bugzilla.mozilla.org/show_bug.cgi?id=1269654#c5
+https://bug1269654.bmoattachments.org/attachment.cgi?id=8749234
+handle big-endian formats in Cairo format conversions
+
+# HG changeset patch
+# User Lee Salzman <lsalzman@mozilla.com>
+# Date 1462463631 14400
+#      Thu May 05 11:53:51 2016 -0400
+# Node ID 8da374804a09977c8f89af5e6e0cb37cb074595d
+# Parent  29662e28a9c93ac67ee0b8ddfb65a9f29bbf73f5
+handle big-endian formats in Cairo format conversions
+
+--- gfx/2d/HelpersCairo.h.orig	2019-12-02 17:51:16.633474000 +0100
++++ gfx/2d/HelpersCairo.h	2019-12-02 17:52:44.939998000 +0100
+@@ -147,7 +147,14 @@ static inline cairo_format_t GfxFormatToCairoFormat(Su
+     case SurfaceFormat::R5G6B5_UINT16:
+       return CAIRO_FORMAT_RGB16_565;
+     default:
+-      gfxCriticalError() << "Unknown image format " << (int)format;
++      // _UINT32 formats don't match B8G8R8[AX]8 on big-endian platforms,
++      // and Moz2d uses B8G8R8[AX]8 as if it was _UINT32.
++      // See bug 1269654
++      if (format == SurfaceFormat::B8G8R8X8) {
++        return CAIRO_FORMAT_RGB24;
++      } else if (format != SurfaceFormat::B8G8R8A8) {
++        gfxCriticalError() << "Unknown image format " << (int)format;
++      }
+       return CAIRO_FORMAT_ARGB32;
+   }
+ }
+@@ -177,7 +184,11 @@ static inline cairo_content_t GfxFormatToCairoContent(
+     case SurfaceFormat::A8:
+       return CAIRO_CONTENT_ALPHA;
+     default:
+-      gfxCriticalError() << "Unknown image content format " << (int)format;
++      if (format == SurfaceFormat::B8G8R8X8) {
++        return CAIRO_CONTENT_COLOR;
++      } else if (format != SurfaceFormat::B8G8R8A8) {
++        gfxCriticalError() << "Unknown image content format " << (int)format;
++      }
+       return CAIRO_CONTENT_COLOR_ALPHA;
+   }
+ }
diff --git a/mail/thunderbird-esr/files/patch-bug1504834_comment10 b/mail/thunderbird-esr/files/patch-bug1504834_comment10
new file mode 100644
index 000000000000..2d584adb17ef
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-bug1504834_comment10
@@ -0,0 +1,36 @@
+https://bugzilla.mozilla.org/show_bug.cgi?id=1504834#c10
+https://bug1504834.bmoattachments.org/attachment.cgi?id=9111147
+mozilla-bmo1504834-part4.patch
+
+# HG changeset patch
+# Parent  46ea866ca3acb8bb5e1709ceb799b9c94f591dec
+Problem description: Tab-titles that are too long to fit into a tab get faded out.
+                     On big endian this is broken and instead of fading out, the 
+                     tab gets white and the font transparent, leading to an unreadable
+                     tab-title
+Solution: This is not a real solution, but a hack. The real solution would have been
+          to byte-swap the correct buffer, but I could not find it.
+          So the next best thing is to deactivate the fading-effect. Now all tab-titles
+          are readable, albeit not as pretty to look at as they could be. 
+Side-effects: I have not yet found an unwanted side-effect.
+
+diff --git gfx/2d/DrawTargetSkia.cpp gfx/2d/DrawTargetSkia.cpp
+index 6bbef8d..161b96f 100644
+--- gfx/2d/DrawTargetSkia.cpp
++++ gfx/2d/DrawTargetSkia.cpp
+@@ -1903,6 +1903,14 @@ void DrawTargetSkia::PushLayerWithBlend(bool aOpaque, Float aOpacity,
+       SkCanvas::kPreserveLCDText_SaveLayerFlag |
+           (aCopyBackground ? SkCanvas::kInitWithPrevious_SaveLayerFlag : 0));
+ 
++#if MOZ_BIG_ENDIAN()
++  // Pushing a layer where an aMask is defined produces wrong output.
++  // We _should_ endian swap the data, but I couldn't find a workable way to do so
++  // Therefore I deactivate those layers in the meantime.
++  // The result is: Tab-titles that are longer than the available space should be faded out.
++  //                The fading doesn't work, so we deactivate the fading-effect here.
++  if (!aMask)
++#endif
+   mCanvas->saveLayer(saveRec);
+ 
+   SetPermitSubpixelAA(aOpaque);
+
diff --git a/mail/thunderbird-esr/files/patch-bug1504834_comment5 b/mail/thunderbird-esr/files/patch-bug1504834_comment5
new file mode 100644
index 000000000000..b9897e0b7f66
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-bug1504834_comment5
@@ -0,0 +1,83 @@
+https://bugzilla.mozilla.org/show_bug.cgi?id=1504834#c5
+https://bugzilla.mozilla.org/attachment.cgi?id=9028600
+Rough progress patch
+
+
+diff --git gfx/2d/DrawTargetSkia.cpp gfx/2d/DrawTargetSkia.cpp
+index 6bbef8d..82b04ba 100644
+--- gfx/2d/DrawTargetSkia.cpp
++++ gfx/2d/DrawTargetSkia.cpp
+@@ -154,8 +154,7 @@ static IntRect CalculateSurfaceBounds(const IntSize& aSize, const Rect* aBounds,
+   return surfaceBounds.Intersect(bounds);
+ }
+ 
+-static const int kARGBAlphaOffset =
+-    SurfaceFormat::A8R8G8B8_UINT32 == SurfaceFormat::B8G8R8A8 ? 3 : 0;
++static const int kARGBAlphaOffset = 0;
+ 
+ static bool VerifyRGBXFormat(uint8_t* aData, const IntSize& aSize,
+                              const int32_t aStride, SurfaceFormat aFormat) {
+diff --git gfx/2d/Types.h gfx/2d/Types.h
+index 6b3bdc7..7c6c342 100644
+--- gfx/2d/Types.h
++++ gfx/2d/Types.h
+@@ -90,15 +90,8 @@ enum class SurfaceFormat : int8_t {
+ // The following values are endian-independent synonyms. The _UINT32 suffix
+ // indicates that the name reflects the layout when viewed as a uint32_t
+ // value.
+-#if MOZ_LITTLE_ENDIAN()
+   A8R8G8B8_UINT32 = B8G8R8A8,  // 0xAARRGGBB
+   X8R8G8B8_UINT32 = B8G8R8X8,  // 0x00RRGGBB
+-#elif MOZ_BIG_ENDIAN()
+-  A8R8G8B8_UINT32 = A8R8G8B8,  // 0xAARRGGBB
+-  X8R8G8B8_UINT32 = X8R8G8B8,  // 0x00RRGGBB
+-#else
+-#  error "bad endianness"
+-#endif
+ 
+   // The following values are OS and endian-independent synonyms.
+   //
+--- gfx/skia/skia/modules/skcms/skcms.cc.orig
++++ gfx/skia/skia/modules/skcms/skcms.cc
+@@ -30,6 +30,8 @@
+         #include <avx512fintrin.h>
+         #include <avx512dqintrin.h>
+     #endif
++#else
++    #define SKCMS_PORTABLE
+ #endif
+ 
+ static bool runtime_cpu_detection = true;
+@@ -324,20 +326,28 @@
+ static uint16_t read_big_u16(const uint8_t* ptr) {
+     uint16_t be;
+     memcpy(&be, ptr, sizeof(be));
+-#if defined(_MSC_VER)
+-    return _byteswap_ushort(be);
++#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
++    return be;
+ #else
++    #if defined(_MSC_VER)
++    return _byteswap_ushort(be);
++    #else
+     return __builtin_bswap16(be);
++    #endif
+ #endif
+ }
+ 
+ static uint32_t read_big_u32(const uint8_t* ptr) {
+     uint32_t be;
+     memcpy(&be, ptr, sizeof(be));
+-#if defined(_MSC_VER)
+-    return _byteswap_ulong(be);
++#if __BYTE_ORDER == __ORDER_BIG_ENDIAN__
++    return be;
+ #else
++    #if defined(_MSC_VER)
++    return _byteswap_ulong(be);
++    #else
+     return __builtin_bswap32(be);
++    #endif
+ #endif
+ }
+ 
diff --git a/mail/thunderbird-esr/files/patch-bug1559213 b/mail/thunderbird-esr/files/patch-bug1559213
new file mode 100644
index 000000000000..ead3425fa70b
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-bug1559213
@@ -0,0 +1,131 @@
+commit 25a5572d5cd137aa6d893e09a00bd39908a59a18
+Author: Christoph Moench-Tegeder <cmt@burggraben.net>
+Date:   Tue Sep 10 22:23:32 2024 +0200
+
+    based on:
+     commit 717bba28411c
+     Author: Jory A. Pratt <anarchy@gentoo.org>
+     Date:   Thu Jun 13 11:53:00 2019 -0700
+    
+         Bug 1559213 - Allow to use system av1 libs instead of bundled.
+
+diff --git config/external/moz.build config/external/moz.build
+index a24b470396cf..547f5f5c9e04 100644
+--- config/external/moz.build
++++ config/external/moz.build
+@@ -40,8 +40,9 @@ if not CONFIG["MOZ_SYSTEM_LIBVPX"]:
+     external_dirs += ["media/libvpx"]
+ 
+ if CONFIG["MOZ_AV1"]:
+-    external_dirs += ["media/libaom"]
+-    external_dirs += ["media/libdav1d"]
++    if not CONFIG["MOZ_SYSTEM_AV1"]:
++        external_dirs += ["media/libaom"]
++        external_dirs += ["media/libdav1d"]
+ 
+ if not CONFIG["MOZ_SYSTEM_PNG"]:
+     external_dirs += ["media/libpng"]
+diff --git dom/media/platforms/moz.build dom/media/platforms/moz.build
+index 61536cc6e225..29cf635bbb44 100644
+--- dom/media/platforms/moz.build
++++ dom/media/platforms/moz.build
+@@ -71,6 +71,11 @@ if CONFIG["MOZ_AV1"]:
+         "agnostic/AOMDecoder.cpp",
+         "agnostic/DAV1DDecoder.cpp",
+     ]
++    if CONFIG['MOZ_SYSTEM_AV1']:
++        CXXFLAGS += CONFIG['MOZ_SYSTEM_LIBAOM_CFLAGS']
++        OS_LIBS += CONFIG['MOZ_SYSTEM_LIBAOM_LIBS']
++        CXXFLAGS += CONFIG['MOZ_SYSTEM_LIBDAV1D_CFLAGS']
++        OS_LIBS += CONFIG['MOZ_SYSTEM_LIBDAV1D_LIBS']
+ 
+ if CONFIG["MOZ_OMX"]:
+     EXPORTS += [
+diff --git media/ffvpx/libavcodec/moz.build media/ffvpx/libavcodec/moz.build
+index 6f09049a6068..90a82a19a9d1 100644
+--- media/ffvpx/libavcodec/moz.build
++++ media/ffvpx/libavcodec/moz.build
+@@ -119,10 +119,16 @@ if not CONFIG['MOZ_FFVPX_AUDIOONLY']:
+         'vp9recon.c',
+         'vpx_rac.c',
+     ]
+-    USE_LIBS += [
+-        'dav1d',
+-        'media_libdav1d_asm',
+-    ]
++    if CONFIG["MOZ_SYSTEM_AV1"]:
++        CFLAGS += CONFIG['MOZ_SYSTEM_LIBDAV1D_CFLAGS']
++        OS_LIBS += CONFIG['MOZ_SYSTEM_LIBDAV1D_LIBS']
++        CFLAGS += CONFIG['MOZ_SYSTEM_LIBAOM_CFLAGS']
++        OS_LIBS += CONFIG['MOZ_SYSTEM_LIBAOM_LIBS']
++    else:
++        USE_LIBS += [
++            'dav1d',
++            'media_libdav1d_asm',
++        ]
+     if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
+         LOCAL_INCLUDES += ['/media/mozva']
+         SOURCES += [
+diff --git media/libopus/moz.build media/libopus/moz.build
+index 943aee79ee99..4ad07e3e98af 100644
+--- media/libopus/moz.build
++++ media/libopus/moz.build
+@@ -58,7 +58,7 @@ if not CONFIG["MOZ_SAMPLE_TYPE_FLOAT32"]:
+     DEFINES["FIXED_POINT"] = 1
+     DEFINES["DISABLE_FLOAT_API"] = True
+ 
+-if CONFIG["OS_ARCH"] == "Linux":
++if CONFIG["OS_ARCH"] in ("FreeBSD", "Linux"):
+     OS_LIBS += [
+         "m",
+     ]
+diff --git media/libvorbis/moz.build media/libvorbis/moz.build
+index cd17d4f89759..816edd72a000 100644
+--- media/libvorbis/moz.build
++++ media/libvorbis/moz.build
+@@ -45,7 +45,7 @@ LOCAL_INCLUDES += ['lib']
+ if CONFIG['OS_ARCH'] == 'SunOS':
+     DEFINES['HAVE_ALLOCA_H'] = True
+ 
+-if CONFIG["OS_ARCH"] == "Linux":
++if CONFIG["OS_ARCH"] in ("FreeBSD", "Linux"):
+     OS_LIBS += [
+         "m",
+     ]
+diff --git toolkit/moz.configure toolkit/moz.configure
+index 1f85d2831f2f..07294b93f850 100644
+--- toolkit/moz.configure
++++ toolkit/moz.configure
+@@ -883,7 +883,23 @@ def av1(value):
+         return True
+ 
+ 
+-@depends(target, when=av1 & compile_environment)
++option("--with-system-av1",
++       help="Use system av1 (located with pkgconfig)")
++
++system_libaom_info = pkg_check_modules("MOZ_SYSTEM_LIBAOM", "aom >= 1.0.0",
++                                       when="--with-system-av1")
++
++system_libdav1d_info = pkg_check_modules("MOZ_SYSTEM_LIBDAV1D", "dav1d >= 0.1.1",
++                                         when="--with-system-av1")
++
++@depends(system_libaom_info, system_libdav1d_info)
++def system_av1(system_libaom_info, system_libdav1d_info):
++    has_av1_libs = False
++    if system_libaom_info and system_libdav1d_info:
++        has_av1_libs = True
++    return has_av1_libs
++
++@depends(target, when=av1 & depends(system_av1)(lambda v: not v) & compile_environment)
+ def dav1d_asm(target):
+     if target.cpu in ("aarch64", "x86", "x86_64"):
+         return True
+@@ -899,6 +915,7 @@ set_config("MOZ_DAV1D_ASM", dav1d_asm)
+ set_define("MOZ_DAV1D_ASM", dav1d_asm)
+ set_config("MOZ_AV1", av1)
+ set_define("MOZ_AV1", av1)
++set_config("MOZ_SYSTEM_AV1", depends_if(system_av1)(lambda _: True))
+ 
+ # JXL Image Codec Support
+ # ==============================================================
diff --git a/mail/thunderbird-esr/files/patch-bug1612181_comment1 b/mail/thunderbird-esr/files/patch-bug1612181_comment1
new file mode 100644
index 000000000000..a54b906eebb6
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-bug1612181_comment1
@@ -0,0 +1,191 @@
+https://bugzilla.mozilla.org/show_bug.cgi?id=1612181
+https://bug1612181.bmoattachments.org/attachment.cgi?id=9123550
+
+
+--- xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ppc64_linux.S.orig	2020-01-29 19:25:30.967574000 +0100
++++ xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ppc64_linux.S	2020-01-29 19:26:50.465737000 +0100
+@@ -62,11 +62,11 @@ NS_InvokeByIndex:
+ .NS_InvokeByIndex:
+ #endif
+         mflr    0
+-        std     0,16(r1)
++        std     0,16(%r1)
+ 
+-        std     r29,-24(r1)
+-        std     r30,-16(r1)
+-        std     r31,-8(r1)
++        std     r29,-24(%r1)
++        std     r30,-16(%r1)
++        std     r31,-8(%r1)
+ 
+         mr      r29,r3                  # Save 'that' in r29
+         mr      r30,r4                  # Save 'methodIndex' in r30
+@@ -79,7 +79,7 @@ NS_InvokeByIndex:
+         #
+         #  | (fixed area + |                | 7 GP | 13 FP | 3 NV |
+         #  |  param. save) |(params)........| regs | regs  | regs |
+-        # (r1)......(+STACK_PARAMS)...  (-23*8).(-16*8).(-3*8)..(r31)
++        # (%r1)......(+STACK_PARAMS)...  (-23*8).(-16*8).(-3*8)..(%r31)
+ 
+         # +stack frame, -unused stack params, +regs storage, +1 for alignment
+         addi    r7,r5,((STACK_PARAMS/8)-7+7+13+3+1)
+@@ -105,56 +105,56 @@ NS_InvokeByIndex:
+ 
+         # Set up to invoke function
+ 
+-        ld      r9,0(r29)               # vtable (r29 is 'that')
++        ld      r9,0(%r29)               # vtable (%r29 is 'that')
+         mr      r3,r29                  # self is first arg, obviously
+ 
+         sldi    r30,r30,3               # Find function descriptor 
+         add     r9,r9,r30
+-        ld      r12,0(r9)
++        ld      r12,0(%r9)
+ 
+-        std     r2,STACK_TOC(r1)        # Save r2 (TOC pointer)
++        std     r2,STACK_TOC(%r1)        # Save r2 (TOC pointer)
+ 
+ #if _CALL_ELF == 2
+         mtctr   r12
+ #else
+-        ld      r0,0(r12)               # Actual address from fd.
++        ld      r0,0(%r12)               # Actual address from fd.
+         mtctr   0
+-        ld      r11,16(r12)             # Environment pointer from fd.
+-        ld      r2,8(r12)               # TOC pointer from fd.
++        ld      r11,16(%r12)             # Environment pointer from fd.
++        ld      r2,8(%r12)               # TOC pointer from fd.
+ #endif
+ 
+         # Load FP and GP registers as required
+-        ld      r4, -(23*8)(r31) 
+-        ld      r5, -(22*8)(r31) 
+-        ld      r6, -(21*8)(r31) 
+-        ld      r7, -(20*8)(r31) 
+-        ld      r8, -(19*8)(r31) 
+-        ld      r9, -(18*8)(r31) 
+-        ld      r10, -(17*8)(r31) 
++        ld      r4, -(23*8)(%r31) 
++        ld      r5, -(22*8)(%r31) 
++        ld      r6, -(21*8)(%r31) 
++        ld      r7, -(20*8)(%r31) 
++        ld      r8, -(19*8)(%r31) 
++        ld      r9, -(18*8)(%r31) 
++        ld      r10, -(17*8)(%r31) 
+ 
+-        lfd     f1, -(16*8)(r31)
+-        lfd     f2, -(15*8)(r31)
+-        lfd     f3, -(14*8)(r31)
+-        lfd     f4, -(13*8)(r31)
+-        lfd     f5, -(12*8)(r31)
+-        lfd     f6, -(11*8)(r31)
+-        lfd     f7, -(10*8)(r31)
+-        lfd     f8, -(9*8)(r31)
+-        lfd     f9, -(8*8)(r31)
+-        lfd     f10, -(7*8)(r31)
+-        lfd     f11, -(6*8)(r31)
+-        lfd     f12, -(5*8)(r31)
+-        lfd     f13, -(4*8)(r31)
++        lfd     f1, -(16*8)(%r31)
++        lfd     f2, -(15*8)(%r31)
++        lfd     f3, -(14*8)(%r31)
++        lfd     f4, -(13*8)(%r31)
++        lfd     f5, -(12*8)(%r31)
++        lfd     f6, -(11*8)(%r31)
++        lfd     f7, -(10*8)(%r31)
++        lfd     f8, -(9*8)(%r31)
++        lfd     f9, -(8*8)(%r31)
++        lfd     f10, -(7*8)(%r31)
++        lfd     f11, -(6*8)(%r31)
++        lfd     f12, -(5*8)(%r31)
++        lfd     f13, -(4*8)(%r31)
+ 
+         bctrl                           # Do it
+ 
+-        ld      r2,STACK_TOC(r1)        # Load our own TOC pointer
+-        ld      r1,0(r1)                # Revert stack frame
+-        ld      0,16(r1)                # Reload lr
++        ld      r2,STACK_TOC(%r1)        # Load our own TOC pointer
++        ld      r1,0(%r1)                # Revert stack frame
++        ld      0,16(%r1)                # Reload lr
+         mtlr    0
+-        ld      29,-24(r1)              # Restore NVGPRS
+-        ld      30,-16(r1)
+-        ld      31,-8(r1)
++        ld      29,-24(%r1)              # Restore NVGPRS
++        ld      30,-16(%r1)
++        ld      31,-8(%r1)
+         blr
+ 
+ #if _CALL_ELF == 2
+--- xpcom/reflect/xptcall/md/unix/xptcstubs_asm_ppc64_linux.S.orig	2020-01-29 19:25:51.465953000 +0100
++++ xpcom/reflect/xptcall/md/unix/xptcstubs_asm_ppc64_linux.S	2020-01-29 19:28:53.055137000 +0100
+@@ -58,35 +58,35 @@ SharedStub:
+ #endif
+         mflr    r0
+ 
+-        std     r4, -56(r1)                     # Save all GPRS
+-        std     r5, -48(r1)
+-        std     r6, -40(r1)
+-        std     r7, -32(r1)
+-        std     r8, -24(r1)
+-        std     r9, -16(r1)
+-        std     r10, -8(r1)
++        std     r4, -56(%r1)                     # Save all GPRS
++        std     r5, -48(%r1)
++        std     r6, -40(%r1)
++        std     r7, -32(%r1)
++        std     r8, -24(%r1)
++        std     r9, -16(%r1)
++        std     r10, -8(%r1)
+ 
+-        stfd    f13, -64(r1)                    # ... and FPRS
+-        stfd    f12, -72(r1)
+-        stfd    f11, -80(r1)
+-        stfd    f10, -88(r1)
+-        stfd    f9, -96(r1)
+-        stfd    f8, -104(r1)
+-        stfd    f7, -112(r1)
+-        stfd    f6, -120(r1)
+-        stfd    f5, -128(r1)
+-        stfd    f4, -136(r1)
+-        stfd    f3, -144(r1)
+-        stfd    f2, -152(r1)
+-        stfd    f1, -160(r1)
++        stfd    f13, -64(%r1)                    # ... and FPRS
++        stfd    f12, -72(%r1)
++        stfd    f11, -80(%r1)
++        stfd    f10, -88(%r1)
++        stfd    f9, -96(%r1)
++        stfd    f8, -104(%r1)
++        stfd    f7, -112(%r1)
++        stfd    f6, -120(%r1)
++        stfd    f5, -128(%r1)
++        stfd    f4, -136(%r1)
++        stfd    f3, -144(%r1)
++        stfd    f2, -152(%r1)
++        stfd    f1, -160(%r1)
+ 
+         subi    r6,r1,56                        # r6 --> gprData
+         subi    r7,r1,160                       # r7 --> fprData
+         addi    r5,r1,STACK_PARAMS              # r5 --> extra stack args
+ 
+-        std     r0, 16(r1)
++        std     r0, 16(%r1)
+ 	
+-        stdu    r1,-288(r1)
++        stdu    r1,-288(%r1)
+                                                 # r3 has the 'self' pointer
+                                                 # already
+ 
+@@ -97,8 +97,8 @@ SharedStub:
+         bl      PrepareAndDispatch
+         nop
+ 
+-        ld      1,0(r1)                         # restore stack
+-        ld      r0,16(r1)                       # restore LR
++        ld      1,0(%r1)                         # restore stack
++        ld      r0,16(%r1)                       # restore LR
+         mtlr    r0
+         blr
+ 
diff --git a/mail/thunderbird-esr/files/patch-bug1626236 b/mail/thunderbird-esr/files/patch-bug1626236
new file mode 100644
index 000000000000..ccb417b61f15
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-bug1626236
@@ -0,0 +1,88 @@
+https://bugzilla.mozilla.org/show_bug.cgi?id=1626236
+https://bug1626236.bmoattachments.org/attachment.cgi?id=9137096
+
+# HG changeset patch
+# User msirringhaus@suse.de
+# Date 1582805876 -3600
+#      Thu Feb 27 13:17:56 2020 +0100
+# Node ID cc3d09abea31068e57f1ab918782f9f86fc6a158
+# Parent  9cd90914846f667f18babc491a74c164ae5d6e9f
+imported patch decoder_workaround.patch
+
+diff -r 9cd90914846f image/decoders/nsGIFDecoder2.cpp
+--- image/decoders/nsGIFDecoder2.cpp	Thu Feb 27 12:57:14 2020 +0100
++++ image/decoders/nsGIFDecoder2.cpp	Fri Mar 27 13:06:18 2020 +0100
+@@ -422,6 +422,9 @@
+   MOZ_ASSERT(mSwizzleFn);
+   uint8_t* data = reinterpret_cast<uint8_t*>(aColormap);
+   mSwizzleFn(data, data, aColors);
++#if MOZ_BIG_ENDIAN()
++  SwizzleRow(SurfaceFormat::A8R8G8B8, SurfaceFormat::B8G8R8A8)(data, data, aColors);
++#endif
+ }
+ 
+ LexerResult nsGIFDecoder2::DoDecode(SourceBufferIterator& aIterator,
+diff -r 9cd90914846f image/decoders/nsJPEGDecoder.cpp
+--- image/decoders/nsJPEGDecoder.cpp	Thu Feb 27 12:57:14 2020 +0100
++++ image/decoders/nsJPEGDecoder.cpp	Fri Mar 27 13:06:18 2020 +0100
+@@ -263,6 +263,9 @@
+         case JCS_YCbCr:
+           // By default, we will output directly to BGRA. If we need to apply
+           // special color transforms, this may change.
++#if MOZ_BIG_ENDIAN()
++          mInfo.out_color_space = MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB;
++#else
+           switch (SurfaceFormat::OS_RGBX) {
+             case SurfaceFormat::B8G8R8X8:
+               mInfo.out_color_space = JCS_EXT_BGRX;
+@@ -277,6 +280,7 @@
+               mState = JPEG_ERROR;
+               return Transition::TerminateFailure();
+           }
++#endif
+           break;
+         case JCS_CMYK:
+         case JCS_YCCK:
+diff -r 9cd90914846f image/decoders/nsPNGDecoder.cpp
+--- image/decoders/nsPNGDecoder.cpp	Thu Feb 27 12:57:14 2020 +0100
++++ image/decoders/nsPNGDecoder.cpp	Fri Mar 27 13:06:18 2020 +0100
+@@ -361,7 +361,7 @@
+                                    IResumable* aOnResume) {
+   MOZ_ASSERT(!HasError(), "Shouldn't call DoDecode after error!");
+ 
+-  return mLexer.Lex(aIterator, aOnResume,
++  LexerResult res = mLexer.Lex(aIterator, aOnResume,
+                     [=](State aState, const char* aData, size_t aLength) {
+                       switch (aState) {
+                         case State::PNG_DATA:
+@@ -371,6 +371,14 @@
+                       }
+                       MOZ_CRASH("Unknown State");
+                     });
++
++#if MOZ_BIG_ENDIAN()
++  if(res.is<TerminalState>() && res.as<TerminalState>() == TerminalState::SUCCESS) {
++      NativeEndian::swapToLittleEndianInPlace<uint32_t>((uint32_t*)(mImageData), mImageDataLength / 4);
++  }
++#endif
++
++  return res;
+ }
+ 
+ LexerTransition<nsPNGDecoder::State> nsPNGDecoder::ReadPNGData(
+diff -r 9cd90914846f image/decoders/nsWebPDecoder.cpp
+--- image/decoders/nsWebPDecoder.cpp	Thu Feb 27 12:57:14 2020 +0100
++++ image/decoders/nsWebPDecoder.cpp	Fri Mar 27 13:06:18 2020 +0100
+@@ -237,7 +237,12 @@
+   // WebP doesn't guarantee that the alpha generated matches the hint in the
+   // header, so we always need to claim the input is BGRA. If the output is
+   // BGRX, swizzling will mask off the alpha channel.
++#if MOZ_BIG_ENDIAN()
++  mBuffer.colorspace = MODE_ARGB;
++  SurfaceFormat inFormat = mFormat;
++#else
+   SurfaceFormat inFormat = SurfaceFormat::OS_RGBA;
++#endif
+ 
+   SurfacePipeFlags pipeFlags = SurfacePipeFlags();
+   if (mFormat == SurfaceFormat::OS_RGBA &&
diff --git a/mail/thunderbird-esr/files/patch-bug1659612 b/mail/thunderbird-esr/files/patch-bug1659612
new file mode 100644
index 000000000000..a7aea97734a0
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-bug1659612
@@ -0,0 +1,41 @@
+media/libcubeb/src/cubeb_alsa.c:613:9: error: implicitly declaring library function 'snprintf' with type 'int (char *, unsigned int, const char *, ...)' [-Werror,-Wimplicit-function-declaration]
+    r = snprintf(node_name, sizeof(node_name), "pcm.%s", string);
+        ^
+media/libcubeb/src/cubeb_alsa.c:613:9: note: include the header <stdio.h> or explicitly provide a declaration for 'snprintf'
+media/libcubeb/src/cubeb_alsa.c:1168:3: error: implicitly declaring library function 'alloca' with type 'void *(unsigned int)' [-Werror,-Wimplicit-function-declaration]
+  snd_pcm_hw_params_alloca(&hw_params);
+  ^
+/usr/local/include/alsa/pcm.h:737:39: note: expanded from macro 'snd_pcm_hw_params_alloca'
+#define snd_pcm_hw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_hw_params)
+                                      ^
+/usr/local/include/alsa/global.h:106:57: note: expanded from macro '__snd_alloca'
+#define __snd_alloca(ptr,type) do { *ptr = (type##_t *) alloca(type##_sizeof()); memset(*ptr, 0, type##_sizeof()); } while (0)
+                                                        ^
+media/libcubeb/src/cubeb_alsa.c:1168:3: note: include the header <stdlib.h> or explicitly provide a declaration for 'alloca'
+/usr/local/include/alsa/pcm.h:737:39: note: expanded from macro 'snd_pcm_hw_params_alloca'
+#define snd_pcm_hw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_hw_params)
+                                      ^
+/usr/local/include/alsa/global.h:106:57: note: expanded from macro '__snd_alloca'
+#define __snd_alloca(ptr,type) do { *ptr = (type##_t *) alloca(type##_sizeof()); memset(*ptr, 0, type##_sizeof()); } while (0)
+                                                        ^
+2 errors generated.
+
+--- media/libcubeb/src/cubeb_alsa.c.orig	2023-03-29 20:51:00.139281000 +0200
++++ media/libcubeb/src/cubeb_alsa.c	2023-03-29 20:51:46.219013000 +0200
+@@ -5,12 +5,16 @@
+  * accompanying file LICENSE for details.
+  */
+ #undef NDEBUG
++#if defined(__FreeBSD__)
++#define _GNU_SOURCE
++#else
+ #define _DEFAULT_SOURCE
+ #define _BSD_SOURCE
+ #if defined(__NetBSD__)
+ #define _NETBSD_SOURCE /* timersub() */
+ #endif
+ #define _XOPEN_SOURCE 500
++#endif
+ #include "cubeb-internal.h"
+ #include "cubeb/cubeb.h"
+ #include "cubeb_tracing.h"
diff --git a/mail/thunderbird-esr/files/patch-bug1716707 b/mail/thunderbird-esr/files/patch-bug1716707
new file mode 100644
index 000000000000..33ff73450b73
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-bug1716707
@@ -0,0 +1,56 @@
+commit ce7a2f400d4f599c72e32e2635fee7ea94c0848c
+Author: Christoph Moench-Tegeder <cmt@burggraben.net>
+Date:   Wed Apr 13 14:44:46 2022 +0200
+
+    big-endian color fixes, but without breaking little-endian
+    
+    as le is what most people actually use
+
+diff --git gfx/webrender_bindings/RenderCompositorSWGL.cpp gfx/webrender_bindings/RenderCompositorSWGL.cpp
+index dbf137c849ee..243a01ff9cf3 100644
+--- gfx/webrender_bindings/RenderCompositorSWGL.cpp
++++ gfx/webrender_bindings/RenderCompositorSWGL.cpp
+@@ -7,6 +7,7 @@
+ #include "RenderCompositorSWGL.h"
+ 
+ #include "mozilla/gfx/Logging.h"
++#include "mozilla/gfx/Swizzle.h"
+ #include "mozilla/widget/CompositorWidget.h"
+ 
+ #ifdef MOZ_WIDGET_GTK
+@@ -235,6 +236,13 @@ void RenderCompositorSWGL::CommitMappedBuffer(bool aDirty) {
+   }
+   mDT->Flush();
+ 
++#if MOZ_BIG_ENDIAN()
++  // One swizzle to rule them all.
++  gfx::SwizzleData(mMappedData, mMappedStride, gfx::SurfaceFormat::B8G8R8A8,
++                   mMappedData, mMappedStride, gfx::SurfaceFormat::A8R8G8B8,
++                   mDT->GetSize());
++#endif
++
+   // Done with the DT. Hand it back to the widget and clear out any trace of it.
+   mWidget->EndRemoteDrawingInRegion(mDT, mDirtyRegion);
+   mDirtyRegion.SetEmpty();
+diff --git image/imgFrame.cpp image/imgFrame.cpp
+index e58c3dd5b2d4..c1e7e77c362b 100644
+--- image/imgFrame.cpp
++++ image/imgFrame.cpp
+@@ -372,6 +372,17 @@ nsresult imgFrame::InitWithDrawable(gfxDrawable* aDrawable,
+     return NS_ERROR_OUT_OF_MEMORY;
+   }
+ 
++#if MOZ_BIG_ENDIAN()
++  if (aBackend == gfx::BackendType::SKIA && canUseDataSurface) {
++    // SKIA is lying about what format it returns on big endian
++    for (int ii=0; ii < mRawSurface->GetSize().Height()*mRawSurface->Stride() / 4; ++ii) {
++      uint32_t *vals = (uint32_t*)(mRawSurface->GetData());
++      uint32_t val = ((vals[ii] << 8) & 0xFF00FF00 ) | ((vals[ii] >> 8) & 0xFF00FF );
++      vals[ii] = (val << 16) | (val >> 16);
++    }
++  }
++#endif
++
+   if (!canUseDataSurface) {
+     // We used an offscreen surface, which is an "optimized" surface from
+     // imgFrame's perspective.
diff --git a/mail/thunderbird-esr/files/patch-bug1874059 b/mail/thunderbird-esr/files/patch-bug1874059
new file mode 100644
index 000000000000..3fa954ef9def
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-bug1874059
@@ -0,0 +1,25 @@
+commit 56c888446600991803fd92d668349101ad4bf160
+Author: Christoph Moench-Tegeder <cmt@burggraben.net>
+Date:   Tue Feb 6 22:51:27 2024 +0100
+
+    switch to -fvisibility flags
+    
+    this fixes linkage with llvm18 (which does not like the former
+    approach via the #pragma in gcc_hidden.h
+    
+    PR: 276746
+    Submitted by: dim@
+
+diff --git build/moz.configure/toolchain.configure build/moz.configure/toolchain.configure
+index d08b748db250..4696f69153f6 100644
+--- build/moz.configure/toolchain.configure
++++ build/moz.configure/toolchain.configure
+@@ -2186,7 +2186,7 @@ set_define("_LIBCPP_HIDE_FROM_ABI", libcxx_override_visibility.hide_from_abi)
+ @depends(target, build_environment)
+ def visibility_flags(target, env):
+     if target.os != "WINNT":
+-        if target.kernel == "Darwin":
++        if target.kernel == "Darwin" or target.kernel == "FreeBSD":
+             return ("-fvisibility=hidden", "-fvisibility-inlines-hidden")
+         return (
+             "-I%s/system_wrappers" % os.path.join(env.dist),
diff --git a/mail/thunderbird-esr/files/patch-bug1876366 b/mail/thunderbird-esr/files/patch-bug1876366
new file mode 100644
index 000000000000..78483c3fbab7
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-bug1876366
@@ -0,0 +1,23 @@
+commit 46a89fb0319d673b3139a068e3d89aed9f44fc16
+Author: Christoph Moench-Tegeder <cmt@burggraben.net>
+
+    use gdk legacy cursor interface by default
+    
+    Upstream https://bugzilla.mozilla.org/show_bug.cgi?id=1876366#c16
+    hints that we could re-test this once we have GTK 3.24.42 (with the
+    now-current gtk3-3.24.41 the original problem is still reproducable,
+    but toggling this flag does fix it for me)
+
+diff --git modules/libpref/init/StaticPrefList.yaml modules/libpref/init/StaticPrefList.yaml
+index 835450712a12..f2249006c36d 100644
+--- modules/libpref/init/StaticPrefList.yaml
++++ modules/libpref/init/StaticPrefList.yaml
+@@ -16070,7 +16070,7 @@
+ # Whether to use gtk legacy cursor API.
+ - name: widget.gtk.legacy-cursors.enabled
+   type: bool
+-  value: false
++  value: true
+   mirror: always
*** 100491 LINES SKIPPED ***