aboutsummaryrefslogtreecommitdiffstats
path: root/community/firefox
diff options
context:
space:
mode:
Diffstat (limited to 'community/firefox')
-rw-r--r--community/firefox/APKBUILD275
-rw-r--r--community/firefox/allow-custom-rust-vendor.patch564
-rw-r--r--community/firefox/b3d8b08265b800165d684281d19ac845a8ff9a66.patch46
-rw-r--r--community/firefox/disable-moz-stackwalk.patch18
-rw-r--r--community/firefox/fd6847c9416f9eebde636e21d794d25d1be8791d.patch37
-rw-r--r--community/firefox/firefox-safe.desktop11
-rw-r--r--community/firefox/firefox.desktop81
-rw-r--r--community/firefox/fix-fortify-system-wrappers.patch13
-rw-r--r--community/firefox/fix-rust-target.patch31
-rw-r--r--community/firefox/fix-seccomp-bpf.patch14
-rw-r--r--community/firefox/fix-toolkit.patch90
-rw-r--r--community/firefox/fix-tools.patch37
-rw-r--r--community/firefox/fix-webrtc-glibcisms.patch20
-rw-r--r--community/firefox/mallinfo.patch20
-rw-r--r--community/firefox/rust_audio-thread-priority.patch39
-rw-r--r--community/firefox/stab.h71
-rw-r--r--community/firefox/x86_64-alpine-linux-musl.json35
17 files changed, 1402 insertions, 0 deletions
diff --git a/community/firefox/APKBUILD b/community/firefox/APKBUILD
new file mode 100644
index 0000000000..15d3b87d6c
--- /dev/null
+++ b/community/firefox/APKBUILD
@@ -0,0 +1,275 @@
+# Contributor: Natanael Copa <ncopa@alpinelinux.org>
+# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
+# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
+pkgname=firefox
+pkgver=73.0.1
+pkgrel=1
+pkgdesc="Firefox web browser"
+url="https://www.firefox.com/"
+arch="all !s390x !armhf" # limited by rust and cargo, build failure on armhf due to wasm
+license="GPL-3.0-only AND LGPL-2.1-only AND LGPL-3.0-only AND MPL-2.0"
+makedepends="
+ alsa-lib-dev
+ autoconf2.13
+ automake
+ bsd-compat-headers
+ bzip2-dev
+ cargo
+ cbindgen
+ clang-dev
+ dbus-glib-dev
+ ffmpeg-dev
+ gtk+2.0-dev
+ gtk+3.0-dev
+ hunspell-dev
+ icu-dev>=64.2
+ libevent-dev
+ libidl-dev
+ libjpeg-turbo-dev
+ libnotify-dev
+ libogg-dev
+ libtheora-dev
+ libtool
+ libvorbis-dev
+ libxt-dev
+ libxcomposite-dev
+ llvm-dev
+ mesa-dev
+ nasm
+ nodejs
+ nspr-dev
+ nss-dev>=3.44.1
+ nss-static
+ python2
+ sqlite-dev
+ sed
+ startup-notification-dev
+ wireless-tools-dev
+ yasm
+ zip
+ "
+
+source="https://ftp.mozilla.org/pub/firefox/releases/$pkgver/source/firefox-$pkgver.source.tar.xz
+ stab.h
+
+ fix-fortify-system-wrappers.patch
+ fix-seccomp-bpf.patch
+ fix-toolkit.patch
+ fix-tools.patch
+ mallinfo.patch
+
+ disable-moz-stackwalk.patch
+ fix-rust-target.patch
+ fix-webrtc-glibcisms.patch
+ rust_audio-thread-priority.patch
+ fd6847c9416f9eebde636e21d794d25d1be8791d.patch
+ allow-custom-rust-vendor.patch
+ b3d8b08265b800165d684281d19ac845a8ff9a66.patch
+
+ x86_64-alpine-linux-musl.json
+ firefox.desktop
+ firefox-safe.desktop"
+
+_mozappdir=/usr/lib/firefox
+
+# help our shared-object scanner to find the libs
+ldpath="$_mozappdir"
+
+# secfixes:
+# 71.0.1-r0:
+# - CVE-2019-17016
+# - CVE-2019-17017
+# - CVE-2019-17020
+# - CVE-2019-17022
+# - CVE-2019-17023
+# - CVE-2019-17024
+# - CVE-2019-17025
+# - CVE-2019-17026
+# 70.0-r0:
+# - CVE-2018-6156
+# - CVE-2019-15903
+# - CVE-2019-11757
+# - CVE-2019-11759
+# - CVE-2019-11760
+# - CVE-2019-11761
+# - CVE-2019-11762
+# - CVE-2019-11763
+# - CVE-2019-11764
+# - CVE-2019-11765
+# - CVE-2019-17000
+# - CVE-2019-17001
+# - CVE-2019-17002
+# 68.0.2-r0:
+# - CVE-2019-11733
+
+# we need this because cargo verifies checksums of all files in vendor
+# crates when it builds and gives us no way to override or update the
+# file sanely... so just clear out the file list
+_clear_vendor_checksums() {
+ sed -i 's/\("files":{\)[^}]*/\1/' third_party/rust/$1/.cargo-checksum.json
+}
+
+prepare() {
+ default_prepare
+ cp "$srcdir"/stab.h toolkit/crashreporter/google-breakpad/src/
+
+ # Firefox needs to know how our custom triplet on x86_64 behaves.
+ mkdir rust_targets
+ cp "$srcdir"/x86_64-alpine-linux-musl.json rust_targets/.
+
+ _clear_vendor_checksums audio_thread_priority
+ _clear_vendor_checksums target-lexicon
+}
+
+build() {
+ mkdir -p "$builddir"/objdir
+ cd "$builddir"/objdir
+
+ export SHELL=/bin/sh
+ export BUILD_OFFICIAL=1
+ export MOZILLA_OFFICIAL=1
+ export USE_SHORT_LIBNAME=1
+ # gcc 6
+ export CXXFLAGS="-fno-delete-null-pointer-checks -fno-schedule-insns2"
+ # Find our triplet JSON
+ export RUST_TARGET_PATH="$builddir/rust_targets"
+
+ # set rpath so linker finds the libs
+ export LDFLAGS="$LDFLAGS -Wl,-rpath,$_mozappdir"
+
+ case "$CARCH" in
+ x86)
+ # disable-elf-hack: exists only on arm, x86, x86_64
+ _arch_config="--disable-elf-hack"
+ export RUST_TARGET="i686-unknown-linux-musl"
+ ;;
+ x86_64)
+ # disable-elf-hack: exists only on arm, x86, x86_64
+ _arch_config="--disable-elf-hack"
+ export RUST_TARGET="$CTARGET"
+ ;;
+ aarch64)
+ export RUST_TARGET="aarch64-unknown-linux-musl"
+ ;;
+ armv7)
+ # disable-elf-hack: exists only on arm, x86, x86_64
+ _arch_config="--disable-elf-hack"
+ export RUST_TARGET="armv7-unknown-linux-musleabihf"
+ ;;
+ armhf)
+ # disable-elf-hack: exists only on arm, x86, x86_64
+ _arch_config="--disable-elf-hack"
+ export RUST_TARGET="arm-unknown-linux-musleabihf"
+ ;;
+ ppc64le)
+ export RUST_TARGET="powerpc64le-unknown-linux-musl"
+ ;;
+ esac
+
+ # FF doesn't have SIMD available on these arches.
+ case "$CARCH" in
+ armhf|armv7)
+ _rust_simd="--disable-rust-simd"
+ _low_mem_flags="--disable-debug-symbols --disable-debug"
+ export RUSTFLAGS="$RUSTFLAGS -C debuginfo=0"
+ ;;
+ x86)
+ _low_mem_flags="--disable-debug-symbols --disable-debug"
+ export RUSTFLAGS="$RUSTFLAGS -C debuginfo=0"
+ ;;
+ *) _rust_simd="--enable-rust-simd" ;;
+ esac
+
+ ../configure \
+ --prefix=/usr \
+ $_arch_config \
+ --disable-crashreporter \
+ --disable-gold \
+ --disable-install-strip \
+ --disable-jemalloc \
+ --disable-profiling \
+ --disable-pulseaudio \
+ --disable-strip \
+ --disable-tests \
+ --disable-updater \
+ --enable-alsa \
+ --enable-default-toolkit=cairo-gtk3-wayland \
+ --enable-official-branding \
+ --enable-optimize="$CFLAGS -O2" \
+ --enable-startup-notification \
+ --enable-system-ffi \
+ --enable-system-sqlite \
+ --enable-ffmpeg \
+ $_rust_simd \
+ $_low_mem_flags \
+ --enable-hardening \
+ --with-system-bz2 \
+ --with-system-icu \
+ --with-system-libevent \
+ --with-system-nspr \
+ --with-system-nss \
+ --with-system-pixman \
+ --with-system-png \
+ --with-system-zlib \
+ --with-clang-path=/usr/bin/clang \
+ --with-libclang-path=/usr/lib
+ # FIXME: fix build with --with-system-libvpx and libvpx 1.8.0
+ # https://bugzilla.mozilla.org/show_bug.cgi?id=1525393
+ make
+}
+
+package() {
+ cd "$builddir"/objdir
+
+ make install \
+ DESTDIR="$pkgdir" \
+ MOZ_MAKE_FLAGS="$MAKEOPTS"
+
+ install -m755 -d "$pkgdir"/usr/share/applications
+ install -m755 -d "$pkgdir"/usr/share/pixmaps
+
+ local _png
+ for _png in ../browser/branding/official/default*.png; do
+ local i=${_png%.png}
+ i=${i##*/default}
+ install -D -m644 "$_png" "$pkgdir"/usr/share/icons/hicolor/"$i"x"$i"/apps/firefox.png
+ done
+
+ install -m644 "$builddir"/browser/branding/official/default48.png \
+ "$pkgdir"/usr/share/pixmaps/firefox.png
+ install -m644 "$srcdir"/firefox.desktop "$pkgdir"/usr/share/applications/firefox.desktop
+ install -m644 "$srcdir"/firefox-safe.desktop "$pkgdir"/usr/share/applications/firefox-safe.desktop
+
+ # install our vendor prefs
+ install -d "$pkgdir"/$_mozappdir/browser/defaults/preferences
+
+ cat >> "$pkgdir"/$_mozappdir/browser/defaults/preferences/firefox-branding.js <<- EOF
+ // Use LANG environment variable to choose locale
+ pref("intl.locale.requested", "");
+
+ // Disable default browser checking.
+ pref("browser.shell.checkDefaultBrowser", false);
+
+ // Don't disable our bundled extensions in the application directory
+ pref("extensions.autoDisableScopes", 11);
+ pref("extensions.shownSelectionUI", true);
+ EOF
+}
+
+sha512sums="89fac2c50e092f2805f48399f68cdf0793324e1dce89266f62b76e9b335dfc553ae54a36738992630b6035a52cd65b9aa774e7e54cea2e3ec7d609d9219cdf76 firefox-73.0.1.source.tar.xz
+0b3f1e4b9fdc868e4738b5c81fd6c6128ce8885b260affcb9a65ff9d164d7232626ce1291aaea70132b3e3124f5e13fef4d39326b8e7173e362a823722a85127 stab.h
+2f4f15974d52de4bb273b62a332d13620945d284bbc6fe6bd0a1f58ff7388443bc1d3bf9c82cc31a8527aad92b0cd3a1bc41d0af5e1800e0dcbd7033e58ffd71 fix-fortify-system-wrappers.patch
+84b84d2d7dbc16002510bf856796ad345ac38ef6d3254670230189bba7c2d4781714d231236d5a3d70129a4597b430c3171644b01ad0f5a5bb13b55d407337a4 fix-seccomp-bpf.patch
+2c65ea7280e6e89826ebad563ee25203a99ff0b4ba8fc60ec261ada6c69874d649c6ac92fcecc6307a6e5a00de27d7956acf944d556ddfadec0411be16f4e0b8 fix-toolkit.patch
+4d55f41d15be7457ad630f8f07e4fc0314c2f75720010b4bbe6a2a7f3228210a1e069949e11795efbe2e784b0762e79fdfe5b8ec38e8a64cb8d9cf3b57dd5af1 fix-tools.patch
+a4a3e062661bda64d502d426c480ac9645345860118de9df9ffe6e0597738c70c11e5cdef2d4fd12c5e2ee30a09310159230524655a419a4f7e4eeeb0f3c06b0 mallinfo.patch
+454ea3263cabce099accbdc47aaf83be26a19f8b5a4568c01a7ef0384601cf8315efd86cd917f9c8bf419c2c845db89a905f3ff9a8eb0c8e41042e93aa96a85c disable-moz-stackwalk.patch
+089c97e6011e86a9b9d9e7b0c8ba3af0519d1ce4e2b1e9ab7719762d6968388bfa47dad3bf23a6d41c3d66fdcc6c15e2c926e3ff9500bfd4fbf1b53e6d19dc57 fix-rust-target.patch
+d35cacb9ede80e6bfbef0709823e536dddfb1c02d776275b0b7adb5969e9927d8c6117df96873569c3f3db0a18ee5db24f8086a9311a05077892be43a3dd8d79 fix-webrtc-glibcisms.patch
+18098bae18ce9ead6bca0d93d28e634495fa08a4c0707057f72a9e34205a64a0ce5ab98a4cfc2d492412725b14447eb9553b2976d9620c3d71eba2135c6ba211 rust_audio-thread-priority.patch
+60845dcb034b2c4459c30f7d5f25c8176cf42df794e2cc0e86c3e2abb6541c24b962f3a16ca70a288d4d6f377b68d00b2904b22463108559612053d835d9bff1 fd6847c9416f9eebde636e21d794d25d1be8791d.patch
+8487a7f1936d493f0429ebbf579469471542fccce3a842803ade3fa76200b0e831a176aff9c8072da17932d01923cfc050611041e3e9e429b25995b9a07bd3cf allow-custom-rust-vendor.patch
+81647de16c8d2959068c36d08244a7a067bedf04e18d04da9201aae884ea15948cae1760b6985b4bd9c13e90b03b2ccc89bb10105712382bc728f070e4f780bb b3d8b08265b800165d684281d19ac845a8ff9a66.patch
+0dfa633abf3f411c90a030c46ee7f8fdde6fdd9f3a0c493599a58633e09b183d6c04590fc1984256e514c1da4f72f43dde3f5dbceef888b08262952b4f894919 x86_64-alpine-linux-musl.json
+f3b7c3e804ce04731012a46cb9e9a6b0769e3772aef9c0a4a8c7520b030fdf6cd703d5e9ff49275f14b7d738fe82a0a4fde3bc3219dff7225d5db0e274987454 firefox.desktop
+5dcb6288d0444a8a471d669bbaf61cdb1433663eff38b72ee5e980843f5fc07d0d60c91627a2c1159215d0ad77ae3f115dcc5fdfe87e64ca704b641aceaa44ed firefox-safe.desktop"
diff --git a/community/firefox/allow-custom-rust-vendor.patch b/community/firefox/allow-custom-rust-vendor.patch
new file mode 100644
index 0000000000..c20ca46acb
--- /dev/null
+++ b/community/firefox/allow-custom-rust-vendor.patch
@@ -0,0 +1,564 @@
+From a5a3db2d32ff1d359aef5ec586b91164570c1685 Mon Sep 17 00:00:00 2001
+From: Dan Gohman <sunfish@mozilla.com>
+Date: Tue, 5 Nov 2019 09:56:15 -0800
+Subject: [PATCH 1/7] Support custom vendor strings.
+
+Add support for custom vendors, as in "x86_64-gentoo-linux-musl".
+
+Fixes #33.
+---
+ src/targets.rs | 108 ++++++++++++++++++++++++++++++++++++++++++++++++-
+ src/triple.rs | 4 --
+ 2 files changed, 106 insertions(+), 6 deletions(-)
+
+diff --git a/src/targets.rs b/src/targets.rs
+index 6ae570e..90b2736 100644
+--- a/third_party/rust/target-lexicon/src/targets.rs
++++ b/third_party/rust/target-lexicon/src/targets.rs
+@@ -1,6 +1,8 @@
+ // This file defines all the identifier enums and target-aware logic.
+
+ use crate::triple::{Endianness, PointerWidth, Triple};
++use alloc::boxed::Box;
++use alloc::string::String;
+ use core::fmt;
+ use core::str::FromStr;
+
+@@ -292,7 +294,7 @@ impl Aarch64Architecture {
+
+ /// The "vendor" field, which in practice is little more than an arbitrary
+ /// modifier.
+-#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
++#[derive(Clone, Debug, PartialEq, Eq, Hash)]
+ #[allow(missing_docs)]
+ pub enum Vendor {
+ Unknown,
+@@ -306,6 +308,15 @@ pub enum Vendor {
+ Sun,
+ Uwp,
+ Wrs,
++
++ /// A custom vendor. "Custom" in this context means that the vendor is
++ /// not specifically recognized by upstream Autotools, LLVM, Rust, or other
++ /// relevant authorities on triple naming. It's useful for people building
++ /// and using locally patched toolchains.
++ ///
++ /// Outside of such patched environments, users of `target-lexicon` should
++ /// treat `Custom` the same as `Unknown` and ignore the string.
++ Custom(Box<String>),
+ }
+
+ /// The "operating system" field, which sometimes implies an environment, and
+@@ -717,6 +728,7 @@ impl fmt::Display for Vendor {
+ Vendor::Sun => "sun",
+ Vendor::Uwp => "uwp",
+ Vendor::Wrs => "wrs",
++ Vendor::Custom(ref name) => name,
+ };
+ f.write_str(s)
+ }
+@@ -738,7 +750,46 @@ impl FromStr for Vendor {
+ "sun" => Vendor::Sun,
+ "uwp" => Vendor::Uwp,
+ "wrs" => Vendor::Wrs,
+- _ => return Err(()),
++ custom => {
++ use alloc::borrow::ToOwned;
++
++ // A custom vendor. Since triple syntax is so loosely defined,
++ // be as conservative as we can to avoid potential ambiguities.
++ // We err on the side of being too strict here, as we can
++ // always relax it if needed.
++
++ // Don't allow empty string names.
++ if custom.is_empty() {
++ return Err(());
++ }
++
++ // Don't allow any other recognized name as a custom vendor,
++ // since vendors can be omitted in some contexts.
++ if Architecture::from_str(custom).is_ok()
++ || OperatingSystem::from_str(custom).is_ok()
++ || Environment::from_str(custom).is_ok()
++ || BinaryFormat::from_str(custom).is_ok()
++ {
++ return Err(());
++ }
++
++ // Require the first character to be an ascii lowercase.
++ if !custom.chars().nth(0).unwrap().is_ascii_lowercase() {
++ return Err(());
++ }
++
++ // Restrict the set of characters permitted in a custom vendor.
++ if custom
++ .find(|c: char| {
++ !(c.is_ascii_lowercase() || c.is_ascii_digit() || c == '_' || c == '.')
++ })
++ .is_some()
++ {
++ return Err(());
++ }
++
++ Vendor::Custom(Box::new(custom.to_owned()))
++ }
+ })
+ }
+ }
+@@ -1120,4 +1171,57 @@ mod tests {
+ assert_eq!(t.environment, Environment::Eabihf);
+ assert_eq!(t.binary_format, BinaryFormat::Elf);
+ }
++
++ #[test]
++ fn custom_vendors() {
++ assert!(Triple::from_str("x86_64--linux").is_err());
++ assert!(Triple::from_str("x86_64-42-linux").is_err());
++ assert!(Triple::from_str("x86_64-__customvendor__-linux").is_err());
++ assert!(Triple::from_str("x86_64-^-linux").is_err());
++ assert!(Triple::from_str("x86_64- -linux").is_err());
++ assert!(Triple::from_str("x86_64-CustomVendor-linux").is_err());
++ assert!(Triple::from_str("x86_64-linux-linux").is_err());
++ assert!(Triple::from_str("x86_64-x86_64-linux").is_err());
++ assert!(Triple::from_str("x86_64-elf-linux").is_err());
++ assert!(Triple::from_str("x86_64-gnu-linux").is_err());
++ assert!(Triple::from_str("x86_64-linux-customvendor").is_err());
++ assert!(Triple::from_str("customvendor").is_err());
++ assert!(Triple::from_str("customvendor-x86_64").is_err());
++ assert!(Triple::from_str("x86_64-").is_err());
++ assert!(Triple::from_str("x86_64--").is_err());
++
++ let t = Triple::from_str("x86_64-customvendor-linux")
++ .expect("can't parse target with custom vendor");
++ assert_eq!(t.architecture, Architecture::X86_64);
++ assert_eq!(
++ t.vendor,
++ Vendor::Custom(Box::new(String::from_str("customvendor").unwrap()))
++ );
++ assert_eq!(t.operating_system, OperatingSystem::Linux);
++ assert_eq!(t.environment, Environment::Unknown);
++ assert_eq!(t.binary_format, BinaryFormat::Elf);
++ assert_eq!(t.to_string(), "x86_64-customvendor-linux");
++
++ let t = Triple::from_str("x86_64-customvendor")
++ .expect("can't parse target with custom vendor");
++ assert_eq!(t.architecture, Architecture::X86_64);
++ assert_eq!(
++ t.vendor,
++ Vendor::Custom(Box::new(String::from_str("customvendor").unwrap()))
++ );
++ assert_eq!(t.operating_system, OperatingSystem::Unknown);
++ assert_eq!(t.environment, Environment::Unknown);
++ assert_eq!(t.binary_format, BinaryFormat::Unknown);
++
++ assert_eq!(
++ Triple::from_str("unknown-foo"),
++ Ok(Triple {
++ architecture: Architecture::Unknown,
++ vendor: Vendor::Custom(Box::new(String::from_str("foo").unwrap())),
++ operating_system: OperatingSystem::Unknown,
++ environment: Environment::Unknown,
++ binary_format: BinaryFormat::Unknown,
++ })
++ );
++ }
+ }
+diff --git a/src/triple.rs b/src/triple.rs
+index 36dcd9a..1abda26 100644
+--- a/third_party/rust/target-lexicon/src/triple.rs
++++ b/third_party/rust/target-lexicon/src/triple.rs
+@@ -322,10 +322,6 @@ mod tests {
+ Triple::from_str("foo"),
+ Err(ParseError::UnrecognizedArchitecture("foo".to_owned()))
+ );
+- assert_eq!(
+- Triple::from_str("unknown-foo"),
+- Err(ParseError::UnrecognizedVendor("foo".to_owned()))
+- );
+ assert_eq!(
+ Triple::from_str("unknown-unknown-foo"),
+ Err(ParseError::UnrecognizedOperatingSystem("foo".to_owned()))
+
+From 6f90d7274dce4e7f9bb120f6b36cf26881bde9a7 Mon Sep 17 00:00:00 2001
+From: Dan Gohman <sunfish@mozilla.com>
+Date: Tue, 5 Nov 2019 10:33:56 -0800
+Subject: [PATCH 2/7] Add more tests.
+
+---
+ src/targets.rs | 30 ++++++++++++++++++++++++++++--
+ 1 file changed, 28 insertions(+), 2 deletions(-)
+
+diff --git a/src/targets.rs b/src/targets.rs
+index 90b2736..7d1f069 100644
+--- a/third_party/rust/target-lexicon/src/targets.rs
++++ b/third_party/rust/target-lexicon/src/targets.rs
+@@ -1174,6 +1174,7 @@ mod tests {
+
+ #[test]
+ fn custom_vendors() {
++ // Test various invalid cases.
+ assert!(Triple::from_str("x86_64--linux").is_err());
+ assert!(Triple::from_str("x86_64-42-linux").is_err());
+ assert!(Triple::from_str("x86_64-__customvendor__-linux").is_err());
+@@ -1190,6 +1191,31 @@ mod tests {
+ assert!(Triple::from_str("x86_64-").is_err());
+ assert!(Triple::from_str("x86_64--").is_err());
+
++ // Test various Unicode things.
++ assert!(
++ Triple::from_str("x86_64-𝓬𝓾𝓼𝓽𝓸𝓶𝓿𝓮𝓷𝓭𝓸𝓻-linux").is_err(),
++ "unicode font hazard"
++ );
++ assert!(
++ Triple::from_str("x86_64-ćúśtőḿvéńdőŕ-linux").is_err(),
++ "diacritical mark stripping hazard"
++ );
++ assert!(
++ Triple::from_str("x86_64-customvendοr-linux").is_err(),
++ "homoglyph hazard"
++ );
++ assert!(Triple::from_str("x86_64-customvendor-linux").is_ok());
++ assert!(
++ Triple::from_str("x86_64-ffi-linux").is_err(),
++ "normalization hazard"
++ );
++ assert!(Triple::from_str("x86_64-ffi-linux").is_ok());
++ assert!(
++ Triple::from_str("x86_64-custom‍vendor-linux").is_err(),
++ "zero-width character hazard"
++ );
++
++ // Test some valid cases.
+ let t = Triple::from_str("x86_64-customvendor-linux")
+ .expect("can't parse target with custom vendor");
+ assert_eq!(t.architecture, Architecture::X86_64);
+@@ -1202,8 +1228,8 @@ mod tests {
+ assert_eq!(t.binary_format, BinaryFormat::Elf);
+ assert_eq!(t.to_string(), "x86_64-customvendor-linux");
+
+- let t = Triple::from_str("x86_64-customvendor")
+- .expect("can't parse target with custom vendor");
++ let t =
++ Triple::from_str("x86_64-customvendor").expect("can't parse target with custom vendor");
+ assert_eq!(t.architecture, Architecture::X86_64);
+ assert_eq!(
+ t.vendor,
+
+From c0e318b3c1be2d1965579f07dd563fb9cc0c4eb1 Mon Sep 17 00:00:00 2001
+From: Dan Gohman <sunfish@mozilla.com>
+Date: Tue, 5 Nov 2019 12:56:31 -0800
+Subject: [PATCH 3/7] Use `.chars().any(...)` instead of
+ `.find(...).is_some()`.
+
+---
+ src/targets.rs | 9 +++------
+ 1 file changed, 3 insertions(+), 6 deletions(-)
+
+diff --git a/src/targets.rs b/src/targets.rs
+index 7d1f069..1078dd3 100644
+--- a/third_party/rust/target-lexicon/src/targets.rs
++++ b/third_party/rust/target-lexicon/src/targets.rs
+@@ -779,12 +779,9 @@ impl FromStr for Vendor {
+ }
+
+ // Restrict the set of characters permitted in a custom vendor.
+- if custom
+- .find(|c: char| {
+- !(c.is_ascii_lowercase() || c.is_ascii_digit() || c == '_' || c == '.')
+- })
+- .is_some()
+- {
++ if custom.chars().any(|c: char| {
++ !(c.is_ascii_lowercase() || c.is_ascii_digit() || c == '_' || c == '.')
++ }) {
+ return Err(());
+ }
+
+
+From f319950528654c772193d9eb3bf40bc8df35fcae Mon Sep 17 00:00:00 2001
+From: Dan Gohman <sunfish@mozilla.com>
+Date: Thu, 7 Nov 2019 15:15:48 -0800
+Subject: [PATCH 4/7] Fix build.rs to generate the correct code to build
+ Vendors.
+
+---
+ build.rs | 14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/build.rs b/build.rs
+index a0ba3b7..446f9e7 100644
+--- a/third_party/rust/target-lexicon/build.rs
++++ b/third_party/rust/target-lexicon/build.rs
+@@ -32,6 +32,7 @@ mod parse_error {
+ }
+ }
+
++use self::targets::Vendor;
+ use self::triple::Triple;
+
+ fn main() {
+@@ -60,7 +61,7 @@ fn write_host_rs(mut out: File, triple: Triple) -> io::Result<()> {
+ " architecture: Architecture::{:?},",
+ triple.architecture
+ )?;
+- writeln!(out, " vendor: Vendor::{:?},", triple.vendor)?;
++ writeln!(out, " vendor: {},", vendor_display(&triple.vendor))?;
+ writeln!(
+ out,
+ " operating_system: OperatingSystem::{:?},",
+@@ -90,7 +91,7 @@ fn write_host_rs(mut out: File, triple: Triple) -> io::Result<()> {
+ writeln!(out, "impl Vendor {{")?;
+ writeln!(out, " /// Return the vendor for the current host.")?;
+ writeln!(out, " pub const fn host() -> Self {{")?;
+- writeln!(out, " Vendor::{:?}", triple.vendor)?;
++ writeln!(out, " {}", vendor_display(&triple.vendor))?;
+ writeln!(out, " }}")?;
+ writeln!(out, "}}")?;
+ writeln!(out)?;
+@@ -160,3 +161,12 @@ fn write_host_rs(mut out: File, triple: Triple) -> io::Result<()> {
+
+ Ok(())
+ }
++
++fn vendor_display(vendor: &Vendor) -> String {
++ match vendor {
++ Vendor::Custom(custom) => {
++ format!("Vendor::Custom(Box::new(String::from_str({:?})))", custom)
++ }
++ known => format!("Vendor::{:?}", known),
++ }
++}
+
+From e558f6934535be3b8ccc9a99a33e861cb7431dfe Mon Sep 17 00:00:00 2001
+From: Dan Gohman <sunfish@mozilla.com>
+Date: Fri, 8 Nov 2019 12:10:34 -0800
+Subject: [PATCH 5/7] Fix custom vendors in `const fn` contexts.
+
+---
+ build.rs | 15 +++++++++++----
+ src/lib.rs | 4 ++--
+ src/targets.rs | 51 ++++++++++++++++++++++++++++++++++++++++++--------
+ 3 files changed, 56 insertions(+), 14 deletions(-)
+
+diff --git a/build.rs b/build.rs
+index 446f9e7..e88206e 100644
+--- a/third_party/rust/target-lexicon/build.rs
++++ b/third_party/rust/target-lexicon/build.rs
+@@ -53,6 +53,8 @@ fn write_host_rs(mut out: File, triple: Triple) -> io::Result<()> {
+ writeln!(out, "use crate::Aarch64Architecture::*;")?;
+ writeln!(out, "#[allow(unused_imports)]")?;
+ writeln!(out, "use crate::ArmArchitecture::*;")?;
++ writeln!(out, "#[allow(unused_imports)]")?;
++ writeln!(out, "use crate::CustomVendor;")?;
+ writeln!(out)?;
+ writeln!(out, "/// The `Triple` of the current host.")?;
+ writeln!(out, "pub const HOST: Triple = Triple {{")?;
+@@ -139,7 +141,11 @@ fn write_host_rs(mut out: File, triple: Triple) -> io::Result<()> {
+ " architecture: Architecture::{:?},",
+ triple.architecture
+ )?;
+- writeln!(out, " vendor: Vendor::{:?},", triple.vendor)?;
++ writeln!(
++ out,
++ " vendor: {},",
++ vendor_display(&triple.vendor)
++ )?;
+ writeln!(
+ out,
+ " operating_system: OperatingSystem::{:?},",
+@@ -164,9 +170,10 @@ fn write_host_rs(mut out: File, triple: Triple) -> io::Result<()> {
+
+ fn vendor_display(vendor: &Vendor) -> String {
+ match vendor {
+- Vendor::Custom(custom) => {
+- format!("Vendor::Custom(Box::new(String::from_str({:?})))", custom)
+- }
++ Vendor::Custom(custom) => format!(
++ "Vendor::Custom(CustomVendor::Static({:?}))",
++ custom.as_str()
++ ),
+ known => format!("Vendor::{:?}", known),
+ }
+ }
+diff --git a/src/lib.rs b/src/lib.rs
+index 8d6da8d..70f6488 100644
+--- a/third_party/rust/target-lexicon/src/lib.rs
++++ b/third_party/rust/target-lexicon/src/lib.rs
+@@ -28,7 +28,7 @@ mod triple;
+ pub use self::host::HOST;
+ pub use self::parse_error::ParseError;
+ pub use self::targets::{
+- Aarch64Architecture, Architecture, ArmArchitecture, BinaryFormat, Environment, OperatingSystem,
+- Vendor,
++ Aarch64Architecture, Architecture, ArmArchitecture, BinaryFormat, CustomVendor, Environment,
++ OperatingSystem, Vendor,
+ };
+ pub use self::triple::{CallingConvention, Endianness, PointerWidth, Triple};
+diff --git a/src/targets.rs b/src/targets.rs
+index 1078dd3..7152020 100644
+--- a/third_party/rust/target-lexicon/src/targets.rs
++++ b/third_party/rust/target-lexicon/src/targets.rs
+@@ -4,6 +4,7 @@ use crate::triple::{Endianness, PointerWidth, Triple};
+ use alloc::boxed::Box;
+ use alloc::string::String;
+ use core::fmt;
++use core::hash::{Hash, Hasher};
+ use core::str::FromStr;
+
+ /// The "architecture" field, which in some cases also specifies a specific
+@@ -292,6 +293,39 @@ impl Aarch64Architecture {
+ }
+ }
+
++/// A string for a `Vendor::Custom` that can either be used in `const`
++/// contexts or hold dynamic strings.
++#[derive(Clone, Debug, Eq)]
++pub enum CustomVendor {
++ /// An owned `String`. This supports the general case.
++ Owned(Box<String>),
++ /// A static `str`, so that `CustomVendor` can be constructed in `const`
++ /// contexts.
++ Static(&'static str),
++}
++
++impl CustomVendor {
++ /// Extracts a string slice.
++ pub fn as_str(&self) -> &str {
++ match self {
++ CustomVendor::Owned(s) => s,
++ CustomVendor::Static(s) => s,
++ }
++ }
++}
++
++impl PartialEq for CustomVendor {
++ fn eq(&self, other: &Self) -> bool {
++ self.as_str() == other.as_str()
++ }
++}
++
++impl Hash for CustomVendor {
++ fn hash<H: Hasher>(&self, state: &mut H) {
++ self.as_str().hash(state)
++ }
++}
++
+ /// The "vendor" field, which in practice is little more than an arbitrary
+ /// modifier.
+ #[derive(Clone, Debug, PartialEq, Eq, Hash)]
+@@ -316,7 +350,7 @@ pub enum Vendor {
+ ///
+ /// Outside of such patched environments, users of `target-lexicon` should
+ /// treat `Custom` the same as `Unknown` and ignore the string.
+- Custom(Box<String>),
++ Custom(CustomVendor),
+ }
+
+ /// The "operating system" field, which sometimes implies an environment, and
+@@ -728,7 +762,7 @@ impl fmt::Display for Vendor {
+ Vendor::Sun => "sun",
+ Vendor::Uwp => "uwp",
+ Vendor::Wrs => "wrs",
+- Vendor::Custom(ref name) => name,
++ Vendor::Custom(ref name) => name.as_str(),
+ };
+ f.write_str(s)
+ }
+@@ -779,13 +813,14 @@ impl FromStr for Vendor {
+ }
+
+ // Restrict the set of characters permitted in a custom vendor.
+- if custom.chars().any(|c: char| {
++ fn is_prohibited_char(c: char) -> bool {
+ !(c.is_ascii_lowercase() || c.is_ascii_digit() || c == '_' || c == '.')
+- }) {
++ }
++ if custom.chars().any(is_prohibited_char) {
+ return Err(());
+ }
+
+- Vendor::Custom(Box::new(custom.to_owned()))
++ Vendor::Custom(CustomVendor::Owned(Box::new(custom.to_owned())))
+ }
+ })
+ }
+@@ -1218,7 +1253,7 @@ mod tests {
+ assert_eq!(t.architecture, Architecture::X86_64);
+ assert_eq!(
+ t.vendor,
+- Vendor::Custom(Box::new(String::from_str("customvendor").unwrap()))
++ Vendor::Custom(CustomVendor::Static("customvendor"))
+ );
+ assert_eq!(t.operating_system, OperatingSystem::Linux);
+ assert_eq!(t.environment, Environment::Unknown);
+@@ -1230,7 +1265,7 @@ mod tests {
+ assert_eq!(t.architecture, Architecture::X86_64);
+ assert_eq!(
+ t.vendor,
+- Vendor::Custom(Box::new(String::from_str("customvendor").unwrap()))
++ Vendor::Custom(CustomVendor::Static("customvendor"))
+ );
+ assert_eq!(t.operating_system, OperatingSystem::Unknown);
+ assert_eq!(t.environment, Environment::Unknown);
+@@ -1240,7 +1275,7 @@ mod tests {
+ Triple::from_str("unknown-foo"),
+ Ok(Triple {
+ architecture: Architecture::Unknown,
+- vendor: Vendor::Custom(Box::new(String::from_str("foo").unwrap())),
++ vendor: Vendor::Custom(CustomVendor::Static("foo")),
+ operating_system: OperatingSystem::Unknown,
+ environment: Environment::Unknown,
+ binary_format: BinaryFormat::Unknown,
+
+From bc4b444133b8a5e56602f7c77c10ef3f1e7a7c78 Mon Sep 17 00:00:00 2001
+From: Dan Gohman <sunfish@mozilla.com>
+Date: Mon, 18 Nov 2019 13:45:58 -0800
+Subject: [PATCH 6/7] Add a testcase with a BOM too, just in case.
+
+---
+ src/targets.rs | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/targets.rs b/src/targets.rs
+index 7152020..9a4d990 100644
+--- a/third_party/rust/target-lexicon/src/targets.rs
++++ b/third_party/rust/target-lexicon/src/targets.rs
+@@ -1246,6 +1246,10 @@ mod tests {
+ Triple::from_str("x86_64-custom‍vendor-linux").is_err(),
+ "zero-width character hazard"
+ );
++ assert!(
++ Triple::from_str("x86_64-customvendor-linux").is_err(),
++ "BOM hazard"
++ );
+
+ // Test some valid cases.
+ let t = Triple::from_str("x86_64-customvendor-linux")
+
+From 721fbbe1c9cfd3adc9aaf011c62d6a36078f4133 Mon Sep 17 00:00:00 2001
+From: Dan Gohman <sunfish@mozilla.com>
+Date: Mon, 18 Nov 2019 20:56:40 -0800
+Subject: [PATCH 7/7] Use an anonymous function instead of just a local
+ function.
+
+---
+ src/targets.rs | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/src/targets.rs b/src/targets.rs
+index 9a4d990..eb5a088 100644
+--- a/third_party/rust/target-lexicon/src/targets.rs
++++ b/third_party/rust/target-lexicon/src/targets.rs
+@@ -813,10 +813,9 @@ impl FromStr for Vendor {
+ }
+
+ // Restrict the set of characters permitted in a custom vendor.
+- fn is_prohibited_char(c: char) -> bool {
++ if custom.chars().any(|c: char| {
+ !(c.is_ascii_lowercase() || c.is_ascii_digit() || c == '_' || c == '.')
+- }
+- if custom.chars().any(is_prohibited_char) {
++ }) {
+ return Err(());
+ }
+
diff --git a/community/firefox/b3d8b08265b800165d684281d19ac845a8ff9a66.patch b/community/firefox/b3d8b08265b800165d684281d19ac845a8ff9a66.patch
new file mode 100644
index 0000000000..873f4c3ad4
--- /dev/null
+++ b/community/firefox/b3d8b08265b800165d684281d19ac845a8ff9a66.patch
@@ -0,0 +1,46 @@
+
+# HG changeset patch
+# User Andrew Osmond <aosmond@mozilla.com>
+# Date 1579706360 0
+# Node ID b3d8b08265b800165d684281d19ac845a8ff9a66
+# Parent 50c371b37a9fcd994a5866db73bd0d078e19f95d
+Bug 1610814 - Fix NEON compile error with gcc and RGB unpacking. r=lsalzman
+
+This patch makes us use the correct intrinsic for loading a uint8x16
+register. It is not entirely clear why clang accepts this without
+complaint but beyond the types, it should be equivalent.
+
+Differential Revision: https://phabricator.services.mozilla.com/D60667
+
+diff --git a/gfx/2d/SwizzleNEON.cpp b/gfx/2d/SwizzleNEON.cpp
+--- a/gfx/2d/SwizzleNEON.cpp
++++ b/gfx/2d/SwizzleNEON.cpp
+@@ -407,25 +407,25 @@ void UnpackRowRGB24_NEON(const uint8_t*
+ }
+
+ uint8x16_t alpha = vreinterpretq_u8_u32(vdupq_n_u32(0xFF000000));
+
+ // Process all 4-pixel chunks as one vector.
+ src -= 4 * 3;
+ dst -= 4 * 4;
+ while (src >= aSrc) {
+- uint8x16_t px = vld1q_u16(reinterpret_cast<const uint16_t*>(src));
++ uint8x16_t px = vld1q_u8(src);
+ // G2R2B1G1 R1B0G0R0 -> X1R1G1B1 X0R0G0B0
+ uint8x8_t pxlo = vtbl1_u8(vget_low_u8(px), masklo);
+ // B3G3R3B2 G2R2B1G1 -> X3R3G3B3 X2R2G2B2
+ uint8x8_t pxhi =
+ vtbl1_u8(vext_u8(vget_low_u8(px), vget_high_u8(px), 4), maskhi);
+ px = vcombine_u8(pxlo, pxhi);
+ px = vorrq_u8(px, alpha);
+- vst1q_u16(reinterpret_cast<uint16_t*>(dst), px);
++ vst1q_u8(dst, px);
+ src -= 4 * 3;
+ dst -= 4 * 4;
+ }
+ }
+
+ // Force instantiation of swizzle variants here.
+ template void UnpackRowRGB24_NEON<false>(const uint8_t*, uint8_t*, int32_t);
+ template void UnpackRowRGB24_NEON<true>(const uint8_t*, uint8_t*, int32_t);
+
diff --git a/community/firefox/disable-moz-stackwalk.patch b/community/firefox/disable-moz-stackwalk.patch
new file mode 100644
index 0000000000..b6bc756d2b
--- /dev/null
+++ b/community/firefox/disable-moz-stackwalk.patch
@@ -0,0 +1,18 @@
+diff --git a/mozglue/misc/StackWalk.cpp b/mozglue/misc/StackWalk.cpp
+index 7d62921..adcfa44 100644
+--- a/mozglue/misc/StackWalk.cpp
++++ b/mozglue/misc/StackWalk.cpp
+@@ -33,13 +33,7 @@ using namespace mozilla;
+ # define MOZ_STACKWALK_SUPPORTS_MACOSX 0
+ #endif
+
+-#if (defined(linux) && \
+- ((defined(__GNUC__) && (defined(__i386) || defined(PPC))) || \
+- defined(HAVE__UNWIND_BACKTRACE)))
+-# define MOZ_STACKWALK_SUPPORTS_LINUX 1
+-#else
+ # define MOZ_STACKWALK_SUPPORTS_LINUX 0
+-#endif
+
+ #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)
+ # define HAVE___LIBC_STACK_END 1
diff --git a/community/firefox/fd6847c9416f9eebde636e21d794d25d1be8791d.patch b/community/firefox/fd6847c9416f9eebde636e21d794d25d1be8791d.patch
new file mode 100644
index 0000000000..1af68d93c6
--- /dev/null
+++ b/community/firefox/fd6847c9416f9eebde636e21d794d25d1be8791d.patch
@@ -0,0 +1,37 @@
+See https://bugzilla.mozilla.org/show_bug.cgi?id=1539739
+
+From fd6847c9416f9eebde636e21d794d25d1be8791d Mon Sep 17 00:00:00 2001
+From: Mike Hommey <mh@glandium.org>
+Date: Sat, 1 Jun 2019 09:06:01 +0900
+Subject: [PATCH] Bug 1526653 - Include struct definitions for user_vfp and
+ user_vfp_exc.
+
+---
+ js/src/wasm/WasmSignalHandlers.cpp | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/js/src/wasm/WasmSignalHandlers.cpp b/js/src/wasm/WasmSignalHandlers.cpp
+index 636537f8478..383c380f04c 100644
+--- a/js/src/wasm/WasmSignalHandlers.cpp
++++ b/js/src/wasm/WasmSignalHandlers.cpp
+@@ -248,7 +248,16 @@ using mozilla::DebugOnly;
+ #endif
+
+ #ifdef WASM_EMULATE_ARM_UNALIGNED_FP_ACCESS
+-# include <sys/user.h>
++struct user_vfp {
++ unsigned long long fpregs[32];
++ unsigned long fpscr;
++};
++
++struct user_vfp_exc {
++ unsigned long fpexc;
++ unsigned long fpinst;
++ unsigned long fpinst2;
++};
+ #endif
+
+ #if defined(ANDROID)
+--
+2.20.1
+
diff --git a/community/firefox/firefox-safe.desktop b/community/firefox/firefox-safe.desktop
new file mode 100644
index 0000000000..1538fc6748
--- /dev/null
+++ b/community/firefox/firefox-safe.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Exec=firefox -safe-mode %u
+Icon=firefox
+Type=Application
+Terminal=false
+MultipleArgs=false
+Name=Firefox - Safe Mode
+GenericName=Web Browser - Safe Mode
+StartupNotify=false
+Categories=Network;WebBrowser;
diff --git a/community/firefox/firefox.desktop b/community/firefox/firefox.desktop
new file mode 100644
index 0000000000..d048ce46c3
--- /dev/null
+++ b/community/firefox/firefox.desktop
@@ -0,0 +1,81 @@
+[Desktop Entry]
+Exec=firefox %u
+Icon=firefox
+Type=Application
+Terminal=false
+Name=Firefox
+Name[bn]=ফায়ারফক্স3
+Name[eo]=Fajrovulpo3
+Name[fi]=Firefox3
+Name[pa]=ਫਾਇਰਫੋਕਸ3
+Name[tg]=Рӯбоҳи оташин3
+GenericName=Web Browser
+GenericName[af]=Web Blaaier
+GenericName[ar]=متصفح ويب
+GenericName[az]=Veb Səyyahı
+GenericName[bg]=Браузър
+GenericName[bn]=ওয়েব ব্রাউজার
+GenericName[br]=Furcher ar Gwiad
+GenericName[bs]=WWW Preglednik
+GenericName[ca]=Fullejador web
+GenericName[cs]=WWW prohlížeč
+GenericName[cy]=Porydd Gwe
+GenericName[da]=Browser
+GenericName[de]=Web-Browser
+GenericName[el]=Περιηγητής Ιστού
+GenericName[eo]=TTT-legilo
+GenericName[es]=Navegador web
+GenericName[et]=Veebilehitseja
+GenericName[eu]=Web arakatzailea
+GenericName[fa]=مرورگر وب
+GenericName[fi]=WWW-selain
+GenericName[fo]=Alnótsfar
+GenericName[fr]=Navigateur web
+GenericName[gl]=Navegador Web
+GenericName[he]=דפדפן אינטרנט
+GenericName[hi]=वेब ब्राउज़र
+GenericName[hr]=Web preglednik
+GenericName[hu]=Webböngésző
+GenericName[is]=Vafri
+GenericName[it]=Browser Web
+GenericName[ja]=ウェブブラウザ
+GenericName[ko]=웹 브라우저
+GenericName[lo]=ເວັບບຣາວເຊີ
+GenericName[lt]=Žiniatinklio naršyklė
+GenericName[lv]=Web Pārlūks
+GenericName[mk]=Прелистувач на Интернет
+GenericName[mn]=Веб-Хөтөч
+GenericName[nb]=Nettleser
+GenericName[nds]=Nettkieker
+GenericName[nl]=Webbrowser
+GenericName[nn]=Nettlesar
+GenericName[nso]=Seinyakisi sa Web
+GenericName[pa]=ਵੈਬ ਝਲਕਾਰਾ
+GenericName[pl]=Przeglądarka WWW
+GenericName[pt]=Navegador Web
+GenericName[pt_BR]=Navegador Web
+GenericName[ro]=Navigator de web
+GenericName[ru]=Веб-браузер
+GenericName[se]=Fierpmádatlogan
+GenericName[sk]=Webový prehliadač
+GenericName[sl]=Spletni brskalnik
+GenericName[sr]=Веб претраживач
+GenericName[sr@Latn]=Veb pretraživač
+GenericName[ss]=Ibrawuza yeWeb
+GenericName[sv]=Webbläsare
+GenericName[ta]=வலை உலாவி
+GenericName[tg]=Тафсиргари вэб
+GenericName[th]=เว็บบราวเซอร์
+GenericName[tr]=Web Tarayıcı
+GenericName[uk]=Навігатор Тенет
+GenericName[uz]=Веб-браузер
+GenericName[ven]=Buronza ya Webu
+GenericName[vi]=Trình duyệt Web
+GenericName[wa]=Betchteu waibe
+GenericName[xh]=Umkhangeli zincwadi we Web
+GenericName[zh_CN]=网页浏览器
+GenericName[zh_TW]=網頁瀏覽器
+GenericName[zu]=Umcingi we-Web
+MimeType=text/html;
+StartupNotify=true
+Categories=Network;WebBrowser;
diff --git a/community/firefox/fix-fortify-system-wrappers.patch b/community/firefox/fix-fortify-system-wrappers.patch
new file mode 100644
index 0000000000..17cf7e303d
--- /dev/null
+++ b/community/firefox/fix-fortify-system-wrappers.patch
@@ -0,0 +1,13 @@
+The wrapper features.h gets pulled in by system headers causing thigns to
+break. We work around it by simply not wrap features.h
+
+--- ./config/system-headers.mozbuild.orig
++++ ./config/system-headers.mozbuild
+@@ -229,7 +229,6 @@
+ 'execinfo.h',
+ 'extras.h',
+ 'fcntl.h',
+- 'features.h',
+ 'fenv.h',
+ 'ffi.h',
+ 'fibdef.h',
diff --git a/community/firefox/fix-rust-target.patch b/community/firefox/fix-rust-target.patch
new file mode 100644
index 0000000000..14f39691cf
--- /dev/null
+++ b/community/firefox/fix-rust-target.patch
@@ -0,0 +1,31 @@
+Allow us to just set RUST_TARGEt ourselves instead of hacking around in mozilla's
+weird custom build system...
+
+--- a/build/moz.configure/rust.configure
++++ b/build/moz.configure/rust.configure
+@@ -224,6 +224,8 @@
+ rust_supported_targets, arm_target, when=rust_compiler)
+ @checking('for rust %s triplet' % host_or_target_str)
+ @imports('os')
++ @imports(_from='mozbuild.util', _import='ensure_unicode')
++ @imports(_from='mozbuild.util', _import='system_encoding')
+ @imports(_from='mozbuild.configure.util', _import='LineIO')
+ @imports(_from='mozbuild.shellutil', _import='quote')
+ @imports(_from='tempfile', _import='mkstemp')
+@@ -328,7 +330,7 @@
+
+ return None
+
+- rustc_target = find_candidate(candidates)
++ rustc_target = os.environ['RUST_TARGET']
+
+ if rustc_target is None:
+ die("Don't know how to translate {} for rustc".format(
+@@ -373,7 +375,7 @@
+ os.remove(out_path)
+
+ # This target is usable.
+- return rustc_target
++ return ensure_unicode(rustc_target, system_encoding)
+
+ return rust_target
diff --git a/community/firefox/fix-seccomp-bpf.patch b/community/firefox/fix-seccomp-bpf.patch
new file mode 100644
index 0000000000..de7bd175ee
--- /dev/null
+++ b/community/firefox/fix-seccomp-bpf.patch
@@ -0,0 +1,14 @@
+--- a/security/sandbox/chromium/sandbox/linux/seccomp-bpf/trap.cc 2018-12-14 08:53:46.083976137 +0000
++++ b/security/sandbox/chromium/sandbox/linux/seccomp-bpf/trap.cc 2018-12-14 08:51:22.084596411 +0000
+@@ -25,6 +25,11 @@
+ #include "sandbox/linux/system_headers/linux_seccomp.h"
+ #include "sandbox/linux/system_headers/linux_signal.h"
+
++// musl libc defines siginfo_t __si_fields instead of _sifields
++#if defined(OS_LINUX) && !defined(__GLIBC__)
++#define _sifields __si_fields
++#endif
++
+ namespace {
+
+ struct arch_sigsys {
diff --git a/community/firefox/fix-toolkit.patch b/community/firefox/fix-toolkit.patch
new file mode 100644
index 0000000000..414734dfec
--- /dev/null
+++ b/community/firefox/fix-toolkit.patch
@@ -0,0 +1,90 @@
+diff --git a/toolkit/crashreporter/google-breakpad/src/common/linux/dump_symbols.cc b/toolkit/crashreporter/google-breakpad/src/common/linux/dump_symbols.cc
+index 4222ce3..4d40c6a 100644
+--- a/toolkit/crashreporter/google-breakpad/src/common/linux/dump_symbols.cc
++++ b/toolkit/crashreporter/google-breakpad/src/common/linux/dump_symbols.cc
+@@ -46,6 +46,7 @@
+ #include <sys/mman.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
++#include <libgen.h>
+
+ #include <iostream>
+ #include <set>
+diff --git a/toolkit/crashreporter/google-breakpad/src/common/stabs_reader.cc b/toolkit/crashreporter/google-breakpad/src/common/stabs_reader.cc
+index 6019fc7..5953e32 100644
+--- a/toolkit/crashreporter/google-breakpad/src/common/stabs_reader.cc
++++ b/toolkit/crashreporter/google-breakpad/src/common/stabs_reader.cc
+@@ -41,6 +41,10 @@
+
+ #include "common/using_std_string.h"
+
++#ifndef N_UNDF
++#define N_UNDF 0
++#endif
++
+ using std::vector;
+
+ namespace google_breakpad {
+diff --git a/toolkit/crashreporter/google-breakpad/src/common/stabs_reader.h b/toolkit/crashreporter/google-breakpad/src/common/stabs_reader.h
+index 98ee2dd..d57aa68 100644
+--- a/toolkit/crashreporter/google-breakpad/src/common/stabs_reader.h
++++ b/toolkit/crashreporter/google-breakpad/src/common/stabs_reader.h
+@@ -55,7 +55,7 @@
+
+ #ifdef HAVE_MACH_O_NLIST_H
+ #include <mach-o/nlist.h>
+-#elif defined(HAVE_A_OUT_H)
++#elif 0
+ #include <a.out.h>
+ #endif
+
+diff --git a/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h b/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h
+index 93fdad7..f34e5e0 100644
+--- a/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h
++++ b/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h
+@@ -1239,6 +1239,12 @@ struct kernel_statfs {
+ #ifndef __NR_fallocate
+ #define __NR_fallocate 285
+ #endif
++
++#undef __NR_pread
++#define __NR_pread __NR_pread64
++#undef __NR_pwrite
++#define __NR_pwrite __NR_pwrite64
++
+ /* End of x86-64 definitions */
+ #elif defined(__mips__)
+ #if _MIPS_SIM == _MIPS_SIM_ABI32
+diff --git a/toolkit/mozapps/update/common/updatedefines.h b/toolkit/mozapps/update/common/updatedefines.h
+index 79276f7..4c67976 100644
+--- a/toolkit/mozapps/update/common/updatedefines.h
++++ b/toolkit/mozapps/update/common/updatedefines.h
+@@ -87,7 +87,7 @@ static inline int mywcsprintf(WCHAR* dest, size_t count, const WCHAR* fmt,
+
+ # ifdef SOLARIS
+ # include <sys/stat.h>
+-# else
++# elif !defined(__linux__) || defined(__GLIBC__)
+ # include <fts.h>
+ # endif
+ # include <dirent.h>
+diff --git a/toolkit/mozapps/update/updater/updater.cpp b/toolkit/mozapps/update/updater/updater.cpp
+index 257ccb4..01314e4 100644
+--- a/toolkit/mozapps/update/updater/updater.cpp
++++ b/toolkit/mozapps/update/updater/updater.cpp
+@@ -3978,6 +3978,7 @@
+
+ int add_dir_entries(const NS_tchar* dirpath, ActionList* list) {
+ int rv = OK;
++#if !defined(__linux__) || defined(__GLIBC__)
+ FTS* ftsdir;
+ FTSENT* ftsdirEntry;
+ mozilla::UniquePtr<NS_tchar[]> searchpath(get_full_path(dirpath));
+@@ -4085,6 +4086,7 @@
+ }
+
+ fts_close(ftsdir);
++#endif
+
+ return rv;
+ }
diff --git a/community/firefox/fix-tools.patch b/community/firefox/fix-tools.patch
new file mode 100644
index 0000000000..93b9d19c84
--- /dev/null
+++ b/community/firefox/fix-tools.patch
@@ -0,0 +1,37 @@
+diff --git a/tools/profiler/core/platform-linux-android.cpp b/tools/profiler/core/platform-linux-android.cpp
+index 19d0a5c56d..b64b543066 100644
+--- a/tools/profiler/core/platform-linux-android.cpp
++++ b/tools/profiler/core/platform-linux-android.cpp
+@@ -506,8 +506,10 @@ static void PlatformInit(PSLockRef aLock) {}
+ ucontext_t sSyncUContext;
+
+ void Registers::SyncPopulate() {
+- if (!getcontext(&sSyncUContext)) {
+- PopulateRegsFromContext(*this, &sSyncUContext);
+- }
++ #if defined(__GLIBC__)
++ if (!getcontext(&sSyncUContext)) {
++ PopulateRegsFromContext(*this, &sSyncUContext);
++ }
++ #endif
+ }
+ #endif
+diff --git a/tools/profiler/lul/LulElf.cpp b/tools/profiler/lul/LulElf.cpp
+index 9998d04d0d..348a7086fc 100644
+--- a/tools/profiler/lul/LulElf.cpp
++++ b/tools/profiler/lul/LulElf.cpp
+@@ -469,10 +469,10 @@ string FormatIdentifier(unsigned char identifier[16]) {
+ // Return the non-directory portion of FILENAME: the portion after the
+ // last slash, or the whole filename if there are no slashes.
+ string BaseFileName(const string& filename) {
+- // Lots of copies! basename's behavior is less than ideal.
+- char* c_filename = strdup(filename.c_str());
+- string base = basename(c_filename);
+- free(c_filename);
++ // basename's behavior is less than ideal so avoid it
++ const char *c_filename = filename.c_str();
++ const char *p = strrchr(c_filename, '/');
++ string base = p ? p+1 : c_filename;
+ return base;
+ }
+
diff --git a/community/firefox/fix-webrtc-glibcisms.patch b/community/firefox/fix-webrtc-glibcisms.patch
new file mode 100644
index 0000000000..658b076dc8
--- /dev/null
+++ b/community/firefox/fix-webrtc-glibcisms.patch
@@ -0,0 +1,20 @@
+--- ./media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features_linux.c.orig 2018-05-09 23:48:44.677389171 +0200
++++ ./media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features_linux.c 2018-05-09 23:48:56.254373557 +0200
+@@ -14,7 +14,7 @@
+ #ifndef __GLIBC_PREREQ
+ #define __GLIBC_PREREQ(a, b) 0
+ #endif
+-#if __GLIBC_PREREQ(2, 16)
++#if !__GLIBC__ || __GLIBC_PREREQ(2, 16)
+ #include <sys/auxv.h>
+ #else
+ #include <fcntl.h>
+@@ -32,7 +32,7 @@
+ int architecture = 0;
+ unsigned long hwcap = 0;
+ const char* platform = NULL;
+-#if __GLIBC_PREREQ(2, 16)
++#if !__GLIBC__ || __GLIBC_PREREQ(2, 16)
+ hwcap = getauxval(AT_HWCAP);
+ platform = (const char*)getauxval(AT_PLATFORM);
+ #else
diff --git a/community/firefox/mallinfo.patch b/community/firefox/mallinfo.patch
new file mode 100644
index 0000000000..7916a200ca
--- /dev/null
+++ b/community/firefox/mallinfo.patch
@@ -0,0 +1,20 @@
+diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp
+index 865e1b5430..9a00dafecb 100644
+--- a/xpcom/base/nsMemoryReporterManager.cpp
++++ b/xpcom/base/nsMemoryReporterManager.cpp
+@@ -124,6 +124,7 @@ static MOZ_MUST_USE nsresult ResidentUniqueDistinguishedAmount(int64_t* aN) {
+ return GetProcSelfSmapsPrivate(aN);
+ }
+
++#ifdef __GLIBC__
+ # ifdef HAVE_MALLINFO
+ # define HAVE_SYSTEM_HEAP_REPORTER 1
+ static MOZ_MUST_USE nsresult SystemHeapSize(int64_t* aSizeOut) {
+@@ -143,6 +144,7 @@ static MOZ_MUST_USE nsresult SystemHeapSize(int64_t* aSizeOut) {
+ return NS_OK;
+ }
+ # endif
++#endif
+
+ #elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
+ defined(__OpenBSD__) || defined(__FreeBSD_kernel__)
diff --git a/community/firefox/rust_audio-thread-priority.patch b/community/firefox/rust_audio-thread-priority.patch
new file mode 100644
index 0000000000..e3c64ddbbe
--- /dev/null
+++ b/community/firefox/rust_audio-thread-priority.patch
@@ -0,0 +1,39 @@
+backport of https://github.com/padenot/audio_thread_priority/commit/b5b86285d3c0cae2cb731730460f386ffa30cb03.patch
+avoids problems with serialization of RtPriorityThreadInfo in media/audioipc on musl
+
+--- a/third_party/rust/audio_thread_priority/src/rt_linux.rs 2019-12-02 13:24:01.000000000 +0100
++++ b/third_party/rust/audio_thread_priority/src/rt_linux.rs 2019-12-02 13:24:01.000000000 +0100
+@@ -31,9 +31,7 @@
+ /// process.
+ pthread_id: libc::pthread_t,
+ /// ...
+- policy: libc::c_int,
+- /// ...
+- param: libc::sched_param,
++ policy: libc::c_int
+ }
+
+ impl RtPriorityThreadInfoInternal {
+@@ -141,9 +139,11 @@
+ -> Result<(), ()> {
+ assert!(unsafe { libc::pthread_self() } == rt_priority_handle.thread_info.pthread_id);
+
++ let param = unsafe { std::mem::zeroed::<libc::sched_param>() };
++
+ if unsafe { libc::pthread_setschedparam(rt_priority_handle.thread_info.pthread_id,
+ rt_priority_handle.thread_info.policy,
+- &rt_priority_handle.thread_info.param) } < 0 {
++ &param) } < 0 {
+ error!("could not demote thread {}", OSError::last_os_error().raw_os_error().unwrap());
+ return Err(());
+ }
+@@ -187,8 +187,7 @@
+ pid,
+ thread_id,
+ pthread_id,
+- policy,
+- param
++ policy
+ })
+ }
+
diff --git a/community/firefox/stab.h b/community/firefox/stab.h
new file mode 100644
index 0000000000..6f70af3989
--- /dev/null
+++ b/community/firefox/stab.h
@@ -0,0 +1,71 @@
+/* $OpenBSD: stab.h,v 1.3 2003/06/02 19:34:12 millert Exp $ */
+/* $NetBSD: stab.h,v 1.4 1994/10/26 00:56:25 cgd Exp $ */
+
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)stab.h 5.2 (Berkeley) 4/4/91
+ */
+
+#ifndef _STAB_H_
+#define _STAB_H_
+
+/*
+ * The following are symbols used by various debuggers and by the Pascal
+ * compiler. Each of them must have one (or more) of the bits defined by
+ * the N_STAB mask set.
+ */
+
+#define N_GSYM 0x20 /* global symbol */
+#define N_FNAME 0x22 /* F77 function name */
+#define N_FUN 0x24 /* procedure name */
+#define N_STSYM 0x26 /* data segment variable */
+#define N_LCSYM 0x28 /* bss segment variable */
+#define N_MAIN 0x2a /* main function name */
+#define N_PC 0x30 /* global Pascal symbol */
+#define N_RSYM 0x40 /* register variable */
+#define N_SLINE 0x44 /* text segment line number */
+#define N_DSLINE 0x46 /* data segment line number */
+#define N_BSLINE 0x48 /* bss segment line number */
+#define N_SSYM 0x60 /* structure/union element */
+#define N_SO 0x64 /* main source file name */
+#define N_LSYM 0x80 /* stack variable */
+#define N_BINCL 0x82 /* include file beginning */
+#define N_SOL 0x84 /* included source file name */
+#define N_PSYM 0xa0 /* parameter variable */
+#define N_EINCL 0xa2 /* include file end */
+#define N_ENTRY 0xa4 /* alternate entry point */
+#define N_LBRAC 0xc0 /* left bracket */
+#define N_EXCL 0xc2 /* deleted include file */
+#define N_RBRAC 0xe0 /* right bracket */
+#define N_BCOMM 0xe2 /* begin common */
+#define N_ECOMM 0xe4 /* end common */
+#define N_ECOML 0xe8 /* end common (local name) */
+#define N_LENG 0xfe /* length of preceding entry */
+
+#endif /* !_STAB_H_ */
diff --git a/community/firefox/x86_64-alpine-linux-musl.json b/community/firefox/x86_64-alpine-linux-musl.json
new file mode 100644
index 0000000000..5062c38e7e
--- /dev/null
+++ b/community/firefox/x86_64-alpine-linux-musl.json
@@ -0,0 +1,35 @@
+{
+ "arch": "x86_64",
+ "cpu": "x86-64",
+ "crt-static-default": false,
+ "crt-static-respected": true,
+ "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
+ "dynamic-linking": true,
+ "env": "musl",
+ "executables": true,
+ "has-elf-tls": true,
+ "has-rpath": true,
+ "is-builtin": true,
+ "linker-flavor": "gcc",
+ "linker-is-gnu": true,
+ "llvm-target": "x86_64-unknown-linux-musl",
+ "max-atomic-width": 64,
+ "os": "linux",
+ "position-independent-executables": true,
+ "pre-link-args": {
+ "gcc": [
+ "-Wl,--as-needed",
+ "-Wl,-z,noexecstack",
+ "-Wl,--eh-frame-hdr",
+ "-m64"
+ ]
+ },
+ "relro-level": "full",
+ "stack-probes": true,
+ "target-c-int-width": "32",
+ "target-endian": "little",
+ "target-family": "unix",
+ "target-pointer-width": "64",
+ "vendor": "alpine"
+}
+