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.

50 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_IMPORT="github.com/tendermint/tendermint/version"
  12. # Determine the arch/os combos we're building for
  13. XC_ARCH=${XC_ARCH:-"386 amd64 arm"}
  14. XC_OS=${XC_OS:-"solaris darwin freebsd linux windows"}
  15. # Make sure build tools are available.
  16. make tools
  17. # Get VENDORED dependencies
  18. make get_vendor_deps
  19. # Build!
  20. # ldflags: -s Omit the symbol table and debug information.
  21. # -w Omit the DWARF symbol table.
  22. echo "==> Building..."
  23. "$(which gox)" \
  24. -os="${XC_OS}" \
  25. -arch="${XC_ARCH}" \
  26. -osarch="!darwin/arm !solaris/amd64 !freebsd/amd64" \
  27. -ldflags "-s -w -X ${GIT_IMPORT}.GitCommit=${GIT_COMMIT}" \
  28. -output "build/pkg/{{.OS}}_{{.Arch}}/tendermint" \
  29. -tags="${BUILD_TAGS}" \
  30. github.com/tendermint/tendermint/cmd/tendermint
  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