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.

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