[regen-syscalls] Handle non-default build dirs
Change-Id: I6f4114eb3eff2fc5b57f6820883663c3d4d85c35
Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/go/+/432765
Commit-Queue: Tamir Duberstein <tamird@google.com>
Reviewed-by: Pascal Perez <pascallouis@google.com>
diff --git a/regen-fidl b/regen-fidl
index d0ae220..3c9014e 100755
--- a/regen-fidl
+++ b/regen-fidl
@@ -14,8 +14,6 @@
exit 1
fi
-
-
pushd "$FUCHSIA_DIR"
FIDLC=$( fx get-build-artifacts --expect-one --no-build --name fidlc tools )
diff --git a/regen-syscalls b/regen-syscalls
index 7d1c60b..1aee185 100755
--- a/regen-syscalls
+++ b/regen-syscalls
@@ -1,19 +1,25 @@
#!/usr/bin/env bash
-set -euo pipefail
+set -euxo pipefail
-../../scripts/fx ninja -C ../../out/default.zircon \
- host-x64-linux-clang/obj/tools/fidl/fidlc \
- host-x64-linux-clang/obj/tools/kazoo/kazoo.debug
+if [ ! -x "${FUCHSIA_BUILD_DIR}" ]; then
+ echo "error: did you fx exec? missing \$FUCHSIA_BUILD_DIR" 1>&2
+ exit 1
+fi
-../../out/default.zircon/host-x64-linux-clang/obj/tools/fidl/fidlc \
+FIDLC=$( fx get-build-artifacts --expect-one --no-build --name fidlc tools )
+KAZOO=$( fx get-build-artifacts --expect-one --no-build --name kazoo tools )
+
+fx ninja -C "${FUCHSIA_BUILD_DIR}" $FIDLC $KAZOO
+
+"${FUCHSIA_BUILD_DIR}"/$FIDLC \
--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
-../../out/default.zircon/host-x64-linux-clang/obj/tools/kazoo/kazoo.debug \
+"${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 \