github.com/MetalBlockchain/subnet-evm@v0.4.9/scripts/constants.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  # Set the PATHS
     4  GOPATH="$(go env GOPATH)"
     5  
     6  # Avalabs docker hub
     7  DOCKERHUB_REPO="metalblockchain/metalgo"
     8  
     9  # if this isn't a git repository (say building from a release), don't set our git constants.
    10  if [ ! -d .git ]
    11  then
    12      CURRENT_BRANCH=""
    13      SUBNET_EVM_COMMIT=""
    14      SUBNET_EVM_COMMIT_ID=""
    15  else
    16      # Current branch
    17      CURRENT_BRANCH=${CURRENT_BRANCH:-$(git describe --tags --exact-match 2> /dev/null || git symbolic-ref -q --short HEAD || git rev-parse --short HEAD || :)}
    18  
    19      # Image build id
    20      #
    21      # Use an abbreviated version of the full commit to tag the image.
    22      # WARNING: this will use the most recent commit even if there are un-committed changes present
    23      SUBNET_EVM_COMMIT="$(git --git-dir="$SUBNET_EVM_PATH/.git" rev-parse HEAD || :)"
    24      SUBNET_EVM_COMMIT_ID="${SUBNET_EVM_COMMIT::8}"
    25  fi
    26  
    27  echo "Using branch: ${CURRENT_BRANCH}"
    28  
    29  BUILD_IMAGE_ID=${BUILD_IMAGE_ID:-"$METALGO_VERSION-$SUBNET_EVM_COMMIT_ID"}
    30  
    31  # Static compilation
    32  STATIC_LD_FLAGS=''
    33  if [ "${STATIC_COMPILATION:-}" = 1 ]
    34  then
    35      export CC=musl-gcc
    36      command -v $CC || ( echo $CC must be available for static compilation && exit 1 )
    37      STATIC_LD_FLAGS=' -extldflags "-static" -linkmode external '
    38  fi
    39  
    40  # Set the CGO flags to use the portable version of BLST
    41  #
    42  # We use "export" here instead of just setting a bash variable because we need
    43  # to pass this flag to all child processes spawned by the shell.
    44  export CGO_CFLAGS="-O -D__BLST_PORTABLE__"