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.

68 lines
1.5 KiB

  1. #!/bin/bash
  2. # Usage: buildall [-e] [-nocmp] [-work]
  3. #
  4. # Builds everything (std) for every GOOS/GOARCH combination but installs nothing.
  5. #
  6. # By default, runs the builds with -toolexec 'toolstash -cmp', to test that the
  7. # toolchain is producing bit identical output to a previous known good toolchain.
  8. #
  9. # Options:
  10. # -e: stop at first failure
  11. # -nocmp: turn off toolstash -cmp; just check that ordinary builds succeed
  12. # -work: pass -work to go command
  13. sete=false
  14. if [ "$1" = "-e" ]; then
  15. sete=true
  16. shift
  17. fi
  18. cmp=true
  19. if [ "$1" = "-nocmp" ]; then
  20. cmp=false
  21. shift
  22. fi
  23. work=""
  24. if [ "$1" = "-work" ]; then
  25. work="-work"
  26. shift
  27. fi
  28. cd $(go env GOROOT)/src
  29. go install cmd/compile cmd/link cmd/asm || exit 1
  30. pattern="$1"
  31. if [ "$pattern" = "" ]; then
  32. pattern=.
  33. fi
  34. targets="$(go tool dist list; echo linux/386/387)"
  35. targets="$(echo "$targets" | tr '/' '-' | sort | egrep "$pattern" | egrep -v 'android-arm|darwin-arm')"
  36. # put linux, nacl first in the target list to get all the architectures up front.
  37. targets="$(echo "$targets" | egrep 'linux|nacl') $(echo "$targets" | egrep -v 'linux|nacl')"
  38. if [ "$sete" = true ]; then
  39. set -e
  40. fi
  41. for target in $targets
  42. do
  43. echo $target
  44. export GOOS=$(echo $target | sed 's/-.*//')
  45. export GOARCH=$(echo $target | sed 's/.*-//')
  46. unset GO386
  47. if [ "$GOARCH" = "387" ]; then
  48. export GOARCH=386
  49. export GO386=387
  50. fi
  51. if $cmp; then
  52. if [ "$GOOS" = "android" ]; then
  53. go build $work -a -toolexec 'toolstash -cmp' std
  54. else
  55. go build $work -a -toolexec 'toolstash -cmp' std cmd
  56. fi
  57. else
  58. go build $work -a std
  59. fi
  60. done