2015-01-27 01:30:13 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-07-14 09:39:06 +02:00
|
|
|
set -e
|
|
|
|
|
|
|
|
ORIG_SRCDIR=$(dirname "${BASH_SOURCE[0]}")
|
|
|
|
if [[ "$ORIG_SRCDIR" != "." ]]; then
|
|
|
|
if [[ ! -z "$BUILDDIR" ]]; then
|
|
|
|
echo "error: To use BUILDDIR, run from the source directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
2016-04-28 01:10:38 +02:00
|
|
|
export BUILDDIR=$("${ORIG_SRCDIR}/build/soong/scripts/reverse_path.py" "$ORIG_SRCDIR")
|
2015-07-14 09:39:06 +02:00
|
|
|
cd $ORIG_SRCDIR
|
|
|
|
fi
|
|
|
|
if [[ -z "$BUILDDIR" ]]; then
|
|
|
|
echo "error: Run ${BASH_SOURCE[0]} from the build output directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
export SRCDIR="."
|
|
|
|
export BOOTSTRAP="${SRCDIR}/bootstrap.bash"
|
|
|
|
|
2015-06-11 01:59:11 +02:00
|
|
|
export TOPNAME="Android.bp"
|
2015-01-27 01:30:13 +01:00
|
|
|
export BOOTSTRAP_MANIFEST="${SRCDIR}/build/soong/build.ninja.in"
|
2015-06-24 04:46:20 +02:00
|
|
|
export RUN_TESTS="-t"
|
2015-01-27 01:30:13 +01:00
|
|
|
|
|
|
|
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 [[ $# -eq 0 ]]; then
|
2015-07-14 09:39:06 +02:00
|
|
|
mkdir -p $BUILDDIR
|
|
|
|
|
|
|
|
if [[ $(find $BUILDDIR -maxdepth 1 -name Android.bp) ]]; then
|
|
|
|
echo "FAILED: The build directory must not be a source directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2016-04-28 01:10:38 +02:00
|
|
|
export SRCDIR_FROM_BUILDDIR=$(build/soong/scripts/reverse_path.py "$BUILDDIR")
|
2015-07-14 09:39:06 +02:00
|
|
|
|
|
|
|
sed -e "s|@@BuildDir@@|${BUILDDIR}|" \
|
|
|
|
-e "s|@@SrcDirFromBuildDir@@|${SRCDIR_FROM_BUILDDIR}|" \
|
2015-01-27 01:30:13 +01:00
|
|
|
-e "s|@@PrebuiltOS@@|${PREBUILTOS}|" \
|
2015-07-14 09:39:06 +02:00
|
|
|
"$SRCDIR/build/soong/soong.bootstrap.in" > $BUILDDIR/.soong.bootstrap
|
|
|
|
ln -sf "${SRCDIR_FROM_BUILDDIR}/build/soong/soong.bash" $BUILDDIR/soong
|
2015-01-27 01:30:13 +01:00
|
|
|
fi
|
|
|
|
|
2015-07-14 09:39:06 +02:00
|
|
|
"$SRCDIR/build/blueprint/bootstrap.bash" "$@"
|