Support building build tools against musl
Add --musl argument to enable building against musl.
Bug: 190084016
Test: build-prebuilts.sh
Test: build-prebuitls.sh --musl
Test: build-prebuilts.sh --musl --resume
Change-Id: I5fa2a074a6e36f7742be943b05121a634bc4aeba
diff --git a/build-prebuilts.sh b/build-prebuilts.sh
index 71530cf..7a3a78e 100755
--- a/build-prebuilts.sh
+++ b/build-prebuilts.sh
@@ -32,8 +32,20 @@
build_soong=1
[[ ! -d ${TOP}/toolchain/go ]] || build_go=1
-clean=t
-[[ "${1:-}" != '--resume' ]] || clean=''
+
+use_musl=false
+clean=true
+while getopts ":-:" opt; do
+ case "$opt" in
+ -)
+ case "${OPTARG}" in
+ resume) clean= ;;
+ musl) use_musl=true ;;
+ *) echo "Unknown option --${OPTARG}"; exit 1 ;;
+ esac;;
+ *) echo "'${opt}' '${OPTARG}'"
+ esac
+done
# Use toybox and other prebuilts even outside of the build (test running, go, etc)
export PATH=${TOP}/prebuilts/build-tools/path/${OS}-x86:$PATH
@@ -48,6 +60,7 @@
{
"Allow_missing_dependencies": true,
"HostArch":"x86_64",
+ "HostMusl": $use_musl,
"VendorVars": {
"cpython3": {
"force_build_host": "true"