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.

55 lines
1.4 KiB

  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. BINARIES=( "abci-cli" "dummy" "counter" )
  21. for binary in ${BINARIES[@]}; do
  22. # Build!
  23. echo "==> Building..."
  24. "$(which gox)" \
  25. -os="${XC_OS}" \
  26. -arch="${XC_ARCH}" \
  27. -osarch="!darwin/arm !solaris/amd64 !freebsd/amd64" \
  28. -ldflags "-X ${GIT_IMPORT}.GitCommit='${GIT_COMMIT}' -X ${GIT_IMPORT}.GitDescribe='${GIT_DESCRIBE}'" \
  29. -output "build/pkg/{{.OS}}_{{.Arch}}/$binary" \
  30. -tags="${BUILD_TAGS}" \
  31. github.com/tendermint/abci/cmd/$binary
  32. # Zip all the files.
  33. echo "==> Packaging..."
  34. for PLATFORM in $(find ./build/pkg -mindepth 1 -maxdepth 1 -type d); do
  35. OSARCH=$(basename "${PLATFORM}")
  36. echo "--> ${OSARCH}"
  37. pushd "$PLATFORM" >/dev/null 2>&1
  38. zip "../${OSARCH}.zip" ./*
  39. popd >/dev/null 2>&1
  40. done
  41. done
  42. exit 0