From 765756d9101438a6e1eb82d68d1da96c6e2a4f53 Mon Sep 17 00:00:00 2001 From: Jeremy Huntwork Date: Fri, 21 Aug 2026 19:27:02 -0400 Subject: [PATCH] Add firefox 154.0 --- recipes/desktop/firefox/firefox.desktop | 13 ++ recipes/desktop/firefox/functional.patch | 13 ++ recipes/desktop/firefox/libcxx-fixes-1.patch | 70 +++++++++ recipes/desktop/firefox/recipe.kdl | 156 +++++++++++++++++++ 4 files changed, 252 insertions(+) create mode 100644 recipes/desktop/firefox/firefox.desktop create mode 100644 recipes/desktop/firefox/functional.patch create mode 100644 recipes/desktop/firefox/libcxx-fixes-1.patch create mode 100644 recipes/desktop/firefox/recipe.kdl diff --git a/recipes/desktop/firefox/firefox.desktop b/recipes/desktop/firefox/firefox.desktop new file mode 100644 index 00000000..f6e8b06d --- /dev/null +++ b/recipes/desktop/firefox/firefox.desktop @@ -0,0 +1,13 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Name=Firefox +GenericName=Web Browser +Comment=Browse the World Wide Web +Exec=firefox %u +Terminal=false +Icon=firefox +Categories=Network;WebBrowser; +MimeType=text/html;text/xml;application/xhtml+xml;application/xml;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/about; +StartupNotify=true +StartupWMClass=firefox diff --git a/recipes/desktop/firefox/functional.patch b/recipes/desktop/firefox/functional.patch new file mode 100644 index 00000000..faa1f2d1 --- /dev/null +++ b/recipes/desktop/firefox/functional.patch @@ -0,0 +1,13 @@ +--- a/config/gcc-stl-wrapper.template.h ++++ b/config/gcc-stl-wrapper.template.h +@@ -30,6 +30,10 @@ + // limits) and bug 1694575 (iosfwd). + // Please be careful when adding more exceptions, especially regarding + // the header not directly or indirectly including . ++#ifndef moz_dont_include_mozalloc_for_functional ++# define moz_dont_include_mozalloc_for_functional ++#endif ++ + #ifndef moz_dont_include_mozalloc_for_cstdlib + # define moz_dont_include_mozalloc_for_cstdlib + #endif diff --git a/recipes/desktop/firefox/libcxx-fixes-1.patch b/recipes/desktop/firefox/libcxx-fixes-1.patch new file mode 100644 index 00000000..9f2cc0d0 --- /dev/null +++ b/recipes/desktop/firefox/libcxx-fixes-1.patch @@ -0,0 +1,70 @@ +# Taken from https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=262598 +--- memory/mozalloc/throw_gcc.h.orig 2022-03-05 00:14:41 UTC ++++ memory/mozalloc/throw_gcc.h +@@ -74,50 +74,66 @@ __throw_bad_function_call(void) { + mozalloc_abort("fatal: STL threw bad_function_call"); + } + ++#if !defined(_LIBCPP_VERSION) + MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_logic_error( + const char* msg) { + mozalloc_abort(msg); + } ++#endif // _LIBCPP_VERSION + ++#if !defined(_LIBCPP_VERSION) + MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_domain_error( + const char* msg) { + mozalloc_abort(msg); + } ++#endif // _LIBCPP_VERSION + ++#if !defined(_LIBCPP_VERSION) + MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void + __throw_invalid_argument(const char* msg) { + mozalloc_abort(msg); + } ++#endif // _LIBCPP_VERSION + ++#if !defined(_LIBCPP_VERSION) + MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_length_error( + const char* msg) { + mozalloc_abort(msg); + } ++#endif // _LIBCPP_VERSION + ++#if !defined(_LIBCPP_VERSION) + MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_out_of_range( + const char* msg) { + mozalloc_abort(msg); + } ++#endif // _LIBCPP_VERSION + + MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_runtime_error( + const char* msg) { + mozalloc_abort(msg); + } + ++#if !defined(_LIBCPP_VERSION) + MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_range_error( + const char* msg) { + mozalloc_abort(msg); + } ++#endif // _LIBCPP_VERSION + ++#if !defined(_LIBCPP_VERSION) + MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void + __throw_overflow_error(const char* msg) { + mozalloc_abort(msg); + } ++#endif // _LIBCPP_VERSION + ++#if !defined(_LIBCPP_VERSION) + MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void + __throw_underflow_error(const char* msg) { + mozalloc_abort(msg); + } ++#endif // _LIBCPP_VERSION + + MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_ios_failure( + const char* msg) { diff --git a/recipes/desktop/firefox/recipe.kdl b/recipes/desktop/firefox/recipe.kdl new file mode 100644 index 00000000..4a297621 --- /dev/null +++ b/recipes/desktop/firefox/recipe.kdl @@ -0,0 +1,156 @@ +recipe { + name "firefox" + version "154.0" + release 1 + description "The Firefox web browser" + url "https://www.mozilla.org" + archs "x86_64" + licenses "MPL-2.0" + depends "alsa-lib" \ + "alsa-lib-dev" \ + "atk-dev" \ + "cairo-dev" \ + "cbindgen" \ + "expat-dev" \ + "fontconfig-dev" \ + "freetype-dev" \ + "fribidi-dev" \ + "gdk-pixbuf-dev" \ + "glib-dev" \ + "gtk+-dev" \ + "harfbuzz-dev" \ + "libclang" \ + "libdbus-dev" \ + "libepoxy-dev" \ + "libffi-dev" \ + "libjpeg-turbo-dev" \ + "libpng" \ + "libpng-dev" \ + "libpulse-dev" \ + "libvpx-dev" \ + "libxkbcommon-dev" \ + "linux-headers" \ + "llvm" \ + "llvm-dev" \ + "make" \ + "mimalloc-dev" \ + "musl-dev" \ + "nasm" \ + "nodejs" \ + "pango-dev" \ + "patch" \ + "pcre2-dev" \ + "pixman-dev" \ + "pkgconf" \ + "python" \ + "rust" \ + "shared-mime-info" \ + "wayland-dev" \ + "wayland-protocols-dev" \ + "zlib-ng-dev" +} + +source "https://archive.mozilla.org/pub/firefox/releases/${recipe.version}/source/firefox-${recipe.version}.source.tar.xz" { + blake3 "fa1958ec5596cbe02fbcb39040dd9b2da6341f4cc3e8770780d39131bfc02dc3" +} + +source "firefox.desktop" { + blake3 "628096d0022b6e564d0972a5a3282db9886a7714d2d46f5b96fadfd51f793698" +} + +prepare { + script r#" + # pid_t missing in libwebrtc desktop capture header + sed -i '1i #include ' \ + third_party/libwebrtc/modules/desktop_capture/desktop_capturer.h + + # libc++ requires explicit construction, not brace init with non-aggregates + sed -i 's/push_back({/emplace_back(Source{/g' \ + third_party/libwebrtc/modules/desktop_capture/fake_desktop_capturer.cc + + # musl: sys/prctl.h and linux/prctl.h both define prctl_mm_map + sed -i '/#include /d' \ + third_party/libwebrtc/rtc_base/platform_thread_types.cc + + # Allow static libc++ linking — safe on mere where everything + # is built with the same toolchain + sed -i '/Firefox does not support linking statically/s@die.*@return True@' \ + build/moz.configure/toolchain.configure \ + build/moz.configure/flags.configure + "# +} + +build { + script r#" + export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=system + export MOZ_NOSPAM=1 + export MOZBUILD_STATE_PATH="${PWD}/.mozbuild" + export CXXSTDLIB=c++ + export LDFLAGS="-Wl,-rpath=/usr/lib/firefox,--enable-new-dtags -static-libstdc++" + + cat > .mozconfig << 'EOF' +ac_add_options --prefix=/usr +ac_add_options --libdir=/usr/lib +ac_add_options --host=${recipe.arch}-unknown-linux-musl +ac_add_options --target=${recipe.arch}-unknown-linux-musl +ac_add_options --disable-crashreporter +ac_add_options --disable-debug +ac_add_options --disable-debug-symbols +ac_add_options --disable-jemalloc +ac_add_options --disable-necko-wifi +ac_add_options --disable-profiling +ac_add_options --disable-tests +ac_add_options --disable-updater +ac_add_options --enable-audio-backends=pulseaudio,alsa +ac_add_options --enable-application=browser +ac_add_options --enable-dbus +ac_add_options --enable-default-toolkit=cairo-gtk3-wayland +ac_add_options --enable-official-branding +ac_add_options --enable-optimize +ac_add_options --enable-release +ac_add_options --enable-rust-simd +ac_add_options --with-system-ffi +ac_add_options --with-system-jpeg +ac_add_options --with-system-libvpx +ac_add_options --with-system-pixman +ac_add_options --with-system-png +ac_add_options --with-system-zlib +ac_add_options --with-libclang-path=/usr/lib +ac_add_options --without-wasm-sandboxed-libraries + +mk_add_options MOZ_CRASHREPORTER=0 +mk_add_options MOZ_DATA_REPORTING=0 +mk_add_options MOZ_SERVICES_HEALTHREPORT=0 +mk_add_options MOZ_TELEMETRY_REPORTING=0 +EOF + ./mach build + "# +} + +install { + script r#" + ./mach install + + install -Dm644 "${MERE_SOURCES_DIR}/firefox.desktop" \ + "${DESTDIR}/usr/share/applications/firefox.desktop" + + # Install desktop entries. + for size in 16 32 48 64 128; do + install -Dm644 \ + "${DESTDIR}/usr/lib/firefox/browser/chrome/icons/default/default${size}.png" \ + "${DESTDIR}/usr/share/icons/hicolor/${size}x${size}/apps/firefox.png" + done + + # musl: never auto-download Cisco's glibc OpenH264 GMP (it can't load + # on musl and shadows the system musl build in gmp-gmpopenh264/). The + # gmpopenh264 package ships the working plugin; keep the bundled one. + install -Dm644 /dev/stdin \ + "${DESTDIR}/usr/lib/firefox/browser/defaults/preferences/mere.js" << 'EOF' +pref("media.gmp-gmpopenh264.autoupdate", false); +EOF + "# +} + +package "firefox" { + files "usr/" +}