From 5f11338be00c5ca90a07bcc4fc8579d581ff2c4e Mon Sep 17 00:00:00 2001 From: celenity Date: Tue, 24 Feb 2026 06:34:17 +0000 Subject: [PATCH] fix-up - II Signed-off-by: celenity --- patches/fenix-disable-debug-signing.patch | 13 + .../mozconfigs/ironfox-nightly-arm.mozconfig | 1 + .../ironfox-nightly-arm64.mozconfig | 1 + .../ironfox-nightly-bundle.mozconfig | 7 +- .../ironfox-nightly-x86_64.mozconfig | 1 + .../mozconfigs/ironfox-release-arm.mozconfig | 1 + .../ironfox-release-arm64.mozconfig | 1 + .../ironfox-release-bundle.mozconfig | 7 +- .../ironfox-release-x86_64.mozconfig | 1 + .../ironfox/mozconfigs/no-build.mozconfig | 9 + .../projects/android-components.mozconfig | 4 + .../mozconfigs/projects/fenix.mozconfig | 10 + .../mozconfigs/projects/gecko.mozconfig | 6 + .../mozconfigs/targets/common.mozconfig | 17 +- .../mozconfigs/targets/x86_64.mozconfig | 7 +- scripts/build-if.sh | 257 +++++++++++------- scripts/env_common.sh | 53 ++-- scripts/get_sources-if.sh | 2 +- scripts/patches.yaml | 7 + 19 files changed, 280 insertions(+), 125 deletions(-) create mode 100644 patches/fenix-disable-debug-signing.patch create mode 100644 patches/gecko-overlay/ironfox/mozconfigs/no-build.mozconfig create mode 100644 patches/gecko-overlay/ironfox/mozconfigs/projects/android-components.mozconfig create mode 100644 patches/gecko-overlay/ironfox/mozconfigs/projects/fenix.mozconfig create mode 100644 patches/gecko-overlay/ironfox/mozconfigs/projects/gecko.mozconfig diff --git a/patches/fenix-disable-debug-signing.patch b/patches/fenix-disable-debug-signing.patch new file mode 100644 index 00000000..9fc264f9 --- /dev/null +++ b/patches/fenix-disable-debug-signing.patch @@ -0,0 +1,13 @@ +diff --git a/mobile/android/fenix/app/build.gradle b/mobile/android/fenix/app/build.gradle +index 1b27020a20ee7..e793f03573c9d 100644 +--- a/mobile/android/fenix/app/build.gradle ++++ b/mobile/android/fenix/app/build.gradle +@@ -118,7 +118,7 @@ android { + + // If building locally, just use debug signing. In official automation builds, the + // files are signed using a separate service and not within gradle. +- if (!gradle.mozconfig.substs.MOZ_AUTOMATION) { ++ if (false) { + signingConfig = signingConfigs.debug + } + diff --git a/patches/gecko-overlay/ironfox/mozconfigs/ironfox-nightly-arm.mozconfig b/patches/gecko-overlay/ironfox/mozconfigs/ironfox-nightly-arm.mozconfig index 607a1383..2e34dbf8 100644 --- a/patches/gecko-overlay/ironfox/mozconfigs/ironfox-nightly-arm.mozconfig +++ b/patches/gecko-overlay/ironfox/mozconfigs/ironfox-nightly-arm.mozconfig @@ -1,3 +1,4 @@ +# IronFox - Nightly (ARM) mozconfig . "$topsrcdir/ironfox/mozconfigs/core.mozconfig" . "$topsrcdir/ironfox/mozconfigs/branding/ironfox-nightly.mozconfig" diff --git a/patches/gecko-overlay/ironfox/mozconfigs/ironfox-nightly-arm64.mozconfig b/patches/gecko-overlay/ironfox/mozconfigs/ironfox-nightly-arm64.mozconfig index c687e8d2..918a79ad 100644 --- a/patches/gecko-overlay/ironfox/mozconfigs/ironfox-nightly-arm64.mozconfig +++ b/patches/gecko-overlay/ironfox/mozconfigs/ironfox-nightly-arm64.mozconfig @@ -1,3 +1,4 @@ +# IronFox - Nightly (ARM64) mozconfig . "$topsrcdir/ironfox/mozconfigs/core.mozconfig" . "$topsrcdir/ironfox/mozconfigs/branding/ironfox-nightly.mozconfig" diff --git a/patches/gecko-overlay/ironfox/mozconfigs/ironfox-nightly-bundle.mozconfig b/patches/gecko-overlay/ironfox/mozconfigs/ironfox-nightly-bundle.mozconfig index cb3762c1..77df0062 100644 --- a/patches/gecko-overlay/ironfox/mozconfigs/ironfox-nightly-bundle.mozconfig +++ b/patches/gecko-overlay/ironfox/mozconfigs/ironfox-nightly-bundle.mozconfig @@ -1,3 +1,4 @@ +# IronFox - Nightly (Bundle) mozconfig . "$topsrcdir/ironfox/mozconfigs/core.mozconfig" . "$topsrcdir/ironfox/mozconfigs/branding/ironfox-nightly.mozconfig" @@ -5,13 +6,13 @@ # To create a bundle, we first need to produce a GeckoView AAR for each architecture... # 1. ARM64 -if [ "${IRONFOX_GV_AAR_BUILT_ARM64}" != 1 ]; then +if [ "${IRONFOX_MACH_TARGET_BUNDLE_ARM64}" == 1 ]; then . "$topsrcdir/ironfox/mozconfigs/ironfox-nightly-arm64.mozconfig" # 2. ARM -elif [ "${IRONFOX_GV_AAR_BUILT_ARM}" != 1 ]; then +elif [ "${IRONFOX_MACH_TARGET_BUNDLE_ARM}" == 1 ]; then . "$topsrcdir/ironfox/mozconfigs/ironfox-nightly-arm.mozconfig" # 3. x86_64 -elif [ "${IRONFOX_GV_AAR_BUILT_X86_64}" != 1 ]; then +elif [ "${IRONFOX_MACH_TARGET_BUNDLE_X86_64}" == 1 ]; then . "$topsrcdir/ironfox/mozconfigs/ironfox-nightly-x86_64.mozconfig" else . "$topsrcdir/ironfox/mozconfigs/targets/bundle.mozconfig" diff --git a/patches/gecko-overlay/ironfox/mozconfigs/ironfox-nightly-x86_64.mozconfig b/patches/gecko-overlay/ironfox/mozconfigs/ironfox-nightly-x86_64.mozconfig index 11d84a83..5e62bc24 100644 --- a/patches/gecko-overlay/ironfox/mozconfigs/ironfox-nightly-x86_64.mozconfig +++ b/patches/gecko-overlay/ironfox/mozconfigs/ironfox-nightly-x86_64.mozconfig @@ -1,3 +1,4 @@ +# IronFox - Nightly (x86_64) mozconfig . "$topsrcdir/ironfox/mozconfigs/core.mozconfig" . "$topsrcdir/ironfox/mozconfigs/branding/ironfox-nightly.mozconfig" diff --git a/patches/gecko-overlay/ironfox/mozconfigs/ironfox-release-arm.mozconfig b/patches/gecko-overlay/ironfox/mozconfigs/ironfox-release-arm.mozconfig index d757decf..66540f1b 100644 --- a/patches/gecko-overlay/ironfox/mozconfigs/ironfox-release-arm.mozconfig +++ b/patches/gecko-overlay/ironfox/mozconfigs/ironfox-release-arm.mozconfig @@ -1,3 +1,4 @@ +# IronFox - Release (ARM) mozconfig . "$topsrcdir/ironfox/mozconfigs/core.mozconfig" . "$topsrcdir/ironfox/mozconfigs/branding/ironfox.mozconfig" diff --git a/patches/gecko-overlay/ironfox/mozconfigs/ironfox-release-arm64.mozconfig b/patches/gecko-overlay/ironfox/mozconfigs/ironfox-release-arm64.mozconfig index bbf2b7d3..fbf66cc9 100644 --- a/patches/gecko-overlay/ironfox/mozconfigs/ironfox-release-arm64.mozconfig +++ b/patches/gecko-overlay/ironfox/mozconfigs/ironfox-release-arm64.mozconfig @@ -1,3 +1,4 @@ +# IronFox - Release (ARM64) mozconfig . "$topsrcdir/ironfox/mozconfigs/core.mozconfig" . "$topsrcdir/ironfox/mozconfigs/branding/ironfox.mozconfig" diff --git a/patches/gecko-overlay/ironfox/mozconfigs/ironfox-release-bundle.mozconfig b/patches/gecko-overlay/ironfox/mozconfigs/ironfox-release-bundle.mozconfig index 44fb07cf..42bfa9ae 100644 --- a/patches/gecko-overlay/ironfox/mozconfigs/ironfox-release-bundle.mozconfig +++ b/patches/gecko-overlay/ironfox/mozconfigs/ironfox-release-bundle.mozconfig @@ -1,3 +1,4 @@ +# IronFox - Release (Bundle) mozconfig . "$topsrcdir/ironfox/mozconfigs/core.mozconfig" . "$topsrcdir/ironfox/mozconfigs/branding/ironfox.mozconfig" @@ -5,13 +6,13 @@ # To create a bundle, we first need to produce a GeckoView AAR for each architecture... # 1. ARM64 -if [ "${IRONFOX_GV_AAR_BUILT_ARM64}" != 1 ]; then +if [ "${IRONFOX_MACH_TARGET_BUNDLE_ARM64}" == 1 ]; then . "$topsrcdir/ironfox/mozconfigs/ironfox-release-arm64.mozconfig" # 2. ARM -elif [ "${IRONFOX_GV_AAR_BUILT_ARM}" != 1 ]; then +elif [ "${IRONFOX_MACH_TARGET_BUNDLE_ARM}" == 1 ]; then . "$topsrcdir/ironfox/mozconfigs/ironfox-release-arm.mozconfig" # 3. x86_64 -elif [ "${IRONFOX_GV_AAR_BUILT_X86_64}" != 1 ]; then +elif [ "${IRONFOX_MACH_TARGET_BUNDLE_X86_64}" == 1 ]; then . "$topsrcdir/ironfox/mozconfigs/ironfox-release-x86_64.mozconfig" else . "$topsrcdir/ironfox/mozconfigs/targets/bundle.mozconfig" diff --git a/patches/gecko-overlay/ironfox/mozconfigs/ironfox-release-x86_64.mozconfig b/patches/gecko-overlay/ironfox/mozconfigs/ironfox-release-x86_64.mozconfig index 5c7404b8..fd5675a5 100644 --- a/patches/gecko-overlay/ironfox/mozconfigs/ironfox-release-x86_64.mozconfig +++ b/patches/gecko-overlay/ironfox/mozconfigs/ironfox-release-x86_64.mozconfig @@ -1,3 +1,4 @@ +# IronFox - Release (x86_64) mozconfig . "$topsrcdir/ironfox/mozconfigs/core.mozconfig" . "$topsrcdir/ironfox/mozconfigs/branding/ironfox.mozconfig" diff --git a/patches/gecko-overlay/ironfox/mozconfigs/no-build.mozconfig b/patches/gecko-overlay/ironfox/mozconfigs/no-build.mozconfig new file mode 100644 index 00000000..495136a0 --- /dev/null +++ b/patches/gecko-overlay/ironfox/mozconfigs/no-build.mozconfig @@ -0,0 +1,9 @@ +# IronFox "no-build" mozconfig + +# If Gecko is built, but not packaged, then disable the compile environment - we don't want to build anything at this point +ac_add_options --disable-compile-environment + +# Disable checks for runtime dependencies +## (Needed to prevent failures) +ac_add_options --without-embedded-uniffi-bindgen +ac_add_options --without-nimbus-fml diff --git a/patches/gecko-overlay/ironfox/mozconfigs/projects/android-components.mozconfig b/patches/gecko-overlay/ironfox/mozconfigs/projects/android-components.mozconfig new file mode 100644 index 00000000..c08a294b --- /dev/null +++ b/patches/gecko-overlay/ironfox/mozconfigs/projects/android-components.mozconfig @@ -0,0 +1,4 @@ +# IronFox Android Components mozconfig + +# Ensure MOZ_AUTOMATION isn't set here +unset MOZ_AUTOMATION diff --git a/patches/gecko-overlay/ironfox/mozconfigs/projects/fenix.mozconfig b/patches/gecko-overlay/ironfox/mozconfigs/projects/fenix.mozconfig new file mode 100644 index 00000000..61f16c1c --- /dev/null +++ b/patches/gecko-overlay/ironfox/mozconfigs/projects/fenix.mozconfig @@ -0,0 +1,10 @@ +# IronFox Fenix mozconfig + +# Ensure MOZ_AUTOMATION isn't set here to start +unset MOZ_AUTOMATION + +# When building Fenix, if IRONFOX_SIGN is set, we need to set MOZ_AUTOMATION to prevent outputs from being automatically signed with a debug key +## https://searchfox.org/firefox-main/rev/eea0f8f0/mobile/android/fenix/app/build.gradle#114 +if [ "${IRONFOX_SIGN}" == 1 ]; then + export MOZ_AUTOMATION=1 +fi diff --git a/patches/gecko-overlay/ironfox/mozconfigs/projects/gecko.mozconfig b/patches/gecko-overlay/ironfox/mozconfigs/projects/gecko.mozconfig new file mode 100644 index 00000000..026be65b --- /dev/null +++ b/patches/gecko-overlay/ironfox/mozconfigs/projects/gecko.mozconfig @@ -0,0 +1,6 @@ +# IronFox Gecko(View) mozconfig + +# If we're doing a build, ensure MOZ_AUTOMATION isn't set here +if [ "${IRONFOX_MACH_BUILD}" == 1 ]; then + unset MOZ_AUTOMATION +fi diff --git a/patches/gecko-overlay/ironfox/mozconfigs/targets/common.mozconfig b/patches/gecko-overlay/ironfox/mozconfigs/targets/common.mozconfig index 87378da0..06183ae4 100644 --- a/patches/gecko-overlay/ironfox/mozconfigs/targets/common.mozconfig +++ b/patches/gecko-overlay/ironfox/mozconfigs/targets/common.mozconfig @@ -1,6 +1,17 @@ -if [ "${IRONFOX_GECKO_BUILT}" == 1 ] && [ "${IRONFOX_GECKO_PACKAGED}" != 1 ]; then - # If Gecko is built, but not packaged, then disable the compile environment - we don't want to build anything at this point - ac_add_options --disable-compile-environment +# IronFox "common" mozconfig + +# Do we want Mach to actually build *something*? +if [ "${IRONFOX_MACH_BUILD}" != 1 ]; then + . "$topsrcdir/ironfox/mozconfigs/no-build.mozconfig" else . "$topsrcdir/ironfox/mozconfigs/build.mozconfig" fi + +# Set project-specific options +if [ "${IRONFOX_MACH_TARGET_AC}" == 1 ]; then + . "$topsrcdir/ironfox/mozconfigs/projects/android-components.mozconfig" +elif [ "${IRONFOX_MACH_TARGET_FENIX}" == 1 ]; then + . "$topsrcdir/ironfox/mozconfigs/projects/fenix.mozconfig" +elif [ "${IRONFOX_MACH_TARGET_GECKO}" == 1 ]; then + . "$topsrcdir/ironfox/mozconfigs/projects/gecko.mozconfig" +fi diff --git a/patches/gecko-overlay/ironfox/mozconfigs/targets/x86_64.mozconfig b/patches/gecko-overlay/ironfox/mozconfigs/targets/x86_64.mozconfig index ba5d9c43..4d5f5c06 100644 --- a/patches/gecko-overlay/ironfox/mozconfigs/targets/x86_64.mozconfig +++ b/patches/gecko-overlay/ironfox/mozconfigs/targets/x86_64.mozconfig @@ -7,5 +7,8 @@ ac_add_options --target='x86_64-linux-android' ac_add_options --enable-wasm-avx ac_add_options --enable-wasm-relaxed-simd ac_add_options --enable-wasm-simd -export RUSTDOCFLAGS="${RUSTDOCFLAGS} -Ctarget-feature=+avx" -export RUSTFLAGS="${RUSTFLAGS} -Ctarget-feature=+avx" + +if [ "${IRONFOX_MACH_BUILD}" == 1 ]; then + export RUSTDOCFLAGS="${RUSTDOCFLAGS} -Ctarget-feature=+avx" + export RUSTFLAGS="${RUSTFLAGS} -Ctarget-feature=+avx" +fi diff --git a/scripts/build-if.sh b/scripts/build-if.sh index eda6b55b..9a5458b7 100755 --- a/scripts/build-if.sh +++ b/scripts/build-if.sh @@ -36,7 +36,7 @@ if [ -z "${1+x}" ]; then exit 1 fi -# Set up target parameters +# Set-up target parameters case "$1" in arm64) # arm64-v8a @@ -384,25 +384,26 @@ function build_as() { function build_gecko_ind() { # Build Gecko + unset IRONFOX_MACH_BUILD unset MOZ_CHROME_MULTILOCALE - export IRONFOX_GECKO_BUILT=0 - export IRONFOX_GECKO_PACKAGED=0 + export IRONFOX_MACH_BUILD=1 pushd "${IRONFOX_GECKO}" "${IRONFOX_MACH}" configure "${IRONFOX_MACH}" build popd - - export IRONFOX_GECKO_BUILT=1 } function package_gecko() { # Package Gecko + unset IRONFOX_MACH_BUILD + export IRONFOX_MACH_BUILD=0 pushd "${IRONFOX_GECKO}" + "${IRONFOX_MACH}" configure # We don't want to clean Gradle here on bundle builds, because doing so will cause it to clean after each architecture is built... if [ "${IRONFOX_TARGET_ARCH}" != 'bundle' ]; then - "${IRONFOX_GRADLE}" ${IRONFOX_GRADLE_FLAGS} -Pofficial geckoview:clean + "${IRONFOX_MACH}" gradle geckoview:clean fi echo_green_text "Running ${IRONFOX_MACH} package..." @@ -419,14 +420,13 @@ function package_gecko() { MOZ_AUTOMATION=1 "${IRONFOX_MACH}" android archive-geckoview unset MOZ_AUTOMATION popd - - export IRONFOX_GECKO_PACKAGED=1 } # Create our fat GeckoView AAR... function create_fat_aar() { # Fat AAR - export IRONFOX_GECKO_PACKAGED=0 + unset IRONFOX_MACH_BUILD + export IRONFOX_MACH_BUILD=0 pushd "${IRONFOX_GECKO}" "${IRONFOX_MACH}" configure @@ -436,6 +436,9 @@ function create_fat_aar() { function build_gecko_arm64() { # ARM64 + unset IRONFOX_MACH_TARGET_BUNDLE_ARM64 + export IRONFOX_MACH_TARGET_BUNDLE_ARM64=1 + pushd "${IRONFOX_GECKO}" echo_red_text 'Building Gecko(View) - ARM64...' build_gecko_ind @@ -447,17 +450,19 @@ function build_gecko_arm64() { popd cp -vf "${IRONFOX_GV_AAR_ARM64}" "${IRONFOX_OUTPUTS_GV_AAR_ARM64}" - export IRONFOX_GV_AAR_BUILT_ARM64=1 if [ "${IRONFOX_CI}" == 1 ]; then cp -vf "${IRONFOX_OUTPUTS_GV_AAR_ARM64}" "${IRONFOX_AAR_ARTIFACTS}/" fi + unset IRONFOX_MACH_TARGET_BUNDLE_ARM64 + export IRONFOX_MACH_TARGET_BUNDLE_ARM64=0 } function build_gecko_arm() { - export IRONFOX_GV_AAR_BUILT_ARM64=1 - # ARM + unset IRONFOX_MACH_TARGET_BUNDLE_ARM + export IRONFOX_MACH_TARGET_BUNDLE_ARM=1 + pushd "${IRONFOX_GECKO}" echo_red_text 'Building Gecko(View) - ARM...' build_gecko_ind @@ -469,18 +474,19 @@ function build_gecko_arm() { popd cp -vf "${IRONFOX_GV_AAR_ARM}" "${IRONFOX_OUTPUTS_GV_AAR_ARM}" - export IRONFOX_GV_AAR_BUILT_ARM=1 if [ "${IRONFOX_CI}" == 1 ]; then cp -vf "${IRONFOX_OUTPUTS_GV_AAR_ARM}" "${IRONFOX_AAR_ARTIFACTS}/" fi + unset IRONFOX_MACH_TARGET_BUNDLE_ARM + export IRONFOX_MACH_TARGET_BUNDLE_ARM=0 } function build_gecko_x86_64() { - export IRONFOX_GV_AAR_BUILT_ARM64=1 - export IRONFOX_GV_AAR_BUILT_ARM=1 - # x86_64 + unset IRONFOX_MACH_TARGET_BUNDLE_X86_64 + export IRONFOX_MACH_TARGET_BUNDLE_X86_64=1 + pushd "${IRONFOX_GECKO}" echo_red_text 'Building Gecko(View) - x86_64...' build_gecko_ind @@ -489,10 +495,12 @@ function build_gecko_x86_64() { echo_red_text 'Packaging Gecko(View) - x86_64...' package_gecko echo_green_text 'SUCCESS: Packaged Gecko(View) - x86_64' + unset IRONFOX_MACH_TARGET_BUNDLE_X86_64 + export IRONFOX_MACH_TARGET_BUNDLE_X86_64=0 + "${IRONFOX_MACH}" configure popd cp -vf "${IRONFOX_GV_AAR_X86_64}" "${IRONFOX_OUTPUTS_GV_AAR_X86_64}" - export IRONFOX_GV_AAR_BUILT_X86_64=1 if [ "${IRONFOX_CI}" == 1 ]; then cp -vf "${IRONFOX_OUTPUTS_GV_AAR_X86_64}" "${IRONFOX_AAR_ARTIFACTS}/" @@ -500,10 +508,6 @@ function build_gecko_x86_64() { } function build_gecko_bundle() { - export IRONFOX_GV_AAR_BUILT_ARM64=1 - export IRONFOX_GV_AAR_BUILT_ARM=1 - export IRONFOX_GV_AAR_BUILT_X86_64=1 - # Bundle export MOZ_ANDROID_FAT_AAR_ARCHITECTURES='arm64-v8a,armeabi-v7a,x86_64' @@ -532,17 +536,85 @@ function build_gecko_bundle() { popd } +function clobber_gecko_arm64() { + # Clobber Gecko (ARM64) + unset IRONFOX_MACH_TARGET_BUNDLE_ARM64 + export IRONFOX_MACH_TARGET_BUNDLE_ARM64=1 + + pushd "${IRONFOX_GECKO}" + "${IRONFOX_MACH}" configure + "${IRONFOX_MACH}" clobber + unset IRONFOX_MACH_TARGET_BUNDLE_ARM64 + export IRONFOX_MACH_TARGET_BUNDLE_ARM64=0 + "${IRONFOX_MACH}" configure + popd +} + +function clobber_gecko_arm() { + # Clobber Gecko (ARM) + unset IRONFOX_MACH_TARGET_BUNDLE_ARM + export IRONFOX_MACH_TARGET_BUNDLE_ARM=1 + + pushd "${IRONFOX_GECKO}" + "${IRONFOX_MACH}" configure + "${IRONFOX_MACH}" clobber + unset IRONFOX_MACH_TARGET_BUNDLE_ARM + export IRONFOX_MACH_TARGET_BUNDLE_ARM=0 + "${IRONFOX_MACH}" configure + popd +} + +function clobber_gecko_x86_64() { + # Clobber Gecko (x86_64) + unset IRONFOX_MACH_TARGET_BUNDLE_X86_64 + export IRONFOX_MACH_TARGET_BUNDLE_X86_64=1 + + pushd "${IRONFOX_GECKO}" + "${IRONFOX_MACH}" configure + "${IRONFOX_MACH}" clobber + unset IRONFOX_MACH_TARGET_BUNDLE_X86_64 + export IRONFOX_MACH_TARGET_BUNDLE_X86_64=0 + "${IRONFOX_MACH}" configure + popd +} + +function clobber_gecko() { + "${IRONFOX_MACH}" configure + "${IRONFOX_MACH}" clobber + if [ "${IRONFOX_TARGET_ARCH}" == 'bundle' ] && [ "${IRONFOX_CI}" != 1 ]; then + clobber_gecko_arm64 + clobber_gecko_arm + clobber_gecko_x86_64 + fi +} + function build_gecko() { # Gecko (Firefox) echo_red_text 'Building Gecko(View)...' + unset IRONFOX_MACH_TARGET_GECKO + export IRONFOX_MACH_TARGET_GECKO=1 pushd "${IRONFOX_GECKO}" "${IRONFOX_MACH}" configure # Always clobber to ensure that builds are fresh - "${IRONFOX_MACH}" clobber + clobber_gecko - if [ "${IRONFOX_TARGET_ARCH}" == 'bundle' ]; then + if [ "${IRONFOX_TARGET_ARCH}" != 'bundle' ] || [ "${IRONFOX_CI}" == 1 ]; then + if [ "${IRONFOX_TARGET_ARCH}" == 'arm64' ]; then + # Build ARM64 + build_gecko_arm64 + elif [ "${IRONFOX_TARGET_ARCH}" == 'arm' ]; then + # Build ARM + build_gecko_arm + elif [ "${IRONFOX_TARGET_ARCH}" == 'x86_64' ]; then + # Build x86_64 + build_gecko_x86_64 + elif [ "${IRONFOX_TARGET_ARCH}" == 'bundle' ]; then + # Create our bundle + fat AAR... + build_gecko_bundle + fi + elif [ "${IRONFOX_TARGET_ARCH}" == 'bundle' ]; then # 1. Build ARM64 build_gecko_arm64 @@ -554,32 +626,10 @@ function build_gecko() { # 4. Finally, create our bundle + fat AAR... build_gecko_bundle - else - echo_red_text "Building Gecko(View) - ${IRONFOX_TARGET_PRETTY}..." - build_gecko_ind - echo_green_text "SUCCESS: Built Gecko(View) - ${IRONFOX_TARGET_PRETTY}" - - echo_red_text "Packaging Gecko(View) - ${IRONFOX_TARGET_PRETTY}..." - package_gecko - echo_green_text "SUCCESS: Packaged Gecko(View) - ${IRONFOX_TARGET_PRETTY}" - - if [ "${IRONFOX_TARGET_ARCH}" == 'arm' ]; then - cp -vf "${IRONFOX_GV_AAR_ARM}" "${IRONFOX_OUTPUTS_GV_AAR_ARM}" - if [ "${IRONFOX_CI}" == 1 ]; then - cp -vf "${IRONFOX_OUTPUTS_GV_AAR_ARM}" "${IRONFOX_AAR_ARTIFACTS}/" - fi - elif [ "${IRONFOX_TARGET_ARCH}" == 'x86_64' ]; then - cp -vf "${IRONFOX_GV_AAR_X86_64}" "${IRONFOX_OUTPUTS_GV_AAR_X86_64}" - if [ "${IRONFOX_CI}" == 1 ]; then - cp -vf "${IRONFOX_OUTPUTS_GV_AAR_X86_64}" "${IRONFOX_AAR_ARTIFACTS}/" - fi - else - cp -vf "${IRONFOX_GV_AAR_ARM64}" "${IRONFOX_OUTPUTS_GV_AAR_ARM64}" - if [ "${IRONFOX_CI}" == 1 ]; then - cp -vf "${IRONFOX_OUTPUTS_GV_AAR_ARM64}" "${IRONFOX_AAR_ARTIFACTS}/" - fi - fi fi + unset IRONFOX_MACH_TARGET_GECKO + export IRONFOX_MACH_TARGET_GECKO=0 + "${IRONFOX_MACH}" configure popd echo_green_text 'SUCCESS: Built Gecko(View)' @@ -588,22 +638,32 @@ function build_gecko() { function build_ac() { # Android Components echo_red_text 'Building Android Components (Part 1/2)...' + unset IRONFOX_MACH_BUILD + unset IRONFOX_MACH_TARGET_AC + export IRONFOX_MACH_BUILD=1 + export IRONFOX_MACH_TARGET_AC=1 # Ensure the CI env variable is not set here - otherwise this will cause build failure in Application Services, thanks to us removing MARS and friends unset CI - pushd "${IRONFOX_AC}" + pushd "${IRONFOX_GECKO}" + "${IRONFOX_MACH}" configure + # Always clean Gradle to ensure builds are fresh - clean_gradle + "${IRONFOX_MACH}" gradle -p mobile/android/android-components clean # Publish concept-fetch (required by A-S) with auto-publication disabled, # otherwise automatically triggered publication of A-S and publications of unifiedpush-ac will fail - "${IRONFOX_GRADLE}" ${IRONFOX_GRADLE_FLAGS} -Pofficial :components:concept-fetch:publishToMavenLocal + "${IRONFOX_MACH}" gradle -p mobile/android/android-components :components:concept-fetch:publishToMavenLocal # unifiedpush-ac also needs concept-base (dependency of support-base), support-base and ui-icons - "${IRONFOX_GRADLE}" ${IRONFOX_GRADLE_FLAGS} -Pofficial :components:concept-base:publishToMavenLocal - "${IRONFOX_GRADLE}" ${IRONFOX_GRADLE_FLAGS} -Pofficial :components:support-base:publishToMavenLocal - "${IRONFOX_GRADLE}" ${IRONFOX_GRADLE_FLAGS} -Pofficial :components:ui-icons:publishToMavenLocal + "${IRONFOX_MACH}" gradle -p mobile/android/android-components :components:concept-base:publishToMavenLocal + "${IRONFOX_MACH}" gradle -p mobile/android/android-components :components:support-base:publishToMavenLocal + "${IRONFOX_MACH}" gradle -p mobile/android/android-components :components:ui-icons:publishToMavenLocal + + unset IRONFOX_MACH_TARGET_AC + export IRONFOX_MACH_TARGET_AC=0 + "${IRONFOX_MACH}" configure popd echo_green_text 'SUCCESS: Built Android Components (Part 1/2)' @@ -626,12 +686,20 @@ function build_up_ac() { function build_ac_cont() { # Android Components (Part 2...) echo_red_text 'Building Android Components (Part 2/2)...' + unset IRONFOX_MACH_BUILD + unset IRONFOX_MACH_TARGET_AC + export IRONFOX_MACH_BUILD=1 + export IRONFOX_MACH_TARGET_AC=1 - pushd "${IRONFOX_AC}" + pushd "${IRONFOX_GECKO}" + "${IRONFOX_MACH}" configure # Enable the auto-publication workflow echo "## Enable the auto-publication workflow for Application Services" >>"${IRONFOX_GECKO}/local.properties" echo "autoPublish.application-services.dir=${IRONFOX_AS}" >>"${IRONFOX_GECKO}/local.properties" - "${IRONFOX_GRADLE}" ${IRONFOX_GRADLE_FLAGS} -Pofficial publishToMavenLocal + "${IRONFOX_MACH}" gradle -p mobile/android/android-components publishToMavenLocal + unset IRONFOX_MACH_TARGET_AC + export IRONFOX_MACH_TARGET_AC=0 + "${IRONFOX_MACH}" configure popd echo_green_text 'SUCCESS: Built Android Components (Part 2/2)' @@ -640,38 +708,63 @@ function build_ac_cont() { function build_fenix() { # Fenix echo_red_text 'Building Fenix...' + unset IRONFOX_MACH_BUILD + unset IRONFOX_MACH_TARGET_FENIX + export IRONFOX_MACH_BUILD=1 + export IRONFOX_MACH_TARGET_FENIX=1 pushd "${IRONFOX_GECKO}" + "${IRONFOX_MACH}" configure + # Always clean Gradle to ensure builds are fresh - "${IRONFOX_GRADLE}" ${IRONFOX_GRADLE_FLAGS} -Pofficial fenix:clean + "${IRONFOX_MACH}" gradle fenix:clean # Build our APKs - ## (MOZ_AUTOMATION needs to be set here to prevent the outputs from being automatically signed with a debug key) - MOZ_AUTOMATION=1 "${IRONFOX_GRADLE}" ${IRONFOX_GRADLE_FLAGS} -Pofficial fenix:assembleRelease - unset MOZ_AUTOMATION + "${IRONFOX_MACH}" gradle fenix:assembleRelease if [[ "${IRONFOX_TARGET_ARCH}" == 'bundle' ]]; then # 1. Export APK for ARM64 - cp -v "${IRONFOX_GECKO}/obj/ironfox-${IRONFOX_CHANNEL}-bundle/gradle/build/mobile/android/fenix/app/outputs/apk/fenix/release/app-fenix-arm64-v8a-release-unsigned.apk" "${IRONFOX_OUTPUTS_FENIX_ARM64_UNSIGNED}" + if [ "${IRONFOX_SIGN}" == 1 ]; then + cp -v "${IRONFOX_GECKO}/obj/ironfox-${IRONFOX_CHANNEL}-bundle/gradle/build/mobile/android/fenix/app/outputs/apk/release/app-fenix-arm64-v8a-release-unsigned.apk" "${IRONFOX_OUTPUTS_FENIX_ARM64_UNSIGNED}" + else + cp -v "${IRONFOX_GECKO}/obj/ironfox-${IRONFOX_CHANNEL}-bundle/gradle/build/mobile/android/fenix/app/outputs/apk/release/app-fenix-arm64-v8a-release.apk" "${IRONFOX_OUTPUTS_FENIX_ARM64_UNSIGNED}" + fi # 2. Export APK for ARM - cp -v "${IRONFOX_GECKO}/obj/ironfox-${IRONFOX_CHANNEL}-bundle/gradle/build/mobile/android/fenix/app/outputs/apk/fenix/release/app-fenix-armeabi-v7a-release-unsigned.apk" "${IRONFOX_OUTPUTS_FENIX_ARM_UNSIGNED}" + if [ "${IRONFOX_SIGN}" == 1 ]; then + cp -v "${IRONFOX_GECKO}/obj/ironfox-${IRONFOX_CHANNEL}-bundle/gradle/build/mobile/android/fenix/app/outputs/apk/release/app-fenix-armeabi-v7a-release-unsigned.apk" "${IRONFOX_OUTPUTS_FENIX_ARM_UNSIGNED}" + else + cp -v "${IRONFOX_GECKO}/obj/ironfox-${IRONFOX_CHANNEL}-bundle/gradle/build/mobile/android/fenix/app/outputs/apk/release/app-fenix-armeabi-v7a-release.apk" "${IRONFOX_OUTPUTS_FENIX_ARM_UNSIGNED}" + fi # 3. Export APK for x86_64 - cp -v "${IRONFOX_GECKO}/obj/ironfox-${IRONFOX_CHANNEL}-bundle/gradle/build/mobile/android/fenix/app/outputs/apk/fenix/release/app-fenix-x86_64-release-unsigned.apk" "${IRONFOX_OUTPUTS_FENIX_X86_64_UNSIGNED}" + if [ "${IRONFOX_SIGN}" == 1 ]; then + cp -v "${IRONFOX_GECKO}/obj/ironfox-${IRONFOX_CHANNEL}-bundle/gradle/build/mobile/android/fenix/app/outputs/apk/release/app-fenix-x86_64-release-unsigned.apk" "${IRONFOX_OUTPUTS_FENIX_X86_64_UNSIGNED}" + else + cp -v "${IRONFOX_GECKO}/obj/ironfox-${IRONFOX_CHANNEL}-bundle/gradle/build/mobile/android/fenix/app/outputs/apk/release/app-fenix-x86_64-release.apk" "${IRONFOX_OUTPUTS_FENIX_X86_64_UNSIGNED}" + fi # 4. Export universal APK - cp -v "${IRONFOX_GECKO}/obj/ironfox-${IRONFOX_CHANNEL}-bundle/gradle/build/mobile/android/fenix/app/outputs/apk/fenix/release/app-fenix-universal-release-unsigned.apk" "${IRONFOX_OUTPUTS_FENIX_UNIVERSAL_UNSIGNED}" + if [ "${IRONFOX_SIGN}" == 1 ]; then + cp -v "${IRONFOX_GECKO}/obj/ironfox-${IRONFOX_CHANNEL}-bundle/gradle/build/mobile/android/fenix/app/outputs/apk/release/app-fenix-universal-release-unsigned.apk" "${IRONFOX_OUTPUTS_FENIX_UNIVERSAL_UNSIGNED}" + else + cp -v "${IRONFOX_GECKO}/obj/ironfox-${IRONFOX_CHANNEL}-bundle/gradle/build/mobile/android/fenix/app/outputs/apk/release/app-fenix-universal-release.apk" "${IRONFOX_OUTPUTS_FENIX_UNIVERSAL_UNSIGNED}" + fi # 5. Finally, build and export our AAB - ## (MOZ_AUTOMATION needs to be set here to prevent the outputs from being automatically signed with a debug key) - MOZ_AUTOMATION=1 "${IRONFOX_GRADLE}" ${IRONFOX_GRADLE_FLAGS} -Pofficial -Paab fenix:bundleRelease - unset MOZ_AUTOMATION + "${IRONFOX_MACH}" gradle -Paab fenix:bundleRelease cp -v "${IRONFOX_GECKO}/obj/ironfox-${IRONFOX_CHANNEL}-bundle/gradle/build/mobile/android/fenix/app/outputs/bundle/fenixRelease/app-fenix-release.aab" "${IRONFOX_OUTPUTS_FENIX_AAB}" else # Export APK - cp -v "${IRONFOX_GECKO}/obj/ironfox-${IRONFOX_CHANNEL}-${IRONFOX_TARGET_ARCH}/gradle/build/mobile/android/fenix/app/outputs/apk/fenix/release/app-fenix-${IRONFOX_TARGET_ABI}-release-unsigned.apk" "${IRONFOX_OUTPUTS_APK}/ironfox-${IRONFOX_CHANNEL}-${IRONFOX_TARGET_ABI}-unsigned.apk" + if [ "${IRONFOX_SIGN}" == 1 ]; then + cp -v "${IRONFOX_GECKO}/obj/ironfox-${IRONFOX_CHANNEL}-${IRONFOX_TARGET_ARCH}/gradle/build/mobile/android/fenix/app/outputs/apk/release/app-fenix-${IRONFOX_TARGET_ABI}-release-unsigned.apk" "${IRONFOX_OUTPUTS_APK}/ironfox-${IRONFOX_CHANNEL}-${IRONFOX_TARGET_ABI}-unsigned.apk" + else + cp -v "${IRONFOX_GECKO}/obj/ironfox-${IRONFOX_CHANNEL}-${IRONFOX_TARGET_ARCH}/gradle/build/mobile/android/fenix/app/outputs/apk/release/app-fenix-${IRONFOX_TARGET_ABI}-release.apk" "${IRONFOX_OUTPUTS_APK}/ironfox-${IRONFOX_CHANNEL}-${IRONFOX_TARGET_ABI}.apk" + fi fi + unset IRONFOX_MACH_TARGET_FENIX + export IRONFOX_MACH_TARGET_FENIX=0 + "${IRONFOX_MACH}" configure popd echo_green_text 'SUCCESS: Built Fenix' @@ -689,13 +782,7 @@ prep_gecko_prefs prep_glean prep_llvm -if [ "${IRONFOX_CI}" == 1 ]; then - if [ "${IRONFOX_TARGET_ARCH}" == 'bundle' ]; then - prep_fenix - prep_up_ac - fi -else - # If we're not in CI, just prepare everything like usual +if [ "${IRONFOX_CI}" != 1 ] || [ "${IRONFOX_TARGET_ARCH}" == 'bundle' ]; then prep_fenix prep_up_ac fi @@ -725,25 +812,9 @@ build_microg build_phoenix build_glean build_as +build_gecko -if [ "${IRONFOX_CI}" == 1 ]; then - if [ "${IRONFOX_TARGET_ARCH}" == 'arm64' ]; then - build_gecko_arm64 - elif [ "${IRONFOX_TARGET_ARCH}" == 'arm' ]; then - build_gecko_arm - elif [ "${IRONFOX_TARGET_ARCH}" == 'x86_64' ]; then - build_gecko_x86_64 - elif [ "${IRONFOX_TARGET_ARCH}" == 'bundle' ]; then - build_gecko_bundle - build_ac - build_up_ac - build_ac_cont - build_fenix - echo_green_text "SUCCESS: Built IronFox ${IRONFOX_VERSION}: ${IRONFOX_CHANNEL_PRETTY} (${IRONFOX_TARGET_PRETTY})" - fi -else - # If we're not in CI, just build everything like usual - build_gecko +if [ "${IRONFOX_CI}" != 1 ] || [ "${IRONFOX_TARGET_ARCH}" == 'bundle' ]; then build_ac build_up_ac build_ac_cont diff --git a/scripts/env_common.sh b/scripts/env_common.sh index 8d7fe419..563ea950 100644 --- a/scripts/env_common.sh +++ b/scripts/env_common.sh @@ -535,34 +535,47 @@ if [[ -z "${IRONFOX_SB_GAPI_KEY_FILE+x}" ]]; then export IRONFOX_SB_GAPI_KEY_FILE="${IRONFOX_SB_GAPI_KEY_FILE_DEFAULT}" fi -# Have we built Gecko? -IRONFOX_GECKO_BUILT_DEFAULT=0 -if [[ -z "${IRONFOX_GECKO_BUILT+x}" ]]; then - export IRONFOX_GECKO_BUILT="${IRONFOX_GECKO_BUILT_DEFAULT}" +# Do we want Mach to actually build *something*? (Default) +## This will generally always be true, but we want to disable it for ex. packaging +IRONFOX_MACH_BUILD_DEFAULT=1 +if [[ -z "${IRONFOX_MACH_BUILD+x}" ]]; then + export IRONFOX_MACH_BUILD="${IRONFOX_MACH_BUILD_DEFAULT}" fi -# Have we packaged Gecko? -IRONFOX_GECKO_PACKAGED_DEFAULT=0 -if [[ -z "${IRONFOX_GECKO_PACKAGED+x}" ]]; then - export IRONFOX_GECKO_PACKAGED="${IRONFOX_GECKO_PACKAGED_DEFAULT}" +# Should Mach target Android Components? +IRONFOX_MACH_TARGET_AC_DEFAULT=0 +if [[ -z "${IRONFOX_MACH_TARGET_AC+x}" ]]; then + export IRONFOX_MACH_TARGET_AC="${IRONFOX_MACH_TARGET_AC_DEFAULT}" fi -# Have we built a GeckoView AAR archive for ARM64? -IRONFOX_GV_AAR_BUILT_ARM64_DEFAULT=0 -if [[ -z "${IRONFOX_GV_AAR_BUILT_ARM64+x}" ]]; then - export IRONFOX_GV_AAR_BUILT_ARM64="${IRONFOX_GV_AAR_BUILT_ARM64_DEFAULT}" +# Should Mach target Fenix? +IRONFOX_MACH_TARGET_FENIX_DEFAULT=0 +if [[ -z "${IRONFOX_MACH_TARGET_FENIX+x}" ]]; then + export IRONFOX_MACH_TARGET_FENIX="${IRONFOX_MACH_TARGET_FENIX_DEFAULT}" fi -# Have we built a GeckoView AAR archive for ARM? -IRONFOX_GV_AAR_BUILT_ARM_DEFAULT=0 -if [[ -z "${IRONFOX_GV_AAR_BUILT_ARM+x}" ]]; then - export IRONFOX_GV_AAR_BUILT_ARM="${IRONFOX_GV_AAR_BUILT_ARM_DEFAULT}" +# Should Mach target Gecko(View)? +IRONFOX_MACH_TARGET_GECKO_DEFAULT=0 +if [[ -z "${IRONFOX_MACH_TARGET_GECKO+x}" ]]; then + export IRONFOX_MACH_TARGET_GECKO="${IRONFOX_MACH_TARGET_GECKO_DEFAULT}" fi -# Have we built a GeckoView AAR archive for x86_64? -IRONFOX_GV_AAR_BUILT_X86_64_DEFAULT=0 -if [[ -z "${IRONFOX_GV_AAR_BUILT_X86_64+x}" ]]; then - export IRONFOX_GV_AAR_BUILT_X86_64="${IRONFOX_GV_AAR_BUILT_X86_64_DEFAULT}" +# Should Mach target ARM64 (GeckoView AAR) if we're creating a bundle? +IRONFOX_MACH_TARGET_BUNDLE_ARM64_DEFAULT=0 +if [[ -z "${IRONFOX_MACH_TARGET_BUNDLE_ARM64+x}" ]]; then + export IRONFOX_MACH_TARGET_BUNDLE_ARM64="${IRONFOX_MACH_TARGET_BUNDLE_ARM64_DEFAULT}" +fi + +# Should Mach target ARM (GeckoView AAR) if we're creating a bundle? +IRONFOX_MACH_TARGET_BUNDLE_ARM_DEFAULT=0 +if [[ -z "${IRONFOX_MACH_TARGET_BUNDLE_ARM+x}" ]]; then + export IRONFOX_MACH_TARGET_BUNDLE_ARM="$IRONFOX_MACH_TARGET_BUNDLE_ARM_DEFAULT}" +fi + +# Should Mach target x86_64 (GeckoView AAR) if we're creating a bundle? +IRONFOX_MACH_TARGET_BUNDLE_X86_64_DEFAULT=0 +if [[ -z "${IRONFOX_MACH_TARGET_BUNDLE_X86_64+x}" ]]; then + export IRONFOX_MACH_TARGET_BUNDLE_X86_64="${IRONFOX_MACH_TARGET_BUNDLE_X86_64_DEFAULT}" fi # App signing diff --git a/scripts/get_sources-if.sh b/scripts/get_sources-if.sh index d5d760d2..80968f44 100755 --- a/scripts/get_sources-if.sh +++ b/scripts/get_sources-if.sh @@ -13,7 +13,7 @@ fi target="$1" -# Set up target parameters +# Set-up target parameters IRONFOX_GET_SOURCE_ANDROID_SDK=0 IRONFOX_GET_SOURCE_AS=0 IRONFOX_GET_SOURCE_BUNDLETOOL=0 diff --git a/scripts/patches.yaml b/scripts/patches.yaml index 01fc5993..5c9a5505 100644 --- a/scripts/patches.yaml +++ b/scripts/patches.yaml @@ -70,6 +70,13 @@ patches: effect: "Ensures that the build dates are consistent for all variants of IronFox, in order to prevent unexpected version code issues." category: "Build System" + - file: "fenix-disable-debug-signing.patch" + name: "Disable Debug Signing" + description: "Disables debug signing of Fenix (Firefox for Android)." + reason: "To allow IronFox devs to use our own signing keys instead." + effect: "Ensures that IronFox is signed with our own keys, instead of debug keys." + category: "Build System" + - file: "gecko-ensure-builds-reflect-changes.patch" name: "Ensure builds always reflect our (latest) changes" description: "Ensures that builds of GeckoView binaries always reflect our (latest) changes."