build.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. IFS=$'\n\t'
  4. STTRACE=${STTRACE:-}
  5. script() {
  6. name="$1"
  7. shift
  8. go run "script/$name.go" "$@"
  9. }
  10. build() {
  11. go run build.go "$@"
  12. }
  13. case "${1:-default}" in
  14. default)
  15. build
  16. ;;
  17. clean)
  18. build "$@"
  19. ;;
  20. tar)
  21. build "$@"
  22. ;;
  23. assets)
  24. build "$@"
  25. ;;
  26. xdr)
  27. build "$@"
  28. ;;
  29. translate)
  30. build "$@"
  31. ;;
  32. deb)
  33. build "$@"
  34. ;;
  35. setup)
  36. build "$@"
  37. ;;
  38. test)
  39. LOGGER_DISCARD=1 build test
  40. ;;
  41. bench)
  42. LOGGER_DISCARD=1 build bench | script benchfilter
  43. ;;
  44. prerelease)
  45. go run script/authors.go
  46. build transifex
  47. pushd man ; ./refresh.sh ; popd
  48. git add -A gui man
  49. git commit -m 'gui, man: Update docs & translations'
  50. ;;
  51. noupgrade)
  52. build -no-upgrade tar
  53. ;;
  54. all)
  55. platforms=(
  56. darwin-amd64 dragonfly-amd64 freebsd-amd64 linux-amd64 netbsd-amd64 openbsd-amd64 solaris-amd64 windows-amd64
  57. freebsd-386 linux-386 netbsd-386 openbsd-386 windows-386
  58. linux-arm linux-arm64 linux-ppc64 linux-ppc64le
  59. )
  60. for plat in "${platforms[@]}"; do
  61. echo Building "$plat"
  62. goos="${plat%-*}"
  63. goarch="${plat#*-}"
  64. dist="tar"
  65. if [[ $goos == "windows" ]]; then
  66. dist="zip"
  67. fi
  68. build -goos "$goos" -goarch "$goarch" "$dist"
  69. echo
  70. done
  71. ;;
  72. test-xunit)
  73. (GOPATH="$(pwd)/Godeps/_workspace:$GOPATH" go test -v -race ./lib/... ./cmd/... || true) > tests.out
  74. go2xunit -output tests.xml -fail < tests.out
  75. ;;
  76. *)
  77. echo "Unknown build command $1"
  78. ;;
  79. esac