| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | set -euo pipefail |
| 4 | |
| 5 | usage() { |
| 6 | cat <<'EOF' |
| 7 | Usage: scripts/bootstrap-standalone-external.sh [output-dir] |
| 8 | |
| 9 | Generate a local bencch workspace that builds without linked armfortas support. |
| 10 | This keeps compare/introspect/doctor available on the generic external-driver |
| 11 | surface. |
| 12 | |
| 13 | Examples: |
| 14 | scripts/bootstrap-standalone-external.sh |
| 15 | scripts/bootstrap-standalone-external.sh .bencch-external |
| 16 | EOF |
| 17 | } |
| 18 | |
| 19 | if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then |
| 20 | usage |
| 21 | exit 0 |
| 22 | fi |
| 23 | |
| 24 | if [[ $# -gt 1 ]]; then |
| 25 | usage >&2 |
| 26 | exit 1 |
| 27 | fi |
| 28 | |
| 29 | script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 30 | repo_root="$(cd "${script_dir}/.." && pwd)" |
| 31 | output_dir="${1:-${repo_root}/.bencch-external}" |
| 32 | output_dir="$(mkdir -p "${output_dir}" && cd "${output_dir}" && pwd)" |
| 33 | |
| 34 | mkdir -p "${output_dir}/bench" |
| 35 | |
| 36 | cat > "${output_dir}/Cargo.toml" <<EOF |
| 37 | # Generated by scripts/bootstrap-standalone-external.sh |
| 38 | [workspace] |
| 39 | members = ["bench"] |
| 40 | default-members = ["bench"] |
| 41 | resolver = "2" |
| 42 | EOF |
| 43 | |
| 44 | cat > "${output_dir}/bench/Cargo.toml" <<EOF |
| 45 | # Generated by scripts/bootstrap-standalone-external.sh |
| 46 | [package] |
| 47 | name = "afs-tests" |
| 48 | version = "0.1.0" |
| 49 | edition = "2021" |
| 50 | description = "Structured generic compiler bench runner" |
| 51 | build = "../../bench/build.rs" |
| 52 | |
| 53 | [features] |
| 54 | default = [] |
| 55 | linked-armfortas = [] |
| 56 | |
| 57 | [lib] |
| 58 | path = "../../bench/src/lib.rs" |
| 59 | |
| 60 | [[bin]] |
| 61 | name = "afs-tests" |
| 62 | path = "../../bench/src/main.rs" |
| 63 | |
| 64 | [[bin]] |
| 65 | name = "bencch" |
| 66 | path = "../../bench/src/bin/bencch.rs" |
| 67 | |
| 68 | [dependencies] |
| 69 | bencch-core = { path = "../../bench-core" } |
| 70 | EOF |
| 71 | |
| 72 | cat > "${output_dir}/README.md" <<EOF |
| 73 | # Generated external-only workspace |
| 74 | |
| 75 | This directory is generated by scripts/bootstrap-standalone-external.sh. |
| 76 | |
| 77 | It builds bencch without linked armfortas capture. |
| 78 | |
| 79 | Use it with: |
| 80 | |
| 81 | cargo run --manifest-path "${output_dir}/Cargo.toml" -p afs-tests --bin bencch -- doctor |
| 82 | EOF |
| 83 | |
| 84 | echo "Generated external-only workspace at ${output_dir}" |
| 85 | echo |
| 86 | echo "Next step:" |
| 87 | echo " cargo run --manifest-path \"${output_dir}/Cargo.toml\" -p afs-tests --bin bencch -- doctor" |