| 1 |
#!/usr/bin/env bash |
| 2 |
# |
| 3 |
# Copyright 2024 The Fuchsia Authors |
| 4 |
# |
| 5 |
# Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0 |
| 6 |
# <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT |
| 7 |
# license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option. |
| 8 |
# This file may not be copied, modified, or distributed except according to |
| 9 |
# those terms. |
| 10 |
|
| 11 |
set -eo pipefail |
| 12 |
|
| 13 |
ZEROCOPY_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" |
| 14 |
REPO_DIR="$(dirname "$ZEROCOPY_DIR")" |
| 15 |
|
| 16 |
# Build `cargo-zerocopy` without any RUSTFLAGS or CARGO_TARGET_DIR set in the |
| 17 |
# environment. Build it from the repository root so that Zerocopy's vendoring |
| 18 |
# config does not apply to the unvendored tools workspace. |
| 19 |
( |
| 20 |
cd "$REPO_DIR" |
| 21 |
env -u RUSTFLAGS -u CARGO_TARGET_DIR cargo +stable build --manifest-path tools/cargo-zerocopy/Cargo.toml -p cargo-zerocopy -q |
| 22 |
) |
| 23 |
|
| 24 |
cd "$ZEROCOPY_DIR" |
| 25 |
exec "$REPO_DIR/tools/target/debug/cargo-zerocopy" "$@" |