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.

40 lines
1.1 KiB

  1. #!/bin/bash
  2. set -ue
  3. # Expect the following envvars to be set:
  4. # - APP
  5. # - VERSION
  6. # - COMMIT
  7. # - TARGET_OS
  8. # - LEDGER_ENABLED
  9. # - DEBUG
  10. # Source builder's functions library
  11. . /usr/local/share/cosmos-sdk/buildlib.sh
  12. # These variables are now available
  13. # - BASEDIR
  14. # - OUTDIR
  15. # Build for each os-architecture pair
  16. for platform in ${TARGET_PLATFORMS} ; do
  17. # This function sets GOOS, GOARCH, and OS_FILE_EXT environment variables
  18. # according to the build target platform. OS_FILE_EXT is empty in all
  19. # cases except when the target platform is 'windows'.
  20. setup_build_env_for_platform "${platform}"
  21. make clean
  22. echo Building for $(go env GOOS)/$(go env GOARCH) >&2
  23. GOROOT_FINAL="$(go env GOROOT)" \
  24. make build LDFLAGS=-buildid=${VERSION} COMMIT=${COMMIT}
  25. mv ./build/${APP}${OS_FILE_EXT} ${OUTDIR}/${APP}-${VERSION}-$(go env GOOS)-$(go env GOARCH)${OS_FILE_EXT}
  26. # This function restore the build environment variables to their
  27. # original state.
  28. restore_build_env
  29. done
  30. # Generate and display build report.
  31. generate_build_report
  32. cat ${OUTDIR}/build_report