platform_build_soong/bootstrap.bash
Colin Cross f7531f1a21 Replace soong script with a symlink
bootstrap.bash creates a soong script in the output directory using
build/soong/soong.in.  This requires a manual rebootstrap any time
soong.in changes.  Instead, have bootstrap.bash symlink
build/soong/soong.bash to soong in the output directory, and create
a file called .soong.bootstrap in the output directory that contains
the variables that bootstrap.bash sets.

Change-Id: I5e6e54c2e8bdde876941e2e082f9ba177c757cbf
2015-03-25 14:09:02 -07:00

34 lines
894 B
Bash
Executable file

#!/bin/bash
export BOOTSTRAP="${BASH_SOURCE[0]}"
export SRCDIR=$(dirname "${BASH_SOURCE[0]}")
export BOOTSTRAP_MANIFEST="${SRCDIR}/build/soong/build.ninja.in"
case $(uname) in
Linux)
export GOOS="linux"
export PREBUILTOS="linux-x86"
;;
Darwin)
export GOOS="darwin"
export PREBUILTOS="darwin-x86"
;;
*) echo "unknown OS:" $(uname) && exit 1;;
esac
export GOROOT="${SRCDIR}/prebuilts/go/$PREBUILTOS/"
export GOARCH="amd64"
export GOCHAR="6"
if [[ $(find . -maxdepth 1 -name $(basename "${BOOTSTRAP}")) ]]; then
echo "FAILED: Tried to run "$(basename "${BOOTSTRAP}")" from "$(pwd)""
exit 1
fi
if [[ $# -eq 0 ]]; then
sed -e "s|@@SrcDir@@|${SRCDIR}|" \
-e "s|@@PrebuiltOS@@|${PREBUILTOS}|" \
${SRCDIR}/build/soong/soong.bootstrap.in > .soong.bootstrap
ln -sf ${SRCDIR}/build/soong/soong.bash soong
fi
${SRCDIR}/build/blueprint/bootstrap.bash "$@"