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.

54 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/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. # Delete the old dir
  17. echo "==> Removing old directory..."
  18. rm -rf build/pkg
  19. mkdir -p build/pkg
  20. # Make sure build tools are available.
  21. make tools
  22. # Get VENDORED dependencies
  23. make get_vendor_deps
  24. # Build!
  25. echo "==> Building..."
  26. "$(which gox)" \
  27. -os="${XC_OS}" \
  28. -arch="${XC_ARCH}" \
  29. -osarch="!darwin/arm !solaris/amd64 !freebsd/amd64" \
  30. -ldflags "-X ${GIT_IMPORT}.GitCommit='${GIT_COMMIT}' -X ${GIT_IMPORT}.GitDescribe='${GIT_DESCRIBE}'" \
  31. -output "build/pkg/{{.OS}}_{{.Arch}}/tendermint" \
  32. -tags="${BUILD_TAGS}" \
  33. github.com/tendermint/tendermint/cmd/tendermint
  34. # Zip all the files.
  35. echo "==> Packaging..."
  36. for PLATFORM in $(find ./build/pkg -mindepth 1 -maxdepth 1 -type d); do
  37. OSARCH=$(basename "${PLATFORM}")
  38. echo "--> ${OSARCH}"
  39. pushd "$PLATFORM" >/dev/null 2>&1
  40. zip "../${OSARCH}.zip" ./*
  41. popd >/dev/null 2>&1
  42. done
  43. exit 0