diff options
author | Ting-Wei Lan <tingwei.lan@cobinhood.com> | 2019-04-12 18:22:50 +0800 |
---|---|---|
committer | Ting-Wei Lan <tingwei.lan@cobinhood.com> | 2019-04-25 13:48:06 +0800 |
commit | 949505a4bccb95437f7b992597175e16b9a4fae3 (patch) | |
tree | 6f9d9630bf6f594a6815eee7ed7f0caea7272633 /bin | |
parent | 3939c62ed80c59f1a06bf0978598b1ea2c40a496 (diff) | |
download | dexon-consensus-wip/lantw/license-makefile-shell-scripts.tar dexon-consensus-wip/lantw/license-makefile-shell-scripts.tar.gz dexon-consensus-wip/lantw/license-makefile-shell-scripts.tar.bz2 dexon-consensus-wip/lantw/license-makefile-shell-scripts.tar.lz dexon-consensus-wip/lantw/license-makefile-shell-scripts.tar.xz dexon-consensus-wip/lantw/license-makefile-shell-scripts.tar.zst dexon-consensus-wip/lantw/license-makefile-shell-scripts.zip |
Merge Makefile and shell script improvements from an internal projectwip/lantw/license-makefile-shell-scripts
The Makefile used in this project was based on the one used in an
internal project. Since the Makefile and shell scripts have been
refactored several times and become easier to use, it should be good to
bring these improvements to the project.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/env.sh | 1 | ||||
-rwxr-xr-x | bin/install_dkg_dep.sh | 19 | ||||
-rwxr-xr-x | bin/install_eth_dep.sh | 14 | ||||
-rwxr-xr-x | bin/install_tools.sh | 14 |
4 files changed, 25 insertions, 23 deletions
@@ -1,4 +1,5 @@ # Environment variables for the project. +# shellcheck shell=dash disable=SC2155 export GITROOT=$(git rev-parse --show-toplevel) diff --git a/bin/install_dkg_dep.sh b/bin/install_dkg_dep.sh index 7d02437..b87e3e4 100755 --- a/bin/install_dkg_dep.sh +++ b/bin/install_dkg_dep.sh @@ -1,4 +1,6 @@ -#!/bin/bash +#!/bin/sh + +: "${MAKE:="make"}" if [ -e .dep/dkg ]; then exit 0 @@ -6,13 +8,14 @@ fi if [ ! -d .dep/dkg ]; then mkdir -p .dep/dkg - cd .dep/dkg - git clone --depth 1 -b master git://github.com/dexon-foundation/bls.git & - git clone --depth 1 -b master git://github.com/dexon-foundation/mcl.git & - wait - cd bls - make test_go -j MCL_USE_OPENSSL=0 - cd ../../../ + ( + cd .dep/dkg || exit + git clone --depth 1 -b master git://github.com/dexon-foundation/bls.git & + git clone --depth 1 -b master git://github.com/dexon-foundation/mcl.git & + wait + cd bls || exit + eval "${MAKE} test_go -j MCL_USE_OPENSSL=0" + ) || exit fi cd vendor/github.com/dexon-foundation && rm -rf bls mcl ln -s ../../../.dep/dkg/* . diff --git a/bin/install_eth_dep.sh b/bin/install_eth_dep.sh index 79ecd0e..ea15348 100755 --- a/bin/install_eth_dep.sh +++ b/bin/install_eth_dep.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh if [ -e .dep/libsecp256k1 ]; then exit 0 @@ -7,14 +7,10 @@ fi rm -rf vendor/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1 if [ ! -d .dep/libsecp256k1 ]; then git init .dep/libsecp256k1 - cd .dep/libsecp256k1 - git remote add origin https://github.com/ethereum/go-ethereum.git - git config core.sparsecheckout true - echo "crypto/secp256k1/libsecp256k1/*" >> .git/info/sparse-checkout - cd ../../ + git -C .dep/libsecp256k1 remote add origin https://github.com/ethereum/go-ethereum.git + git -C .dep/libsecp256k1 config core.sparsecheckout true + echo 'crypto/secp256k1/libsecp256k1/*' >> .dep/libsecp256k1/.git/info/sparse-checkout fi -cd .dep/libsecp256k1 -git pull --depth=1 origin master -cd ../../ +git -C .dep/libsecp256k1 pull --depth=1 origin master cp -r .dep/libsecp256k1/crypto/secp256k1/libsecp256k1 \ vendor/github.com/ethereum/go-ethereum/crypto/secp256k1 diff --git a/bin/install_tools.sh b/bin/install_tools.sh index bef77f7..857d447 100755 --- a/bin/install_tools.sh +++ b/bin/install_tools.sh @@ -1,11 +1,13 @@ #!/bin/sh -if ! which dep >/dev/null 2>&1; then - go get -u github.com/golang/dep/cmd/dep +: "${GO:="go"}" + +if ! command -v dep >/dev/null 2>&1; then + eval "${GO} get -u ${GO_BUILD_FLAGS} github.com/golang/dep/cmd/dep" fi -if ! which golint >/dev/null 2>&1; then - go get -u golang.org/x/lint/golint +if ! command -v golint >/dev/null 2>&1; then + eval "${GO} get -u ${GO_BUILD_FLAGS} golang.org/x/lint/golint" fi -if ! which gosec >/dev/null 2>&1; then - go get github.com/securego/gosec/cmd/gosec/... +if ! command -v gosec >/dev/null 2>&1; then + eval "${GO} get -u ${GO_BUILD_FLAGS} github.com/securego/gosec/cmd/gosec/..." fi |