github.com/onflow/flow-go/crypto@v0.24.8/build_dependency.sh (about)

     1  #!/bin/bash
     2  
     3  set -euo pipefail
     4  
     5  PKG_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
     6  RELIC_DIR_NAME="relic"
     7  RELIC_DIR="${PKG_DIR}/${RELIC_DIR_NAME}"
     8  
     9  # grant permissions if not existant
    10  if [[ ! -r ${PKG_DIR}  || ! -w ${PKG_DIR} || ! -x ${PKG_DIR} ]]; then
    11     chmod -R 755 "${PKG_DIR}"
    12  fi
    13  
    14  rm -rf "${RELIC_DIR}"
    15  
    16  # relic version or tag
    17  relic_version="7d885d1ba34be61bf22190943a73549a910c1714"
    18  
    19  # clone a specific version of Relic without history if it's tagged.
    20  # git -c http.sslVerify=true clone --branch $(relic_version) --single-branch --depth 1 https://github.com/relic-toolkit/relic.git ${RELIC_DIR_NAME} || { echo "git clone failed"; exit 1; }
    21  
    22  # clone all the history if the version is only defined by a commit hash.
    23  git -c http.sslVerify=true clone --branch main --single-branch https://github.com/relic-toolkit/relic.git ${RELIC_DIR_NAME} || { echo "git clone failed"; exit 1; }
    24  
    25  if [ -d "${RELIC_DIR}" ]
    26  then
    27     (
    28        cd ${RELIC_DIR_NAME} || { echo "cd relic failed"; exit 1; }
    29        git checkout $relic_version
    30     )
    31     # build relic
    32     bash relic_build.sh
    33  else 
    34     { echo "couldn't find relic directory"; exit 1; }
    35  fi
    36