git: ab304cc0281b - main - www/tor-browser: New port
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 21 Dec 2022 12:07:23 UTC
The branch main has been updated by jsm:
URL: https://cgit.FreeBSD.org/ports/commit/?id=ab304cc0281bb7828921273f8f1d2741ae8a19be
commit ab304cc0281bb7828921273f8f1d2741ae8a19be
Author: Martin Filla <freebsd@sysctl.cz>
AuthorDate: 2022-12-21 11:41:49 +0000
Commit: Jesper Schmitz Mouridsen <jsm@FreeBSD.org>
CommitDate: 2022-12-21 12:01:07 +0000
www/tor-browser: New port
Reuse patches from www/firefox
against tor-project's tor-browser source,
and configure as tor-browser.
PR: 268245
---
www/Makefile | 1 +
www/tor-browser/Makefile | 97 +
www/tor-browser/distinfo | 3 +
www/tor-browser/files/patch-addon-search | 53 +
.../files/patch-browser-app-nsBrowserApp.cpp | 14 +
.../patch-browser_app_profile_000-tor-browser.js | 23 +
www/tor-browser/files/patch-bug1269654_comment5 | 43 +
www/tor-browser/files/patch-bug1504834_comment10 | 36 +
www/tor-browser/files/patch-bug1504834_comment5 | 85 +
www/tor-browser/files/patch-bug1504834_comment9 | 49 +
www/tor-browser/files/patch-bug1559213 | 122 +
www/tor-browser/files/patch-bug1612181_comment1 | 191 +
www/tor-browser/files/patch-bug1626236 | 92 +
www/tor-browser/files/patch-bug1628567 | 32 +
www/tor-browser/files/patch-bug1640982 | 17 +
www/tor-browser/files/patch-bug1659612 | 35 +
www/tor-browser/files/patch-bug1664115 | 82 +
www/tor-browser/files/patch-bug1680982 | 388 +
www/tor-browser/files/patch-bug1716707 | 56 +
www/tor-browser/files/patch-bug1729459_comment12 | 93 +
www/tor-browser/files/patch-bug1773070 | 26 +
www/tor-browser/files/patch-bug847568 | 292 +
.../files/patch-dom_media_flac_FlacDecoder.cpp | 23 +
www/tor-browser/files/patch-env-api-keys | 21 +
.../files/patch-gfx_skia_skia_src_core_SkCpu.cpp | 32 +
www/tor-browser/files/patch-libwebrtc-generate | 159 +
www/tor-browser/files/patch-libwebrtc-generated | 70292 +++++++++++++++++++
.../files/patch-memory_mozalloc_throw__gcc.h | 69 +
www/tor-browser/files/patch-pipewire_init | 92 +
...patch-python_mozbuild_mozbuild_gn__processor.py | 39 +
..._party_libwebrtc_third__party_pffft_src_pffft.c | 10 +
.../files/patch-third__party_sqlite3_src_moz.build | 12 +
...t_compononents_tor-launcher_TorLauncherUtil.jsm | 20 +
...oolkit_compononents_tor-launcher_TorProcess.jsm | 22 +
.../files/patch-tools_profiler_core_patform.cpp | 51 +
www/tor-browser/files/tor-browser.desktop.in | 9 +
www/tor-browser/files/torrc-defaults.in | 4 +
www/tor-browser/pkg-descr | 15 +
38 files changed, 72700 insertions(+)
diff --git a/www/Makefile b/www/Makefile
index b3591592fc38..880f967bd4b4 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -2271,6 +2271,7 @@
SUBDIR += tomcat85
SUBDIR += tomcat9
SUBDIR += tomee
+ SUBDIR += tor-browser
SUBDIR += trac-devel
SUBDIR += trafficserver
SUBDIR += transmission-web
diff --git a/www/tor-browser/Makefile b/www/tor-browser/Makefile
new file mode 100644
index 000000000000..507541d27516
--- /dev/null
+++ b/www/tor-browser/Makefile
@@ -0,0 +1,97 @@
+PORTNAME= tor-browser
+DISTVERSION= 12.0-2
+CATEGORIES= www net security
+MASTER_SITES= https://dist.torproject.org/torbrowser/12.0/
+DISTNAME= src-firefox-tor-browser-102.5.0esr-${DISTVERSION}-build1
+
+MAINTAINER= freebsd@sysctl.cz
+COMMENT= Tor Browser for FreeBSD
+WWW= https://www.torproject.org/
+
+BUILD_DEPENDS= nspr>=4.32:devel/nspr \
+ nss>=3.79.1:security/nss \
+ icu>=71.1,1:devel/icu \
+ libevent>=2.1.8:devel/libevent \
+ harfbuzz>=4.1.0:print/harfbuzz \
+ graphite2>=1.3.14:graphics/graphite2 \
+ png>=1.6.37:graphics/png \
+ dav1d>=1.0.0:multimedia/dav1d \
+ libvpx>=1.11.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
+LIB_DEPENDS= libgconf-2.so:devel/gconf2 \
+ libgtk-x11-2.0.so:x11-toolkits/gtk20 \
+ libpangocairo-1.0.so:x11-toolkits/pango \
+ libpulse.so:audio/pulseaudio \
+ libXt.so:x11-toolkits/libXt \
+ libIDL-2.so:devel/libIDL \
+ libnspr4.so:devel/nspr
+RUN_DEPENDS= tor:security/tor \
+ obfs4proxy:security/obfs4proxy-tor
+
+USES= compiler:c++11-lib libtool \
+ perl5 pkgconfig python:3.4+ shebangfix localbase:ldflags tar:xz
+USE_GECKO= gecko
+
+SSP_UNSAFE= yes
+
+SUB_FILES= torrc-defaults tor-browser.desktop
+BUNDLE_LIBS= yes
+
+USE_MOZILLA= -sqlite
+CFLAGS_powerpc64le= -DSQLITE_BYTEORDER=1234
+CONFIGURE_ENV+= BINDGEN_CFLAGS="-I${LOCALBASE}/include" \
+ MOZ_BRANDING_DIRECTORY="browser/branding/official"
+
+MOZ_EXPORT+= MOZ_TELEMETRY_REPORTING="" \
+ MOZILLA_OFFICIAL="1" \
+ MOZ_OFFICIAL_BRANDING="1" \
+ MOZ_APP_DISPLAYNAME="Tor Browser" \
+ MOZ_APP_NAME="tor-browser"
+
+MOZ_OPTIONS= --with-tor-browser-version=12.0-2 \
+ --enable-official-branding \
+ --enable-optimize \
+ --enable-rust-simd \
+ --enable-bundled-fonts \
+ --disable-tests \
+ --disable-debug \
+ --disable-crashreporter \
+ --disable-webrtc \
+ --disable-parental-controls \
+ --enable-proxy-bypass-protection \
+ --disable-system-policies \
+ --disable-backgroundtasks \
+ --enable-base-browser \
+ --enable-verify-mar \
+ --with-distribution-id=org.torproject
+
+WRKSRC= ${WRKDIR}/firefox-tor-browser-102.5.0esr-12.0-2-build1
+
+.include <bsd.port.options.mk>
+
+.if ${ARCH} == powerpc64
+MOZ_OPTIONS+= --disable-webrtc --without-wasm-sandboxed-libraries
+.else
+BUILD_DEPENDS+= ${LOCALBASE}/share/wasi-sysroot/lib/wasm32-wasi/libc++abi.a:devel/wasi-libcxx \
+ ${LOCALBASE}/share/wasi-sysroot/lib/wasm32-wasi/libc.a:devel/wasi-libc \
+ ${LOCALBASE}/llvm${LLVM_DEFAULT}/lib/clang/${LLVM_VERSION}/lib/wasi/libclang_rt.builtins-wasm32.a:devel/wasi-compiler-rt${LLVM_DEFAULT}
+MOZILLA_PLIST_DIRS= bin lib share/pixmaps share/applications share/tor-browser
+MOZ_OPTIONS+= --with-wasi-sysroot=${LOCALBASE}/share/wasi-sysroot
+.endif
+post-patch:
+ @${REINPLACE_CMD} 's|LOCALBASE|${LOCALBASE}|g' "${WRKSRC}/browser/app/profile/000-tor-browser.js"
+pre-configure:
+ (cd ${WRKSRC} && ${LOCALBASE}/bin/autoconf2.13)
+ (cd ${WRKSRC}/js/src/ && ${LOCALBASE}/bin/autoconf2.13)
+ @${REINPLACE_CMD} 's|export MOZ_GOOGLE_.*||g' ${WRKSRC}/.mozconfig
+ @${REINPLACE_CMD} 's|ac_add_options --enable-update-channel=release||g' ${WRKSRC}/.mozconfig
+post-install:
+ @${MKDIR} ${STAGEDIR}${DATADIR}
+ ${INSTALL_DATA} ${WRKDIR}/torrc-defaults ${STAGEDIR}${DATADIR}/torrc-defaults
+ ${INSTALL_DATA} ${WRKDIR}/tor-browser.desktop ${STAGEDIR}${PREFIX}/share/applications/tor-browser.desktop
+.include <bsd.port.mk>
diff --git a/www/tor-browser/distinfo b/www/tor-browser/distinfo
new file mode 100644
index 000000000000..d0cf1eca7eec
--- /dev/null
+++ b/www/tor-browser/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1670876006
+SHA256 (src-firefox-tor-browser-102.5.0esr-12.0-2-build1.tar.xz) = d65013d724f6002b01473e7cd34a11728dcf5e3390bb7165018c1f42e42e82d4
+SIZE (src-firefox-tor-browser-102.5.0esr-12.0-2-build1.tar.xz) = 512766100
diff --git a/www/tor-browser/files/patch-addon-search b/www/tor-browser/files/patch-addon-search
new file mode 100644
index 000000000000..f405eab2aab1
--- /dev/null
+++ b/www/tor-browser/files/patch-addon-search
@@ -0,0 +1,53 @@
+https://github.com/mozilla/addons/issues/708
+https://github.com/mozilla/addons-frontend/issues/4610
+
+diff --git browser/app/profile/firefox.js browser/app/profile/firefox.js
+index af08811..77a3b18 100644
+--- browser/app/profile/firefox.js
++++ browser/app/profile/firefox.js
+@@ -38,7 +38,7 @@ pref("extensions.postDownloadThirdPartyPrompt", true);
+ // Preferences for AMO integration
+ pref("extensions.getAddons.cache.enabled", true);
+ pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/api/v4/addons/search/?guid=%IDS%&lang=%LOCALE%");
+-pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/firefox/search?q=%TERMS%&platform=%OS%&appver=%VERSION%");
++pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/firefox/search?q=%TERMS%&platform=Linux&appver=%VERSION%");
+ pref("extensions.getAddons.link.url", "https://addons.mozilla.org/%LOCALE%/firefox/");
+ pref("extensions.getAddons.langpacks.url", "https://services.addons.mozilla.org/api/v4/addons/language-tools/?app=firefox&type=language&appversion=%VERSION%");
+ pref("extensions.getAddons.discovery.api_url", "https://services.addons.mozilla.org/api/v4/discovery/?lang=%LOCALE%&edition=%DISTRIBUTION%");
+@@ -193,8 +193,8 @@ pref("app.update.langpack.enabled", true);
+ // .. etc ..
+ //
+ pref("extensions.update.enabled", true);
+-pref("extensions.update.url", "https://versioncheck.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%¤tAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
+-pref("extensions.update.background.url", "https://versioncheck-bg.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%¤tAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
++pref("extensions.update.url", "https://versioncheck.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=Linux&appABI=%APP_ABI%&locale=%APP_LOCALE%¤tAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
++pref("extensions.update.background.url", "https://versioncheck-bg.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=Linux&appABI=%APP_ABI%&locale=%APP_LOCALE%¤tAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
+ pref("extensions.update.interval", 86400); // Check for updates to Extensions and
+ // Themes every day
+
+diff --git toolkit/mozapps/extensions/internal/AddonRepository.jsm toolkit/mozapps/extensions/internal/AddonRepository.jsm
+index 661c902..a41b32f 100644
+--- toolkit/mozapps/extensions/internal/AddonRepository.jsm
++++ toolkit/mozapps/extensions/internal/AddonRepository.jsm
+@@ -592,7 +592,7 @@ 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 == PLATFORM) {
++ if (file.platform == "all" || file.platform == "linux" || file.platform == PLATFORM) {
+ if (file.url) {
+ addon.sourceURI = NetUtil.newURI(file.url);
+ }
+diff --git toolkit/mozapps/extensions/internal/XPIDatabase.jsm toolkit/mozapps/extensions/internal/XPIDatabase.jsm
+index f8c99c7..c6ba8a1 100644
+--- toolkit/mozapps/extensions/internal/XPIDatabase.jsm
++++ toolkit/mozapps/extensions/internal/XPIDatabase.jsm
+@@ -520,7 +520,7 @@ 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/www/tor-browser/files/patch-browser-app-nsBrowserApp.cpp b/www/tor-browser/files/patch-browser-app-nsBrowserApp.cpp
new file mode 100644
index 000000000000..3b9097714e21
--- /dev/null
+++ b/www/tor-browser/files/patch-browser-app-nsBrowserApp.cpp
@@ -0,0 +1,14 @@
+diff --git browser/app/nsBrowserApp.cpp browser/app/nsBrowserApp.cpp
+index 87c2e16..a41f1d9 100644
+--- browser/app/nsBrowserApp.cpp
++++ browser/app/nsBrowserApp.cpp
+@@ -337,6 +337,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
+ DllBlocklist_Initialize(gBlocklistInitFlags);
+ #endif
diff --git a/www/tor-browser/files/patch-browser_app_profile_000-tor-browser.js b/www/tor-browser/files/patch-browser_app_profile_000-tor-browser.js
new file mode 100644
index 000000000000..7ad39b4237ff
--- /dev/null
+++ b/www/tor-browser/files/patch-browser_app_profile_000-tor-browser.js
@@ -0,0 +1,23 @@
+--- browser/app/profile/000-tor-browser.js.orig 2022-11-30 11:37:40 UTC
++++ browser/app/profile/000-tor-browser.js
+@@ -123,14 +123,17 @@ pref("extensions.torlauncher.socks_port_flags", "Exten
+ // The tor_path is relative to the application directory. On Linux and
+ // Windows this is the Browser/ directory that contains the firefox
+ // executables, and on Mac OS it is the TorBrowser.app directory.
+-pref("extensions.torlauncher.tor_path", "");
++pref("extensions.torlauncher.tor_path", "LOCALBASE/bin/tor");
++pref("extensions.torlauncher.torrc-defaults_path", "LOCALBASE/share/tor-browser/torrc-defaults");
++pref("extensions.torlauncher.geoip_path", "LOCALBASE/share/tor/geoip");
++pref("extensions.torlauncher.geoip6_path", "LOCALBASE/share/tor/geoip6");
+
+ // The torrc_path and tordatadir_path are relative to the data directory,
+ // which is TorBrowser-Data/ if it exists as a sibling of the application
+ // directory. If TorBrowser-Data/ does not exist, these paths are relative
+ // to the TorBrowser/ directory within the application directory.
+-pref("extensions.torlauncher.torrc_path", "");
+-pref("extensions.torlauncher.tordatadir_path", "");
++pref("extensions.torlauncher.torrc_path", "torrc");
++pref("extensions.torlauncher.tordatadir_path", "tor_data");
+
+ // BridgeDB-related preferences (used for Moat).
+ pref("extensions.torlauncher.bridgedb_front", "cdn.sstatic.net");
diff --git a/www/tor-browser/files/patch-bug1269654_comment5 b/www/tor-browser/files/patch-bug1269654_comment5
new file mode 100644
index 000000000000..0aa2d639d352
--- /dev/null
+++ b/www/tor-browser/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/www/tor-browser/files/patch-bug1504834_comment10 b/www/tor-browser/files/patch-bug1504834_comment10
new file mode 100644
index 000000000000..2d584adb17ef
--- /dev/null
+++ b/www/tor-browser/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/www/tor-browser/files/patch-bug1504834_comment5 b/www/tor-browser/files/patch-bug1504834_comment5
new file mode 100644
index 000000000000..4d4886823f0f
--- /dev/null
+++ b/www/tor-browser/files/patch-bug1504834_comment5
@@ -0,0 +1,85 @@
+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.
+ //
+diff --git gfx/skia/skia/third_party/skcms/skcms.cc gfx/skia/skia/third_party/skcms/skcms.cc
+index 6b4d87b..7c0559d 100644
+--- gfx/skia/skia/third_party/skcms/skcms.cc
++++ gfx/skia/skia/third_party/skcms/skcms.cc
+@@ -30,6 +30,8 @@
+ #include <avx512fintrin.h>
+ #include <avx512dqintrin.h>
+ #endif
++#else
++ #define SKCMS_PORTABLE
+ #endif
+
+ // sizeof(x) will return size_t, which is 32-bit on some machines and 64-bit on others.
+@@ -280,20 +282,28 @@ enum {
+ 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/www/tor-browser/files/patch-bug1504834_comment9 b/www/tor-browser/files/patch-bug1504834_comment9
new file mode 100644
index 000000000000..c3d149ffa37b
--- /dev/null
+++ b/www/tor-browser/files/patch-bug1504834_comment9
@@ -0,0 +1,49 @@
+https://bugzilla.mozilla.org/show_bug.cgi?id=1504834#c9
+https://bugzilla.mozilla.org/attachment.cgi?id=9111146
+mozilla-bmo1504834-part3.patch
+
+
+# HG changeset patch
+# Parent aecb4600e5da17443b224c79eee178c1d8e155e3
+For FF68, AntiAliasing of XULTexts seem to be broken on big endian (s390x). Text and icons of the sandwich-menu to the
+right of the address bar, as well as plugin-windows appears transparant, which usually means unreadable (white on white).
+
+diff -r aecb4600e5da gfx/skia/skia/include/private/SkNx.h
+--- gfx/skia/skia/include/private/SkNx.h Tue Aug 20 09:46:55 2019 +0200
++++ gfx/skia/skia/include/private/SkNx.h Mon Sep 09 10:04:06 2019 +0200
+@@ -238,7 +238,18 @@
+ AI SkNx operator*(const SkNx& y) const { return fVal * y.fVal; }
+ AI SkNx operator/(const SkNx& y) const { return fVal / y.fVal; }
+
++ // On Big endian the commented out variant doesn't work,
++ // and honestly, I have no idea why it exists in the first place.
++ // The reason its broken is, I think, that it defaults to the double-variant of ToBits()
++ // which gets a 64-bit integer, and FromBits returns 32-bit,
++ // cutting off the wrong half again.
++ // Overall, I see no reason to have ToBits and FromBits at all (even for floats/doubles).
++ // Still we are only "fixing" this for big endian and leave little endian alone (never touch a running system)
++#ifdef SK_CPU_BENDIAN
++ AI SkNx operator&(const SkNx& y) const { return fVal & y.fVal; }
++#else
+ AI SkNx operator&(const SkNx& y) const { return FromBits(ToBits(fVal) & ToBits(y.fVal)); }
++#endif
+ AI SkNx operator|(const SkNx& y) const { return FromBits(ToBits(fVal) | ToBits(y.fVal)); }
+ AI SkNx operator^(const SkNx& y) const { return FromBits(ToBits(fVal) ^ ToBits(y.fVal)); }
+
+diff -r aecb4600e5da gfx/skia/skia/src/opts/SkBlitMask_opts.h
+--- gfx/skia/skia/src/opts/SkBlitMask_opts.h Tue Aug 20 09:46:55 2019 +0200
++++ gfx/skia/skia/src/opts/SkBlitMask_opts.h Mon Sep 09 10:04:06 2019 +0200
+@@ -203,7 +203,13 @@
+ // ~~~>
+ // a = 1*aa + d(1-1*aa) = aa + d(1-aa)
+ // c = 0*aa + d(1-1*aa) = d(1-aa)
++
++ // For big endian we have to swap the alpha-mask from 0,0,0,255 to 255,0,0,0
++#ifdef SK_CPU_BENDIAN
++ return Sk4px(Sk16b(aa) & Sk16b(255,0,0,0, 255,0,0,0, 255,0,0,0, 255,0,0,0))
++#else
+ return Sk4px(Sk16b(aa) & Sk16b(0,0,0,255, 0,0,0,255, 0,0,0,255, 0,0,0,255))
++#endif
+ + d.approxMulDiv255(aa.inv());
+ };
+ while (h --> 0) {
diff --git a/www/tor-browser/files/patch-bug1559213 b/www/tor-browser/files/patch-bug1559213
new file mode 100644
index 000000000000..09b4dcc58e83
--- /dev/null
+++ b/www/tor-browser/files/patch-bug1559213
@@ -0,0 +1,122 @@
+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.
+---
+ config/external/moz.build | 5 +++--
+ config/system-headers.mozbuild | 8 ++++++++
+ dom/media/platforms/moz.build | 5 +++++
+ toolkit/moz.configure | 19 ++++++++++++++++++-
+ 4 files changed, 34 insertions(+), 3 deletions(-)
+
+diff --git config/external/moz.build config/external/moz.build
+index ab77121..75595d9 100644
+--- config/external/moz.build
++++ config/external/moz.build
+@@ -49,8 +49,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 config/system-headers.mozbuild config/system-headers.mozbuild
+index a1b58eb..65729f9 100644
+--- config/system-headers.mozbuild
++++ config/system-headers.mozbuild
+@@ -1289,6 +1289,14 @@ if CONFIG['MOZ_ENABLE_LIBPROXY']:
+ 'proxy.h',
+ ]
+
++if CONFIG['MOZ_SYSTEM_AV1']:
++ system_headers += [
++ 'aom/aom_decoder.h',
++ 'aom/aomdx.h',
++ 'aom/aom_image.h',
++ 'dav1d/dav1d.h',
++ ]
++
+ if CONFIG['MOZ_SYSTEM_LIBVPX']:
+ system_headers += [
+ 'vpx_mem/vpx_mem.h',
+diff --git dom/media/platforms/moz.build dom/media/platforms/moz.build
+index 8509aec..eb6f129 100644
+--- dom/media/platforms/moz.build
++++ dom/media/platforms/moz.build
+@@ -78,6 +78,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 0069865..e806fc8 100644
+--- media/ffvpx/libavcodec/moz.build
++++ media/ffvpx/libavcodec/moz.build
+@@ -112,9 +112,15 @@ if not CONFIG['MOZ_FFVPX_AUDIOONLY']:
+ 'vaapi_vp8.c',
+ 'vaapi_vp9.c',
+ ]
++ if CONFIG["MOZ_SYSTEM_AV1"]:
++ CFLAGS += CONFIG['MOZ_SYSTEM_LIBDAV1D_CFLAGS']
++ OS_LIBS += CONFIG['MOZ_SYSTEM_LIBDAV1D_LIBS']
++ else:
++ USE_LIBS += [
++ 'dav1d',
++ 'media_libdav1d_asm',
++ ]
+ USE_LIBS += [
+- 'dav1d',
+- 'media_libdav1d_asm',
+ 'mozva'
+ ]
+
+diff --git toolkit/moz.configure toolkit/moz.configure
+index 0069865..e806fc8 100644
+--- toolkit/moz.configure
++++ toolkit/moz.configure
+@@ -523,7 +523,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
+@@ -539,6 +555,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/www/tor-browser/files/patch-bug1612181_comment1 b/www/tor-browser/files/patch-bug1612181_comment1
new file mode 100644
index 000000000000..a54b906eebb6
--- /dev/null
+++ b/www/tor-browser/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/www/tor-browser/files/patch-bug1626236 b/www/tor-browser/files/patch-bug1626236
new file mode 100644
index 000000000000..ae3b522f6b90
--- /dev/null
+++ b/www/tor-browser/files/patch-bug1626236
@@ -0,0 +1,92 @@
+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 --git image/decoders/nsGIFDecoder2.cpp image/decoders/nsGIFDecoder2.cpp
+index ebb0b7d..d52ef47 100644
+--- image/decoders/nsGIFDecoder2.cpp
++++ image/decoders/nsGIFDecoder2.cpp
+@@ -422,6 +422,9 @@ void nsGIFDecoder2::ConvertColormap(uint32_t* aColormap, uint32_t aColors) {
+ 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 --git image/decoders/nsJPEGDecoder.cpp image/decoders/nsJPEGDecoder.cpp
+index 9ea4403..d82772c 100644
+--- image/decoders/nsJPEGDecoder.cpp
++++ image/decoders/nsJPEGDecoder.cpp
+@@ -257,6 +257,9 @@ LexerTransition<nsJPEGDecoder::State> nsJPEGDecoder::ReadJPEGData(
+ 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;
+@@ -271,6 +274,7 @@ LexerTransition<nsJPEGDecoder::State> nsJPEGDecoder::ReadJPEGData(
+ mState = JPEG_ERROR;
+ return Transition::TerminateFailure();
+ }
++#endif
+ break;
+ case JCS_CMYK:
+ case JCS_YCCK:
+diff --git image/decoders/nsPNGDecoder.cpp image/decoders/nsPNGDecoder.cpp
+index e3e4ef4..3cc7315 100644
+--- image/decoders/nsPNGDecoder.cpp
++++ image/decoders/nsPNGDecoder.cpp
+@@ -356,7 +356,7 @@ LexerResult nsPNGDecoder::DoDecode(SourceBufferIterator& aIterator,
+ 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:
+@@ -366,6 +366,14 @@ LexerResult nsPNGDecoder::DoDecode(SourceBufferIterator& aIterator,
+ }
+ 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 --git image/decoders/nsWebPDecoder.cpp image/decoders/nsWebPDecoder.cpp
+index e58ca92..2056ebb 100644
+--- image/decoders/nsWebPDecoder.cpp
++++ image/decoders/nsWebPDecoder.cpp
+@@ -247,7 +247,12 @@ nsresult nsWebPDecoder::CreateFrame(const OrientedIntRect& aFrameRect) {
+ // 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/www/tor-browser/files/patch-bug1628567 b/www/tor-browser/files/patch-bug1628567
new file mode 100644
index 000000000000..003ba36d3ad1
--- /dev/null
+++ b/www/tor-browser/files/patch-bug1628567
@@ -0,0 +1,32 @@
+Don't pass --target when CC/CXX contains clang
+
+diff --git third_party/rust/cc/src/lib.rs third_party/rust/cc/src/lib.rs
+index 8cafd2a..f40b746 100644
+--- third_party/rust/cc/src/lib.rs
++++ third_party/rust/cc/src/lib.rs
+@@ -2796,24 +2796,7 @@ impl Tool {
+ }
+
+ fn with_features(path: PathBuf, clang_driver: Option<&str>, cuda: bool) -> Self {
+- // Try to detect family of the tool from its name, falling back to Gnu.
+- let family = if let Some(fname) = path.file_name().and_then(|p| p.to_str()) {
+- if fname.contains("clang-cl") {
+- ToolFamily::Msvc { clang_cl: true }
+- } else if fname.ends_with("cl") || fname == "cl.exe" {
+- ToolFamily::Msvc { clang_cl: false }
+- } else if fname.contains("clang") {
+- match clang_driver {
+- Some("cl") => ToolFamily::Msvc { clang_cl: true },
+- _ => ToolFamily::Clang,
+- }
+- } else {
+- ToolFamily::Gnu
+- }
+- } else {
+- ToolFamily::Gnu
+- };
+-
++ let family = ToolFamily::Gnu;
+ Tool {
+ path: path,
*** 72004 LINES SKIPPED ***