From 911ff0d79cdeb81671f51ea647db171bab5ce5b5 Mon Sep 17 00:00:00 2001 From: Akash Yadav Date: Thu, 9 Jan 2025 00:14:37 +0530 Subject: [PATCH] fix: rename 'paths_*.sh' to 'env_*.sh' env_*.sh names are better suited since the scripts are used to set up environment variables --- .cirrus.yml | 4 +++- .gitignore | 2 +- README.md | 4 ++-- scripts/build.sh | 11 +++-------- scripts/ci-build.sh | 4 ++-- scripts/env_common.sh | 12 ++++++++++++ scripts/{paths_fdroid.sh => env_fdroid.sh} | 2 +- scripts/get_sources.sh | 9 +++++---- scripts/prebuild.sh | 6 +++--- 9 files changed, 32 insertions(+), 22 deletions(-) create mode 100644 scripts/env_common.sh rename scripts/{paths_fdroid.sh => env_fdroid.sh} (97%) diff --git a/.cirrus.yml b/.cirrus.yml index 02024f56..481afc50 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -10,7 +10,9 @@ container: build_task: name: Build IronFox - only_if: $CIRRUS_BRANCH == "main" + only_if: > + $CIRRUS_BRANCH == "main" || + $CIRRUS_BRANCH =~ ".*--ci-incl$" timeout_in: 120m env: SB_GAPI_KEY: ENCRYPTED[!3da25d528d0c34be6d3f3bbe73d2cbce960b8e55ed7b54906a1140b4929032b026a1ea5f0876fe46b0f0044711cc08bd!] diff --git a/.gitignore b/.gitignore index 7a337708..695739e0 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,4 @@ __pycache__ /appservices /gmscore /wasi-sdk -/scripts/paths_local.sh +/scripts/env_local.sh diff --git a/README.md b/README.md index 91b7ef7b..df44c673 100644 --- a/README.md +++ b/README.md @@ -188,10 +188,10 @@ Next, you need to download the source files to build. The `scripts/get_sources.s If you need to fetch sources for a different version of Firefox than the one IronFox is currently based on, you'll have to modify the script directly. Once the source files are downloaded and extracted, you need to source the -`scripts/paths_local.sh` script *(generated by `get_sources.sh`)* to set up the required environment variables: +`scripts/env_local.sh` script *(generated by `get_sources.sh`)* to set up the required environment variables: ```sh -source scripts/paths_local.sh +source scripts/env_local.sh ``` Next, you need to patch the files with: diff --git a/scripts/build.sh b/scripts/build.sh index 984592e9..9308c7b4 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -21,12 +21,12 @@ set -e if [[ -n ${FDROID_BUILD+x} ]]; then - source "$(dirname "$0")/paths_fdroid.sh" + source "$(dirname "$0")/env_fdroid.sh" fi # shellcheck disable=SC2154 -if [[ "$paths_source" != "true" ]]; then - echo "Use 'source scripts/paths_local.sh' before calling prebuild or build" +if [[ "$env_source" != "true" ]]; then + echo "Use 'source scripts/env_local.sh' before calling prebuild or build" exit 1 fi @@ -90,8 +90,6 @@ popd # shellcheck disable=SC2154 pushd "$application_services" -export NSS_DIR="$application_services/libs/desktop/linux-x86-64/nss" -export NSS_STATIC=1 ./libs/verify-android-environment.sh gradle :tooling-nimbus-gradle:publishToMavenLocal popd @@ -99,9 +97,6 @@ popd # shellcheck disable=SC2154 pushd "$mozilla_release" -# shellcheck disable=SC2154 -MOZ_CHROME_MULTILOCALE=$(<"$patches/locales") -export MOZ_CHROME_MULTILOCALE ./mach build gradle :geckoview:publishReleasePublicationToMavenLocal gradle :exoplayer2:publishReleasePublicationToMavenLocal diff --git a/scripts/ci-build.sh b/scripts/ci-build.sh index 1353c892..3d08919d 100755 --- a/scripts/ci-build.sh +++ b/scripts/ci-build.sh @@ -10,7 +10,7 @@ rootdir="$(dirname "$0")/.." rootdir=$(realpath "$rootdir") # Setup paths -source "$rootdir/scripts/paths_local.sh" +source "$rootdir/scripts/env_local.sh" # Patch "$rootdir/scripts/prebuild.sh" "${VERSION_NAME}" "${VERSION_CODE}" @@ -23,7 +23,7 @@ echo "########################" echo "" # Build -bash "$rootdir/scripts/build.sh" +source "$rootdir/scripts/build.sh" # Build AAB pushd "$rootdir/gecko/mobile/android/fenix" diff --git a/scripts/env_common.sh b/scripts/env_common.sh new file mode 100644 index 00000000..5c03c50d --- /dev/null +++ b/scripts/env_common.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Caution: Should not be sourced directly! +# Use 'env_local.sh' or 'env_fdroid.sh' instead. + +MOZ_CHROME_MULTILOCALE=$(<"$patches/locales") +export MOZ_CHROME_MULTILOCALE + +export NSS_DIR="$application_services/libs/desktop/linux-x86-64/nss" +export NSS_STATIC=1 + +export env_source="true" \ No newline at end of file diff --git a/scripts/paths_fdroid.sh b/scripts/env_fdroid.sh similarity index 97% rename from scripts/paths_fdroid.sh rename to scripts/env_fdroid.sh index 099a770c..d806adc2 100755 --- a/scripts/paths_fdroid.sh +++ b/scripts/env_fdroid.sh @@ -35,4 +35,4 @@ export llvm="$FDROID_SRCLIB/llvm" export llvm_android="$FDROID_SRCLIB/llvm_android" export toolchain_utils="$FDROID_SRCLIB/toolchain-utils" -export paths_source="true" +source "\$rootdir/scripts/env_common.sh" diff --git a/scripts/get_sources.sh b/scripts/get_sources.sh index 2310c0cf..4d77f847 100755 --- a/scripts/get_sources.sh +++ b/scripts/get_sources.sh @@ -10,7 +10,7 @@ APPSERVICES_TAG="v134.0" # Configuration ROOTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" -PATHS_SH="${ROOTDIR}/scripts/paths_local.sh" +ENV_SH="${ROOTDIR}/scripts/env_local.sh" BUILDDIR="${ROOTDIR}/build" PATCHDIR="${ROOTDIR}/patches" GECKODIR="${ROOTDIR}/gecko" @@ -128,8 +128,8 @@ git clone --branch "$APPSERVICES_TAG" --depth=1 "https://github.com/mozilla/appl do_download "gecko" "https://hg.mozilla.org/releases/mozilla-release/archive/${FIREFOX_TAG}.zip" -echo "Writing ${PATHS_SH}..." -cat > "$PATHS_SH" << EOF +echo "Writing ${ENV_SH}..." +cat > "$ENV_SH" << EOF export patches=${PATCHDIR} export rootdir=${ROOTDIR} export builddir="\$rootdir/build" @@ -140,5 +140,6 @@ export fenix=${FENIX} export mozilla_release=${GECKODIR} export gmscore=${GMSCOREDIR} export wasi=${WASISDKDIR} -export paths_source="true" + +source "\$rootdir/scripts/env_common.sh" EOF diff --git a/scripts/prebuild.sh b/scripts/prebuild.sh index 180d3308..d68942fe 100755 --- a/scripts/prebuild.sh +++ b/scripts/prebuild.sh @@ -38,12 +38,12 @@ fi if [[ -n ${FDROID_BUILD+x} ]]; then source "$(dirname "$0")/setup-android-sdk.sh" - source "$(dirname "$0")/paths_fdroid.sh" + source "$(dirname "$0")/env_fdroid.sh" fi # shellcheck disable=SC2154 -if [[ "$paths_source" != "true" ]]; then - echo "Use 'source scripts/paths_local.sh' before calling prebuild or build" +if [[ "$env_source" != "true" ]]; then + echo "Use 'source scripts/env_local.sh' before calling prebuild or build" exit 1 fi