blob: f7177b675cc73c6c671f3d6f22fcad1cc50277f4 [file] [log] [blame]
#!/bin/bash
# Copyright 2017 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
### build Fuchsia
## usage: fx build [ninja option,...] [target,...]
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
fx-config-read
function main {
local env_args=
# PATH is required to find a number of tools on the host system.
if [[ -n "${PATH}" ]]; then
env_args="${env_args} PATH=${PATH}"
fi
# TERM is required by ninja to print status messages on the same line.
if [[ -n "${TERM}" ]]; then
env_args="${env_args} TERM=${TERM}"
fi
# TMPDIR is required by goma on Mac OS X.
if [[ -n "${TMPDIR}" ]]; then
env_args="${env_args} TMPDIR=${TMPDIR}"
fi
env -i ${env_args} \
"${FUCHSIA_DIR}/buildtools/ninja" -j "$(fx-choose-build-concurrency)" \
-C "${FUCHSIA_BUILD_DIR}" "$@"
}
main "$@"