gitlab.com/flarenetwork/coreth@v0.1.1/scripts/build.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  set -o errexit
     4  set -o nounset
     5  set -o pipefail
     6  
     7  # Avalanche root directory
     8  CORETH_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd )
     9  
    10  # Load the versions
    11  source "$CORETH_PATH"/scripts/versions.sh
    12  
    13  # Load the constants
    14  source "$CORETH_PATH"/scripts/constants.sh
    15  
    16  if [[ $# -eq 1 ]]; then
    17      binary_path=$1
    18  elif [[ $# -ne 0 ]]; then
    19      echo "Invalid arguments to build coreth. Requires either no arguments (default) or one arguments to specify binary location."
    20      exit 1
    21  fi
    22  
    23  # Check if CORETH_COMMIT is set, if not retrieve the last commit from the repo.
    24  # This is used in the Dockerfile to allow a commit hash to be passed in without
    25  # including the .git/ directory within the Docker image.
    26  coreth_commit=${CORETH_COMMIT:-$( git rev-list -1 HEAD )}
    27  
    28  # Build Coreth, which is run as a subprocess
    29  echo "Building Coreth Version: $coreth_version; GitCommit: $coreth_commit"
    30  go build -ldflags "-X gitlab.com/flarenetwork/coreth/plugin/evm.GitCommit=$coreth_commit -X gitlab.com/flarenetwork/coreth/plugin/evm.Version=$coreth_version" -o "$binary_path" "plugin/"*.go