OSDN Git Service

new repo
[bytom/vapor.git] / vendor / github.com / tendermint / abci / scripts / dist.sh
1 #!/usr/bin/env bash
2 set -e
3
4 REPO_NAME="abci"
5
6 # Get the version from the environment, or try to figure it out.
7 if [ -z $VERSION ]; then
8         VERSION=$(awk -F\" '/Version =/ { print $2; exit }' < version/version.go)
9 fi
10 if [ -z "$VERSION" ]; then
11     echo "Please specify a version."
12     exit 1
13 fi
14 echo "==> Building version $VERSION..."
15
16 # Get the parent directory of where this script is.
17 SOURCE="${BASH_SOURCE[0]}"
18 while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
19 DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"
20
21 # Change into that dir because we expect that.
22 cd "$DIR"
23
24 # Delete the old dir
25 echo "==> Removing old directory..."
26 rm -rf build/pkg
27 mkdir -p build/pkg
28
29
30 # Do a hermetic build inside a Docker container.
31 docker build -t tendermint/${REPO_NAME}-builder scripts/${REPO_NAME}-builder/
32 docker run --rm -e "BUILD_TAGS=$BUILD_TAGS" -v "$(pwd)":/go/src/github.com/tendermint/${REPO_NAME} tendermint/${REPO_NAME}-builder ./scripts/dist_build.sh
33
34 # Add $REPO_NAME and $VERSION prefix to package name.
35 rm -rf ./build/dist
36 mkdir -p ./build/dist
37 for FILENAME in $(find ./build/pkg -mindepth 1 -maxdepth 1 -type f); do
38   FILENAME=$(basename "$FILENAME")
39         cp "./build/pkg/${FILENAME}" "./build/dist/${REPO_NAME}_${VERSION}_${FILENAME}"
40 done
41
42 # Make the checksums.
43 pushd ./build/dist
44 shasum -a256 ./* > "./${REPO_NAME}_${VERSION}_SHA256SUMS"
45 popd
46
47 # Done
48 echo
49 echo "==> Results:"
50 ls -hl ./build/dist
51
52 exit 0