From 2b8d287d551af6d015c0b802aa50fcf33f4ce538 Mon Sep 17 00:00:00 2001 From: Eugene Kim Date: Thu, 21 Mar 2019 16:49:14 -0700 Subject: [PATCH] Honor HMY_PATH if set --- scripts/setup_bls_build_flags.sh | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/scripts/setup_bls_build_flags.sh b/scripts/setup_bls_build_flags.sh index e5af7f57d..13d4f4695 100644 --- a/scripts/setup_bls_build_flags.sh +++ b/scripts/setup_bls_build_flags.sh @@ -6,15 +6,19 @@ case "${0}" in *) progdir=.;; esac -unset -v gopath -gopath=$(go env GOPATH) -# HMY_PATH is the common root directory of all harmony repos -HMY_PATH="${gopath%%:*}/src/github.com/harmony-one" -if [ ! -d $HMY_PATH ]; then - # "env pwd" uses external pwd(1) implementation and not the Bash built-in, - # which does not fully dereference symlinks. - HMY_PATH=$(cd $progdir/../.. && env pwd) -fi +case "${HMY_PATH+set}" in +"") + unset -v gopath + gopath=$(go env GOPATH) + # HMY_PATH is the common root directory of all harmony repos + HMY_PATH="${gopath%%:*}/src/github.com/harmony-one" + if [ ! -d $HMY_PATH ]; then + # "env pwd" uses external pwd(1) implementation and not the Bash built-in, + # which does not fully dereference symlinks. + HMY_PATH=$(cd $progdir/../.. && env pwd) + fi + ;; +esac : ${OPENSSL_DIR="/usr/local/opt/openssl"} : ${MCL_DIR="${HMY_PATH}/mcl"} : ${BLS_DIR="${HMY_PATH}/bls"}