| #!/bin/bash |
| set -eu |
| |
| clangbin="clang" |
| if [[ -n ${CLANG_PREFIX} ]]; then |
| clangbin="${CLANG_PREFIX}/${clangbin}" |
| fi |
| |
| if [[ ${GOOS} != "fuchsia" ]]; then |
| exec "${clangbin}" "$@" |
| fi |
| |
| case "${GOARCH}" in |
| arm64) |
| CLANG_TRIPLE="aarch64-fuchsia" |
| ;; |
| amd64) |
| CLANG_TRIPLE="x86_64-fuchsia" |
| ;; |
| *) |
| echo >&2 "Unsupported architecture: ${GOARCH}" |
| exit 1 |
| ;; |
| esac |
| |
| declare -a extra_args |
| # -Qunused-arguments is used to avoid issues with intermediate builds that don't directly link fdio. |
| extra_args+=(-Qunused-arguments) |
| extra_args+=("--sysroot=${ZIRCON_SYSROOT}") |
| extra_args+=("-I${FDIO_INCLUDE}") |
| extra_args+=("-L${FUCHSIA_SHARED_LIBS}") |
| |
| exec "${clangbin}" --target="${CLANG_TRIPLE}" "${extra_args[@]}" "$@" |