1#!/bin/bash 2 3# This script is intented to wrap the execution of ninja so that we 4# can do some checks before each ninja run. 5# 6# It can either be run with a standalone Blueprint checkout to generate 7# the minibp binary, or can be used by another script as part of a custom 8# Blueprint-based build system. When used by another script, the following 9# environment variables can be set to configure this script, which are 10# documented below: 11# 12# BUILDDIR 13# NINJA 14# SKIP_NINJA 15# 16# When run in a standalone Blueprint checkout, bootstrap.bash will install 17# this script into the $BUILDDIR, where it may be executed. 18# 19# For embedding into a custom build system, the current directory when this 20# script executes should be the same directory that $BOOTSTRAP should be 21# called from. 22 23set -e 24 25# BUILDDIR should be set to the path to store build results. By default, 26# this is the directory containing this script, but can be set explicitly 27# if the custom build system only wants to install their own wrapper. 28[ -z "$BUILDDIR" ] && BUILDDIR=`dirname "${BASH_SOURCE[0]}"` 29 30# NINJA should be set to the path of the ninja executable. By default, this 31# is just "ninja", and will be looked up in $PATH. 32[ -z "$NINJA" ] && NINJA=ninja 33 34 35if [ ! -f "${BUILDDIR}/.blueprint.bootstrap" ]; then 36 echo "Please run bootstrap.bash (.blueprint.bootstrap missing)" >&2 37 exit 1 38fi 39 40# .blueprint.bootstrap provides saved values from the bootstrap.bash script: 41# 42# BLUEPRINT_BOOTSTRAP_VERSION 43# BLUEPRINTDIR 44# SRCDIR 45# GOROOT 46# 47source "${BUILDDIR}/.blueprint.bootstrap" 48 49if [ -z "$BLUEPRINTDIR" ]; then 50 echo "Please run bootstrap.bash (.blueprint.bootstrap outdated)" >&2 51 exit 1 52fi 53 54source "${BLUEPRINTDIR}/blueprint_impl.bash" 55