summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Joe Onorato <joeo@google.com> 2024-05-14 13:54:13 -0700
committer Joe Onorato <joeo@google.com> 2024-05-14 15:12:16 -0700
commit32b2aa33c57bd99f6298353bbf9dac769153a61a (patch)
treea08b80f7b009e1db0cdf113f3eba2231a876c68b
parentb63973dfc217fc701d967a8cf83c71b34a54fa2c (diff)
Provide a function in envsetup.sh to get the host arch directly
It's very simple logic, and running get_build_var to do it is slow and has side effects (like needing a lunch target, creating an out directory, etc.) Test: source envsetup.sh Change-Id: If260efd21713874fba7c15dbc0fd23442d776f8a Merged-In: If260efd21713874fba7c15dbc0fd23442d776f8a
-rw-r--r--core/envsetup.mk1
-rw-r--r--envsetup.sh13
2 files changed, 14 insertions, 0 deletions
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 1c3a1b3b6b..3271079abc 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -255,6 +255,7 @@ endif
HOST_PREBUILT_ARCH := x86
# This is the standard way to name a directory containing prebuilt host
# objects. E.g., prebuilt/$(HOST_PREBUILT_TAG)/cc
+# This must match the logic in get_host_prebuilt_prefix in envsetup.sh
HOST_PREBUILT_TAG := $(BUILD_OS)-$(HOST_PREBUILT_ARCH)
# TARGET_COPY_OUT_* are all relative to the staging directory, ie PRODUCT_OUT.
diff --git a/envsetup.sh b/envsetup.sh
index 50fec5146a..ff3c3a60eb 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -196,6 +196,19 @@ function get_build_var()
(\cd $T; build/soong/soong_ui.bash --dumpvar-mode $1)
}
+# This logic matches envsetup.mk
+function get_host_prebuilt_prefix
+{
+ local un=$(uname)
+ if [[ $un == "Linux" ]] ; then
+ echo linux-x86
+ elif [[ $un == "Darwin" ]] ; then
+ echo darwin-x86
+ else
+ echo "Error: Invalid host operating system: $un" 1>&2
+ fi
+}
+
# check to see if the supplied product is one we can build
function check_product()
{