build.sh 867 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env bash
  2. # List of arches
  3. #darwin_386 freebsd_386 freebsd_arm linux_amd64 netbsd_386 netbsd_arm openbsd_386 plan9_386 windows_386
  4. #darwin_amd64 freebsd_amd64 linux_386 linux_arm netbsd_amd64 obj openbsd_amd64 tool windows_amd64
  5. mkdir bin >/dev/null 2>&1
  6. export BINARY=`basename $PWD`_
  7. export GOOS=$1
  8. export GOARCH=$2
  9. export GOARM=$3
  10. export CGO_ENABLED=0
  11. case $GOOS in
  12. windows)
  13. go build -o "./bin/`echo $BINARY``echo $GOOS`_`echo $GOARCH`.exe"
  14. ;;
  15. linux)
  16. case $GOARCH in
  17. arm)
  18. go build -o "./bin/`echo $BINARY``echo $GOOS`_`echo $GOARCH$GOARM`"
  19. ;;
  20. *)
  21. go build -o "./bin/`echo $BINARY``echo $GOOS`_`echo $GOARCH`"
  22. ;;
  23. esac
  24. ;;
  25. *)
  26. go build -o "./bin/`echo $BINARY``echo $GOOS`_`echo $GOARCH`"
  27. ;;
  28. esac
  29. echo -n "finished building for: "
  30. echo -n $GOOS
  31. echo -n "_"
  32. echo $GOARCH