commit:     14bb75bbae34f7671c7dd622f7130d7580d0a226
Author:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
AuthorDate: Mon May  1 17:42:59 2023 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Mon May  1 17:49:44 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=14bb75bb

www-client/firefox: enable 'jumbo-build' for unified files

 - "jumbo-build" allows adjusting resource-usage on weaker hardware,
   e.g. x86 & arm. "Jumbo-build" has been default-enabled and should
   only be disabled to control resource usage, or if a build error
   happens.
 - making it possible to adjust FILES_PER_UNIFIED_FILE but going above
   the defaults always crashed the build for me.

Bug: https://bugs.gentoo.org/905431
Bug: https://bugs.gentoo.org/905262
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 www-client/firefox/firefox-112.0.2.ebuild | 20 +++++++++++++++++++-
 www-client/firefox/metadata.xml           |  1 +
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/www-client/firefox/firefox-112.0.2.ebuild 
b/www-client/firefox/firefox-112.0.2.ebuild
index b7c280646a74..9b8d6211fc3a 100644
--- a/www-client/firefox/firefox-112.0.2.ebuild
+++ b/www-client/firefox/firefox-112.0.2.ebuild
@@ -63,7 +63,7 @@ SLOT="rapid"
 LICENSE="MPL-2.0 GPL-2 LGPL-2.1"
 
 IUSE="+clang cpu_flags_arm_neon dbus debug eme-free hardened hwaccel"
-IUSE+=" jack libproxy lto +openh264 pgo pulseaudio sndio selinux"
+IUSE+=" jack +jumbo-build libproxy lto +openh264 pgo pulseaudio sndio selinux"
 IUSE+=" +system-av1 +system-harfbuzz +system-icu +system-jpeg +system-libevent 
+system-libvpx system-png system-python-libs +system-webp"
 IUSE+=" +telemetry wayland wifi +X"
 
@@ -664,8 +664,24 @@ src_prepare() {
                || die "sed failed to disable ccache stats call"
 
        einfo "Removing pre-built binaries ..."
+
        find "${S}"/third_party -type f \( -name '*.so' -o -name '*.o' \) 
-print -delete || die
 
+       # Respect choice for "jumbo-build"
+       # Changing the value for FILES_PER_UNIFIED_FILE may not work, see 
#905431
+       if use jumbo-build; then
+               local my_files_per_unified_file=${FILES_PER_UNIFIED_FILE:=16}
+               elog ""
+               elog "jumbo-build enabled with ${my_files_per_unified_file}."
+               elog "if you get a build failure, try -jumbo-build before 
opening a bug report."
+               elog ""
+
+               sed -i -e "s/\"FILES_PER_UNIFIED_FILE\", 
16/\"FILES_PER_UNIFIED_FILE\", "${my_files_per_unified_file}"/" 
python/mozbuild/mozbuild/frontend/data.py ||
+                       die "Failed to adjust FILES_PER_UNIFIED_FILE in 
python/mozbuild/mozbuild/frontend/data.py"
+               sed -i -e "s/FILES_PER_UNIFIED_FILE = 6/FILES_PER_UNIFIED_FILE 
= "${my_files_per_unified_file}"/" js/src/moz.build ||
+                       die "Failed to adjust FILES_PER_UNIFIED_FILE in 
js/src/moz.build"
+       fi
+
        # Create build dir
        BUILD_DIR="${WORKDIR}/${PN}_build"
        mkdir -p "${BUILD_DIR}" || die
@@ -873,6 +889,8 @@ src_configure() {
 
        mozconfig_use_enable wifi necko-wifi
 
+       ! use jumbo-build && mozconfig_add_options_ac '--disable-unified-build' 
--disable-unified-build
+
        if use X && use wayland ; then
                mozconfig_add_options_ac '+x11+wayland' 
--enable-default-toolkit=cairo-gtk3-x11-wayland
        elif ! use X && use wayland ; then

diff --git a/www-client/firefox/metadata.xml b/www-client/firefox/metadata.xml
index f1207e1b8b77..4da06e8a17fe 100644
--- a/www-client/firefox/metadata.xml
+++ b/www-client/firefox/metadata.xml
@@ -12,6 +12,7 @@
        <flag name="gmp-autoupdate">Allow Gecko Media Plugins (binary blobs) to 
be automatically
                downloaded and kept up-to-date in user profiles</flag>
        <flag name="hwaccel">Force-enable hardware-accelerated rendering 
(Mozilla bug 594876)</flag>
+       <flag name="jumbo-build">Enable unified build - combines source files 
to speed up build process, but requires more memory</flag>
        <flag name="libproxy">Enable libproxy support</flag>
        <flag name="lto">Enable Link Time Optimization (LTO)</flag>
        <flag name="openh264">Use <pkg>media-libs/openh264</pkg> for H264 
support

Reply via email to