| #!/usr/bin/env bash |
| # Copyright 2021 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. |
| |
| set -euxo pipefail |
| |
| if [ ! -x "$FUCHSIA_BUILD_DIR" ]; then |
| echo "error: did you fx exec? missing \$FUCHSIA_BUILD_DIR" 1>&2 |
| exit 1 |
| fi |
| |
| FIDLC=$(fx list-build-artifacts --expect-one --name fidlc tools) |
| KAZOO=$(fx list-build-artifacts --expect-one --name kazoo tools) |
| |
| fx ninja -C "$FUCHSIA_BUILD_DIR" "$FIDLC" "$KAZOO" |
| |
| "$FUCHSIA_BUILD_DIR/$FIDLC" \ |
| --experimental allow_new_syntax \ |
| --json /tmp/syscalls.json \ |
| --files ../../zircon/vdso/*.fidl |
| |
| readonly syscall_stubs=src/syscall/zx/syscalls_fuchsia.go |
| readonly vdso_keys=src/runtime/vdso_keys_fuchsia.go |
| |
| "$FUCHSIA_BUILD_DIR/$KAZOO" \ |
| --go-syscall-arm64-asm=src/syscall/zx/syscalls_fuchsia_arm64.s \ |
| --go-syscall-stubs=$syscall_stubs \ |
| --go-syscall-x86-asm=src/syscall/zx/syscalls_fuchsia_amd64.s \ |
| --go-vdso-arm64-calls=src/runtime/vdsocalls_fuchsia_arm64.s \ |
| --go-vdso-keys=$vdso_keys \ |
| --go-vdso-x86-calls=src/runtime/vdsocalls_fuchsia_amd64.s \ |
| /tmp/syscalls.json |
| |
| fx format-code --files="$syscall_stubs $vdso_keys" |