add HBC_BRANCH to build script

This commit is contained in:
koniifer 2025-02-02 17:18:46 +00:00
parent 259243df3c
commit bde11d7b68

18
build
View file

@ -3,7 +3,8 @@ set -u
SCRIPT_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)"
readonly SCRIPT_DIR
readonly HBC_COMMIT="18e8a831"
readonly HBC_COMMIT="4826e26f"
readonly HBC_BRANCH="memory-rework"
readonly SRC_DIR="$SCRIPT_DIR/src"
readonly TEST_DIR="$SRC_DIR/test"
readonly BUILD_PATH="$SCRIPT_DIR/target"
@ -18,15 +19,16 @@ log() { printf "\033[32mINFO\033[0m: %s\n" "$1"; }
warn() { printf "\033[33mWARN\033[0m: %s\n" "$1"; }
check_hbc() {
command -v hbc >/dev/null 2>&1 && return 0
log "hblang compiler not found in \$PATH"
command -v cargo >/dev/null 2>&1 || die "missing both hbc and cargo"
# ! for now, ignore this.
# command -v hbc >/dev/null 2>&1 && return 0
# log "hblang compiler not found in \$PATH"
# command -v cargo >/dev/null 2>&1 || die "missing both hbc and cargo"
cargo_ver=$(cargo install --list | awk '/holey-bytes/ {if(match($0,/[0-9a-f]+/)) print substr($0,RSTART,8)}')
[ "$cargo_ver" = "$HBC_COMMIT" ] && return 0
# cargo_ver=$(cargo install --list | awk '/holey-bytes/ {if(match($0,/[0-9a-f]+/)) print substr($0,RSTART,8)}')
# [ "$cargo_ver" = "$HBC_COMMIT" ] && return 0
log "installing hbc@$HBC_COMMIT..."
cargo +nightly install --git https://git.ablecorp.us/ableos/holey-bytes hbc --debug --rev "$HBC_COMMIT" >/dev/null 2>&1 ||
log "installing hbc($HBC_BRANCH)@$HBC_COMMIT..."
cargo +nightly install --git https://git.ablecorp.us/ableos/holey-bytes hbc --debug --rev "$HBC_COMMIT" --branch "$HBC_BRANCH" >/dev/null 2>&1 ||
die "failed to install hbc (do you have nightly rust installed?)"
}