platform_build_blueprint/bootstrap.bash
Jamie Gennis 1bc967ed43 Initial Blueprint commit.
Blueprint is a build system component that reads Blueprints files defining
modules to be built, and generates a Ninja build manifest that can be used to
perform all the build actions.  It does not dictate or implement much build
policy itself, but rather provides a framework to ease the process of defining
build logic in Go.

The "blueprint" and "blueprint/parser" Go packages contain the functionality
for reading Blueprint files and invoking build logic functions defined in other
Go packages.

The "blueprint/bootstrap" Go package contains just enough build logic to build
a binary that includes Blueprint and any pure-Go (i.e. no cgo) build logic
defined in external Go packages.  This can be used to create a minimal Ninja
file that's capable of bootstrapping a Blueprint-based build system from
source.

The "blueprint/bootstrap/minibp" Go package contains code for a minimal binary
that includes the build logic defined in the "blueprint/bootstrap" package.
This binary can then create the Ninja file for the bootstrapping process.

Change-Id: I8d8390042372a72d225785cda738525001b009f1
2014-06-04 14:23:32 -07:00

35 lines
No EOL
1.4 KiB
Bash
Executable file

#!/bin/bash
# SRCDIR should be set to the path of the root source directory. It can be
# either an absolute path or a path relative to the build directory. Whether
# its an absolute or relative path determines whether the build directory can be
# moved relative to or along with the source directory without re-running the
# bootstrap script.
SRCDIR=`dirname "${BASH_SOURCE[0]}"`
# BOOTSTRAP should be set to the path of this script. It can be either an
# absolute path or one relative to the build directory (which of these is used
# should probably match what's used for SRCDIR).
BOOTSTRAP="${BASH_SOURCE[0]}"
# These variables should be set by auto-detecting or knowing a priori the Go
# toolchain properties.
GOROOT=`go env GOROOT`
GOOS=`go env GOHOSTOS`
GOARCH=`go env GOHOSTARCH`
GOCHAR=`go env GOCHAR`
case "$#" in
1) IN="$1";BOOTSTRAP_MANIFEST="$1";;
2) IN="$1";BOOTSTRAP_MANIFEST="$2";;
*) IN="${SRCDIR}/build.ninja.in";BOOTSTRAP_MANIFEST="$IN";;
esac
sed -e "s|@@SrcDir@@|$SRCDIR|g" \
-e "s|@@GoRoot@@|$GOROOT|g" \
-e "s|@@GoOS@@|$GOOS|g" \
-e "s|@@GoArch@@|$GOARCH|g" \
-e "s|@@GoChar@@|$GOCHAR|g" \
-e "s|@@Bootstrap@@|$BOOTSTRAP|g" \
-e "s|@@BootstrapManifest@@|$BOOTSTRAP_MANIFEST|g" \
$IN > build.ninja