make.bash 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/env bash
  2. set -e
  3. if [ ! -f make.bash ]; then
  4. echo "make.bash must be run from $GOPATH/src/github.com/Psiphon-Labs/psiphon-tunnel-core/AndroidLibrary"
  5. exit 1
  6. fi
  7. GOOS=arm go get -d -v github.com/Psiphon-Inc/openssl
  8. GOOS=arm go get -d -v ./...
  9. if [ $? != 0 ]; then
  10. echo "..'go get' failed, exiting"
  11. exit $?
  12. fi
  13. BUILDDATE=$(date --iso-8601=seconds)
  14. BUILDREPO=$(git config --get remote.origin.url)
  15. BUILDREV=$(git rev-parse --short HEAD)
  16. LDFLAGS="\
  17. -X github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon.buildDate=$BUILDDATE \
  18. -X github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon.buildRepo=$BUILDREPO \
  19. -X github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon.buildRev=$BUILDREV \
  20. "
  21. echo "Variables for ldflags:"
  22. echo " Build date: ${BUILDDATE}"
  23. echo " Build repo: ${BUILDREPO}"
  24. echo " Build revision: ${BUILDREV}"
  25. echo ""
  26. gomobile bind -v -ldflags="$LDFLAGS" github.com/Psiphon-Labs/psiphon-tunnel-core/AndroidLibrary/psi
  27. if [ $? != 0 ]; then
  28. echo "..'gomobile bind' failed, exiting"
  29. exit $?
  30. fi
  31. echo "Done"