Pier Angelo Vendrame pushed to branch main at The Tor Project / Applications / tor-browser-build Commits: 94a216c8 by Pier Angelo Vendrame at 2025-12-04T17:40:18+01:00 Bug 41648: Provide a custom mozconfig also for GeckoView. Instead of modifying a mozconfig we get from tor-browser.git with heredocs in build scripts, create a new mozconfig file, like we do for desktop Firefox. For consistency, change also the way we include Firefox to avoid a heredoc for it. - - - - - 8 changed files: - projects/firefox/build - projects/firefox/config - projects/firefox/mozconfig → projects/firefox/mozconfig.in - projects/geckoview/README.md - projects/geckoview/build - projects/geckoview/build_apk - projects/geckoview/config - + projects/geckoview/mozconfig.in Changes: ===================================== projects/firefox/build ===================================== @@ -62,9 +62,8 @@ tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.[% c('compress_ta mkdir -p $distdir/[% IF ! c("var/macos") %]Browser[% END %] cd /var/tmp/build/[% project %]-[% c("version") %] -cat > .mozconfig << 'MOZCONFIG_EOF' -[% INCLUDE mozconfig %] -MOZCONFIG_EOF +cp $rootdir/mozconfig ./ + [% IF c("var/asan") -%] # Without disabling LSan our build is blowing up: # https://bugs.torproject.org/10599#comment:52 ===================================== projects/firefox/config ===================================== @@ -165,6 +165,9 @@ targets: input_files: - project: container-image + - filename: 'mozconfig' + content: '[% INCLUDE "mozconfig.in" %]' + refresh_input: 1 - name: '[% c("var/compiler") %]' project: '[% c("var/compiler") %]' # Cross-binutils are already included in the cross-compiler ===================================== projects/firefox/mozconfig → projects/firefox/mozconfig.in ===================================== ===================================== projects/geckoview/README.md ===================================== @@ -4,41 +4,38 @@ tor-browser.git. # Custom ESR -Mozilla doesn't provide an ESR version for Firefox for Android, so it doesn't +Mozilla doesn't provide an ESR version of Firefox for Android, so it doesn't provide one for GeckoView as well. However, we decided to stay on the same version as desktop Firefox, and to backport the Android security bugs from the rapid release. Therefore, `geckoview` and `firefox` should always build from the same tree. -# "Fat" AARs +# Build steps -Theoretically, GeckoView is designed to be available also to products different -from Mozilla's browsers. -Therefore, Mozilla decided to -[provide a single AAR](https://bugzilla.mozilla.org/show_bug.cgi?id=1508976) -that targets all architectures, instead of one AAR for each architecture. +At a certain point, Mozilla migrated Android frontend code (_Fenix_) to +mozilla-central. Therefore, we now use only tor-browser.git. -Unifying AARs is a separate step, with its own `mozconfig`. -Therefore, we do it in a separate step, that runs the `merge_aars` script. +The build steps are: -Before Firefox 99, it was possible to use external AARs with the compile -environment turned off. -This configuration was not used by Mozilla and at a certain point they -[broke it](https://bugzilla.mozilla.org/show_bug.cgi?id=1763770). -The workaround is to use artifact builds, but we've never setup for our build -environment. -Instead, we've -[patched the build system](https://gitlab.torproject.org/tpo/applications/tor-browser/-/merge_requests/...) -in tor-browser.git. +1. Build GeckoView for each architecture +2. Merge the various architecture into a single "fat" AAR +3. Build Android Components +4. Build Fenix + +We run 1. in a dedicated step (`build`), since it's architecture-specific, then +we run the rest in a single RBM step (`build_apk`). + +We had to +[patch the build system](https://gitlab.torproject.org/tpo/applications/tor-browser/-/merge_requests/...) +in tor-browser.git to make this possible, as upstream relies on artifact builds +for this. +Instead, we disable the compile environment. Notice that it isn't necessary to include all the architectures Mozilla and us support (currently, aarch64, armv7 and x86_64). -The merge automation also supports "merging" one architecture. -We use this hack when `var/android_single_arch` is defined, which is the default -only in testbuilds. -The rationale is that we stay as close as possible to Mozilla for builds we -release to users, but we don't need to wait for all the architectures to build -for developer testbuilds. +We do it to stay as close as possible to Mozilla for builds we release to users, +but we do single-architecture builds in testbuilds, to reduce the time to make +them. # Java dependencies ===================================== projects/geckoview/build ===================================== @@ -14,28 +14,12 @@ export PATH="/var/tmp/dist/rust/bin:/var/tmp/dist/cbindgen:/var/tmp/dist/nasm/bi [% END -%] cd /var/tmp/build/[% project %]-[% c("version") %] -cat > .mozconfig << 'MOZCONFIG_EOF' -. $topsrcdir/mozconfig-[% c("var/osname") %] - -mk_add_options MOZ_PARALLEL_BUILD=[% c("num_procs") %] -export MOZ_INCLUDE_SOURCE_INFO=1 -export MOZ_SOURCE_REPO="[% c('var/gitlab_project') %]" -export MOZ_SOURCE_CHANGESET=[% c("var/git_commit") %] - -ac_add_options --enable-update-channel=[% c("var/variant") %] - -[% IF c("var/dev_artifacts") -%] - ac_add_options --enable-tests - # Necessary for package-tests step which expects dist/bin/jsapi-tests to exist. - ac_add_options --enable-js-shell -[% END -%] - -MOZCONFIG_EOF -echo "ac_add_options --with-branding=$branding_dir" >> .mozconfig +cp $rootdir/mozconfig ./ echo "Starting ./mach configure $(date)" ./mach configure \ --with-base-browser-version=[% c("var/torbrowser_version") %] \ + --with-branding=$branding_dir \ [% IF !c("var/rlbox") -%]--without-wasm-sandboxed-libraries[% END %] echo "Starting ./mach build $(date)" ===================================== projects/geckoview/build_apk ===================================== @@ -22,21 +22,13 @@ export MOZ_ANDROID_FAT_AAR_ARM64_V8A=$rootdir/[% c('input_files_by_name/geckovie export MOZ_ANDROID_FAT_AAR_X86_64=$rootdir/[% c('input_files_by_name/geckoview_x86_64') %]/geckoview/*.aar cd $builddir/[% project %]-[% c("version") %] -ln -s mozconfig-android-all .mozconfig -cat >> mozconfig-android-all << 'MOZCONFIG_EOF' -mk_add_options MOZ_PARALLEL_BUILD=[% c("num_procs") %] -export MOZ_INCLUDE_SOURCE_INFO=1 -export MOZ_SOURCE_REPO="[% c('var/gitlab_project') %]" -export MOZ_SOURCE_CHANGESET=[% c("var/git_commit") %] - -ac_add_options --enable-update-channel=[% c("var/variant") %] -MOZCONFIG_EOF -echo "ac_add_options --with-branding=$branding_dir" >> mozconfig-android-all - -# We still need to specify --tor-browser-version due to bug 34005. +cp $rootdir/mozconfig ./ + +# We still need to specify --base-browser-version due to bug 34005. ./mach configure \ --with-base-browser-version=[% c("var/torbrowser_version") %] \ --enable-update-channel=[% c("var/variant") %] \ + --with-branding=$branding_dir \ [% IF !c("var/rlbox") -%]--without-wasm-sandboxed-libraries[% END %] ./mach build --verbose ===================================== projects/geckoview/config ===================================== @@ -47,6 +47,7 @@ var: variant: beta has_l10n: '[% !c("var/testbuild") && !c("var/locales").empty %]' l10n-changesets: '[% exec("git --no-pager show " _ c("git_hash") _ ":browser/locales/l10n-changesets.json", { exec_noco => 1 }) %]' + mozconfig_file: 'mozconfig-[% c("var/osname") %]' targets: release: @@ -63,9 +64,14 @@ steps: filename: 'geckoview-[% c("version") %]-apks-[% c("var/build_id") %]' version: '[% c("abbrev") %]' build_apk: '[% INCLUDE build_apk %]' + var: + mozconfig_file: 'mozconfig-all' input_files: - project: container-image pkg_type: build + - filename: 'mozconfig' + content: '[% INCLUDE "mozconfig.in" %]' + refresh_input: 1 - name: '[% c("var/compiler") %]' project: '[% c("var/compiler") %]' pkg_type: build @@ -136,6 +142,9 @@ steps: input_files: - project: container-image + - filename: 'mozconfig' + content: '[% INCLUDE "mozconfig.in" %]' + refresh_input: 1 - name: '[% c("var/compiler") %]' project: '[% c("var/compiler") %]' - project: gradle ===================================== projects/geckoview/mozconfig.in ===================================== @@ -0,0 +1,14 @@ +. $topsrcdir/[% c("var/mozconfig_file") %] + +mk_add_options MOZ_PARALLEL_BUILD=[% c("num_procs") %] +export MOZ_INCLUDE_SOURCE_INFO=1 +export MOZ_SOURCE_REPO="[% c('var/gitlab_project') %]" +export MOZ_SOURCE_CHANGESET=[% c("var/git_commit") %] + +ac_add_options --enable-update-channel=[% c("var/variant") %] + +[% IF c("var/dev_artifacts") -%] + ac_add_options --enable-tests + # Necessary for package-tests step which expects dist/bin/jsapi-tests to exist. + ac_add_options --enable-js-shell +[% END -%] View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/94... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/94... You're receiving this email because of your account on gitlab.torproject.org.