From 3a602734b67c4e04dce48971d510af9345e07e2b Mon Sep 17 00:00:00 2001 From: Aaron Buchwald Date: Mon, 6 Feb 2023 10:16:56 -0800 Subject: [PATCH] Add generate precompile script to fix CGO flags issue --- scripts/generate_precompile.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 scripts/generate_precompile.sh diff --git a/scripts/generate_precompile.sh b/scripts/generate_precompile.sh new file mode 100755 index 0000000000..8876880659 --- /dev/null +++ b/scripts/generate_precompile.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +set -e + +# This script generates a Stateful Precompile stub based off of a Solidity ABI file. +# It first sets the necessary CGO_FLAGs for the BLST library used in AvalancheGo and +# then runs PrecompileGen. +if ! [[ "$0" =~ scripts/generate_precompile.sh ]]; then + echo "must be run from repository root, but got $0" + exit 255 +fi + +# Load the versions +SUBNET_EVM_PATH=$( + cd "$(dirname "${BASH_SOURCE[0]}")" + cd .. && pwd +) + +# Load the constants +source "$SUBNET_EVM_PATH"/scripts/constants.sh + +go run ./cmd/precompilegen/main.go $@