Files
IronFox/scripts/build.sh
celenity 31e00c18d0 IronFox v145.0.2
ironfox-oss/IronFox!105
____

## Changes

- Removed DNS0 from the list of default DNS over HTTPS providers, due to [its unfortunate discontinuation](https://www.dns0.eu/).
- Removed [the Mozilla Ads Client library](https://github.com/mozilla/application-services/tree/main/components/ads-client) from [Application Services](https://github.com/mozilla/application-services).
- Removed the Mullvad Leta search engine, due to [its unfortunate discontinuation](https://mullvad.net/blog/2025/11/6/shutting-down-our-search-proxy-leta) *(Thanks to @techaddict: https://gitlab.com/ironfox-oss/IronFox/-/merge_requests/101! 💜)*.
- Updated to Firefox [`145.0.2`](https://firefox.com/firefox/android/145.0.2/releasenotes/).
- Updated to Phoenix [`2025.11.27.1`](https://codeberg.org/celenity/Phoenix/releases/tag/2025.11.27.1).
- [Other minor tweaks, fixes, and refinements](https://gitlab.com/ironfox-oss/IronFox/-/merge_requests/105/diffs).

MR-author: celenity <celenity@celenity.dev>
Co-authored-by: techaddict <20232669-techaddict@users.noreply.gitlab.com>
Co-authored-by: user <user@localhost.localdomain>
Co-authored-by: Weblate <hosted@weblate.org>
Co-authored-by: Akash Yadav <itsaky01@gmail.com>
Approved-by: celenity <celenity@celenity.dev>
Merged-by: celenity <celenity@celenity.dev>
2025-11-28 15:11:03 +00:00

164 lines
5.9 KiB
Bash
Executable File

#!/bin/bash
#
# Fennec build scripts
# Copyright (C) 2020-2024 Matías Zúñiga, Andrew Nayenko, Tavi
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
if [ -z "$1" ]; then
echo "Usage: $0 apk|bundle" >&1
exit 1
fi
set -euo pipefail
build_type="$1"
if [ "$build_type" != "apk" ] && [ "$build_type" != "bundle" ]; then
echo "Unknown build type: '$build_type'" >&1
echo "Usage: $0 apk|bundle" >&1
exit 1
fi
if [[ -n ${FDROID_BUILD+x} ]]; then
source "$(dirname "$0")/env_fdroid.sh"
fi
# shellcheck disable=SC2154
if [[ "$env_source" != "true" ]]; then
echo "Use 'source scripts/env_local.sh' before calling prebuild or build"
exit 1
fi
source "$CARGO_HOME/env"
# We publish the artifacts into a local Maven repository instead of using the
# auto-publication workflow because the latter does not work for Gradle
# plugins (Glean).
if [[ -n ${FDROID_BUILD+x} ]]; then
# Build LLVM
# shellcheck disable=SC2154
pushd "$llvm"
pushd "$bundletool"
gradle assemble
popd
# shellcheck disable=SC2154
llvmtarget=$(cat "$builddir/targets_to_build")
echo "building llvm for $llvmtarget"
cmake -S llvm -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=out -DCMAKE_C_COMPILER=clang-20 \
-DCMAKE_CXX_COMPILER=clang++-20 -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_TARGETS_TO_BUILD="$llvmtarget" \
-DLLVM_USE_LINKER=lld -DLLVM_BINUTILS_INCDIR=/usr/include -DLLVM_ENABLE_PLUGINS=FORCE_ON \
-DLLVM_DEFAULT_TARGET_TRIPLE="x86_64-unknown-linux-gnu"
cmake --build build -j"$(nproc)"
cmake --build build --target install -j"$(nproc)"
popd
fi
if [[ -n ${FDROID_BUILD+x} ]]; then
# Build WASI SDK
# shellcheck disable=SC2154
pushd "$wasi"
mkdir -vp build/install/wasi
touch build/compiler-rt.BUILT # fool the build system
$MAKE_LIB \
PREFIX=/wasi \
build/wasi-libc.BUILT \
build/libcxx.BUILT \
-j"$($NPROC_LIB)"
popd
fi
if [[ -n ${FDROID_BUILD+x} ]]; then
# Build uniffi-bindgen
pushd "$uniffi"
cargo build --release
popd
fi
# Build microG libraries
# shellcheck disable=SC2154
pushd "$gmscore"
if ! [[ -n ${FDROID_BUILD+x} ]]; then
export GRADLE_MICROG_VERSION_WITHOUT_GIT=1
fi
gradle -Dhttps.protocols=TLSv1.3 -Dorg.gradle.configuration-cache=false --no-build-cache --no-configuration-cache -x javaDocReleaseGeneration \
:play-services-ads-identifier:publishToMavenLocal \
:play-services-base:publishToMavenLocal \
:play-services-basement:publishToMavenLocal \
:play-services-fido:publishToMavenLocal \
:play-services-tasks:publishToMavenLocal
popd
# shellcheck disable=SC2154
pushd "$glean"
export TARGET_CFLAGS=-DNDEBUG
gradle -Dorg.gradle.configuration-cache=false --no-build-cache --no-configuration-cache :glean-native:publishToMavenLocal
gradle -Dorg.gradle.configuration-cache=false --no-build-cache --no-configuration-cache publishToMavenLocal
popd
# shellcheck disable=SC2154
pushd "$application_services"
# When 'CI' environment variable is set to a non-zero value, the 'libs/verify-ci-android-environment.sh' script
# skips building the libraries as they are expected to be already downloaded in a CI environment
# However, we want build those libraries always, so we set CI='' before invoking the script
CI='' bash -c './libs/verify-android-environment.sh && gradle -Dhttps.protocols=TLSv1.3 -Dorg.gradle.configuration-cache=false --no-build-cache --no-configuration-cache :tooling-nimbus-gradle:publishToMavenLocal'
popd
# shellcheck disable=SC2154
pushd "$mozilla_release"
# shellcheck disable=SC2086
echo "Running ./mach build..."
./mach build
echo "Running ./mach package..."
./mach package
echo "Running ./mach package-multi-locale..."
./mach package-multi-locale --locales ${IRONFOX_LOCALES}
MOZ_CHROME_MULTILOCALE="${IRONFOX_LOCALES}"
export MOZ_CHROME_MULTILOCALE
echo "Running gradle -Dorg.gradle.configuration-cache=false -Pofficial --no-build-cache --no-configuration-cache -x javadocRelease :geckoview:publishReleasePublicationToMavenLocal..."
gradle -Dorg.gradle.configuration-cache=false -Pofficial --no-build-cache --no-configuration-cache -x javadocRelease :geckoview:publishReleasePublicationToMavenLocal
popd
# shellcheck disable=SC2154
pushd "$android_components"
# Publish concept-fetch (required by A-S) with auto-publication disabled,
# otherwise automatically triggered publication of A-S will fail
gradle -Dorg.gradle.configuration-cache=false -Pofficial --no-build-cache --no-configuration-cache :components:concept-fetch:publishToMavenLocal
# Enable the auto-publication workflow now that concept-fetch is published
echo "## Enable the auto-publication workflow for Application Services" >>"$mozilla_release/local.properties"
echo "autoPublish.application-services.dir=$application_services" >>"$mozilla_release/local.properties"
gradle -Dorg.gradle.configuration-cache=false -Pofficial --no-build-cache --no-configuration-cache publishToMavenLocal
popd
# shellcheck disable=SC2154
pushd "$fenix"
if [[ "$build_type" == "apk" ]]; then
gradle -Dorg.gradle.configuration-cache=false -Pofficial --no-build-cache --no-configuration-cache :app:assembleRelease
elif [[ "$build_type" == "bundle" ]]; then
gradle -Dorg.gradle.configuration-cache=false -Pofficial --no-build-cache --no-configuration-cache :app:bundleRelease -Paab
fi
popd