1if [ ! "${BLUEPRINT_BOOTSTRAP_VERSION}" -eq "2" ]; then
2  echo "Please run bootstrap.bash again (out of date)" >&2
3  exit 1
4fi
5
6
7# Allow the caller to pass in a list of module files
8if [ -z "$BLUEPRINT_LIST_FILE" ]; then
9  # If the caller does not pass a list of module files, then do a search now
10  OUR_LIST_FILE="${BUILDDIR}/.bootstrap/bplist"
11  TEMP_LIST_FILE="${OUR_FILES_LIST}.tmp"
12  mkdir -p "$(dirname ${OUR_LIST_FILE})"
13  (cd "$SRCDIR";
14    find . -mindepth 1 -type d \( -name ".*" -o -execdir test -e {}/.out-dir \; \) -prune \
15      -o -name $TOPNAME -print | sort) >"${TEMP_LIST_FILE}"
16  if cmp -s "${OUR_LIST_FILE}" "${TEMP_LIST_FILE}"; then
17    rm "${TEMP_LIST_FILE}"
18  else
19    mv "${TEMP_LIST_FILE}" "${OUR_LIST_FILE}"
20  fi
21  BLUEPRINT_LIST_FILE="${OUR_LIST_FILE}"
22fi
23
24export GOROOT
25export BLUEPRINT_LIST_FILE
26
27source "${BLUEPRINTDIR}/microfactory/microfactory.bash"
28
29BUILDDIR="${BUILDDIR}/.minibootstrap" build_go minibp github.com/google/blueprint/bootstrap/minibp
30
31BUILDDIR="${BUILDDIR}/.minibootstrap" build_go bpglob github.com/google/blueprint/bootstrap/bpglob
32
33# Build the bootstrap build.ninja
34"${NINJA}" -w dupbuild=err -f "${BUILDDIR}/.minibootstrap/build.ninja"
35
36# Build the primary builder and the main build.ninja
37"${NINJA}" -w dupbuild=err -f "${BUILDDIR}/.bootstrap/build.ninja"
38
39# SKIP_NINJA can be used by wrappers that wish to run ninja themselves.
40if [ -z "$SKIP_NINJA" ]; then
41    "${NINJA}" -w dupbuild=err -f "${BUILDDIR}/build.ninja" "$@"
42else
43    exit 0
44fi
45