OSDN Git Service

new repo
[bytom/vapor.git] / vendor / github.com / tendermint / abci / scripts / dist_build.sh
1 #!/usr/bin/env bash
2 set -e
3
4 # Get the parent directory of where this script is.
5 SOURCE="${BASH_SOURCE[0]}"
6 while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
7 DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"
8
9 # Change into that dir because we expect that.
10 cd "$DIR"
11
12 # Get the git commit
13 GIT_COMMIT="$(git rev-parse --short HEAD)"
14 GIT_DESCRIBE="$(git describe --tags --always)"
15 GIT_IMPORT="github.com/tendermint/abci/version"
16
17 # Determine the arch/os combos we're building for
18 XC_ARCH=${XC_ARCH:-"386 amd64 arm"}
19 XC_OS=${XC_OS:-"solaris darwin freebsd linux windows"}
20
21 # Make sure build tools are available.
22 make tools
23
24 # Get VENDORED dependencies
25 make get_vendor_deps
26
27 BINARY="abci-cli"
28
29 # Build!
30 echo "==> Building..."
31 "$(which gox)" \
32                 -os="${XC_OS}" \
33                 -arch="${XC_ARCH}" \
34                 -osarch="!darwin/arm !solaris/amd64 !freebsd/amd64" \
35                 -ldflags "-X ${GIT_IMPORT}.GitCommit='${GIT_COMMIT}' -X ${GIT_IMPORT}.GitDescribe='${GIT_DESCRIBE}'" \
36                 -output "build/pkg/{{.OS}}_{{.Arch}}/$BINARY" \
37                 -tags="${BUILD_TAGS}" \
38                 github.com/tendermint/abci/cmd/$BINARY
39
40 # Zip all the files.
41 echo "==> Packaging..."
42 for PLATFORM in $(find ./build/pkg -mindepth 1 -maxdepth 1 -type d); do
43                 OSARCH=$(basename "${PLATFORM}")
44                 echo "--> ${OSARCH}"
45
46                 pushd "$PLATFORM" >/dev/null 2>&1
47                 zip "../${OSARCH}.zip" ./*
48                 popd >/dev/null 2>&1
49 done
50
51
52
53 exit 0