From 7c53384332e022c5cac64f601ee0ba5683cba17e Mon Sep 17 00:00:00 2001 From: Amos Robinson Date: Fri, 21 Nov 2025 11:30:08 +1100 Subject: [PATCH] get_fstar_z3: add command-line options to specify arch and kernel For cross-compiling or packaging, it would be useful if the script to get Z3 could get specific architectures. This PR adds --kernel and --arch options to get_fstar_z3.sh. --- .scripts/get_fstar_z3.sh | 54 ++++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 13 deletions(-) diff --git a/.scripts/get_fstar_z3.sh b/.scripts/get_fstar_z3.sh index eb075552b93..8fc82f697bf 100755 --- a/.scripts/get_fstar_z3.sh +++ b/.scripts/get_fstar_z3.sh @@ -96,26 +96,54 @@ full_install_z3() { } usage() { - echo "Usage: get_fstar_z3.sh destination/directory/bin" + echo "Usage: get_fstar_z3.sh destination/directory/bin [--full] [--arch ] [--kernel ]" exit 1 } -if [ $# -ge 1 ] && [ "$1" == "--full" ]; then - # Passing --full xyz/ will create a tree like - # xyz/z3-4.8.5/bin/z3 - # xyz/z3-4.13.3/bin/z3 - # (plus all other files in each package). This is used - # for our binary packages which include Z3. - full_install=true; - shift; -fi +dest_dir_set=false +while [ $# -ge 1 ]; do + case "$1" in + --arch) + shift + if [ $# -lt 1 ]; then usage; fi + arch="$1" + ;; + --kernel) + shift + if [ $# -lt 1 ]; then usage; fi + kernel="$1" + ;; + --full) + # Passing --full xyz/ will create a tree like + # xyz/z3-4.8.5/bin/z3 + # xyz/z3-4.13.3/bin/z3 + # (plus all other files in each package). This is used + # for our binary packages which include Z3. + full_install=true; + ;; + --*) + usage + ;; + --) + if $dest_dir_set; then usage; fi + shift + if [ $# -lt 1 ]; then usage; fi + dest_dir="$1" + dest_dir_set=true + ;; + *) + if $dest_dir_set; then usage; fi + dest_dir="$1" + dest_dir_set=true + ;; + esac + shift +done -if [ $# -ne 1 ]; then +if [ "$dest_dir_set" == "false" ]; then usage fi -dest_dir="$1" - mkdir -p "$dest_dir" for z3_ver in 4.8.5 4.13.3 4.15.3; do