You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.3 KiB

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