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.

51 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_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. # TODO: Tools should be "vendored" too.
  17. make get_tools
  18. # Get VENDORED dependencies
  19. make get_vendor_deps
  20. # Build!
  21. # ldflags: -s Omit the symbol table and debug information.
  22. # -w Omit the DWARF symbol table.
  23. echo "==> Building..."
  24. "$(which gox)" \
  25. -os="${XC_OS}" \
  26. -arch="${XC_ARCH}" \
  27. -osarch="!darwin/arm !solaris/amd64 !freebsd/amd64" \
  28. -ldflags "-s -w -X ${GIT_IMPORT}.GitCommit=${GIT_COMMIT}" \
  29. -output "build/pkg/{{.OS}}_{{.Arch}}/tendermint" \
  30. -tags="${BUILD_TAGS}" \
  31. github.com/tendermint/tendermint/cmd/tendermint
  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. exit 0