make.bash 694 B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env sh
  2. set -e
  3. BASE_DIR=$( cd "$(dirname "$0")" ; pwd -P )
  4. cd $BASE_DIR
  5. if [ ! -f make.bash ]; then
  6. echo "make.bash must be run from $GOPATH/src/github.com/Psiphon-Labs/psiphon-tunnel-core/Server"
  7. exit 1
  8. fi
  9. build_for_linux () {
  10. echo "Getting project dependencies (via go get) for Linux. Parameter is: '$1'"
  11. GOOS=linux GOARCH=amd64 go get -d -v ./...
  12. if [ $? != 0 ]; then
  13. echo "...'go get' failed, exiting"
  14. exit $?
  15. fi
  16. GOOS=linux GOARCH=amd64 go build --ldflags '-linkmode external -extldflags "-static"' -o psiphond main.go
  17. if [ $? != 0 ]; then
  18. echo "...'go build' failed, exiting"
  19. exit $?
  20. fi
  21. chmod 777 psiphond
  22. }
  23. build_for_linux
  24. echo "Done"