diff options
author | Christian Parpart <christian@ethereum.org> | 2018-12-07 19:01:14 +0800 |
---|---|---|
committer | Leonardo Alt <leo@ethereum.org> | 2018-12-10 21:59:55 +0800 |
commit | a3829516f05adc37da77d02b84d578a386f8ecc2 (patch) | |
tree | b8ea14cb2c2b4edb1dd3ab1358d115da6090a079 /scripts | |
parent | 0300e09d3e4f818de7e770bb2d60b0285ae38e91 (diff) | |
download | dexon-solidity-a3829516f05adc37da77d02b84d578a386f8ecc2.tar.gz dexon-solidity-a3829516f05adc37da77d02b84d578a386f8ecc2.tar.zst dexon-solidity-a3829516f05adc37da77d02b84d578a386f8ecc2.zip |
build.sh bash script cleanup
* use `set -e` to abort script execution when error codes fail (and haven't been checked)
* use [[ ]] instead of [ ] or test.
* use ROOTDIR/BUILDDIR variables for better readability
* use mktemp in order to avoid accidental name clashes.
* use `make install` instead of `install ...` as cleaner installation process
* this however doesn't install soltest anymore, which I believe is
right, as normal users should not need it installed in their system.
Those who want to run the test suite, can do so manually
* allow optional passing of more additional custom args to cmake
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build.sh | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/scripts/build.sh b/scripts/build.sh index bddbb97a..6edd60bd 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,28 +1,26 @@ #!/usr/bin/env bash +set -e -if [ -z "$1" ]; then +ROOTDIR="$(dirname "$0")/.." +BUILDDIR="${ROOTDIR}/build" + +if [[ $# -eq 0 ]]; then BUILD_TYPE=Release else BUILD_TYPE="$1" fi -cd $(dirname "$0")/.. && - if [[ "$(git tag --points-at HEAD 2>/dev/null)" == v* ]]; then - touch prerelease.txt + touch "${ROOTDIR}/prerelease.txt" fi -mkdir -p build && -cd build && -cmake .. -DCMAKE_BUILD_TYPE="$BUILD_TYPE" && -make -j2 +mkdir -p "${BUILDDIR}" +cd "${BUILDDIR}" -if [ $? -ne 0 ]; then - echo "Failed to build" - exit 1 -fi +cmake .. -DCMAKE_BUILD_TYPE="$BUILD_TYPE" "${@:2}" +make -j2 -if [ -z $CI ]; then - echo "Installing solc and soltest" - install solc/solc /usr/local/bin && install test/soltest /usr/local/bin +if [[ "${CI}" == "" ]]; then + echo "Installing ..." + sudo make install fi |