blob: f9ad8ad3ec1c45b51feae78c419c36e39e4f2a9c [file] [log] [blame]
Jamie Gennis1bc967e2014-05-27 16:34:41 -07001#!/bin/bash
2
3# SRCDIR should be set to the path of the root source directory. It can be
4# either an absolute path or a path relative to the build directory. Whether
5# its an absolute or relative path determines whether the build directory can be
6# moved relative to or along with the source directory without re-running the
7# bootstrap script.
8SRCDIR=`dirname "${BASH_SOURCE[0]}"`
9
10# BOOTSTRAP should be set to the path of this script. It can be either an
11# absolute path or one relative to the build directory (which of these is used
12# should probably match what's used for SRCDIR).
13BOOTSTRAP="${BASH_SOURCE[0]}"
14
15# These variables should be set by auto-detecting or knowing a priori the Go
16# toolchain properties.
17GOROOT=`go env GOROOT`
18GOOS=`go env GOHOSTOS`
19GOARCH=`go env GOHOSTARCH`
20GOCHAR=`go env GOCHAR`
21
22case "$#" in
23 1) IN="$1";BOOTSTRAP_MANIFEST="$1";;
24 2) IN="$1";BOOTSTRAP_MANIFEST="$2";;
25 *) IN="${SRCDIR}/build.ninja.in";BOOTSTRAP_MANIFEST="$IN";;
26esac
27
28sed -e "s|@@SrcDir@@|$SRCDIR|g" \
29 -e "s|@@GoRoot@@|$GOROOT|g" \
30 -e "s|@@GoOS@@|$GOOS|g" \
31 -e "s|@@GoArch@@|$GOARCH|g" \
32 -e "s|@@GoChar@@|$GOCHAR|g" \
33 -e "s|@@Bootstrap@@|$BOOTSTRAP|g" \
34 -e "s|@@BootstrapManifest@@|$BOOTSTRAP_MANIFEST|g" \
35 $IN > build.ninja