make.bash 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. GOVERSION=$(go version | perl -ne '/go version (.*?) / && print $1')
  17. GOMOBILEVERSION=$(gomobile version | perl -ne '/gomobile version (.*?) / && print $1')
  18. LDFLAGS="\
  19. -X github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon.buildDate=$BUILDDATE \
  20. -X github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon.buildRepo=$BUILDREPO \
  21. -X github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon.buildRev=$BUILDREV \
  22. -X github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon.goVersion=$GOVERSION \
  23. -X github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon.gomobileVersion=$GOMOBILEVERSION \
  24. "
  25. echo "Variables for ldflags:"
  26. echo " Build date: ${BUILDDATE}"
  27. echo " Build repo: ${BUILDREPO}"
  28. echo " Build revision: ${BUILDREV}"
  29. echo " Go version: ${GOVERSION}"
  30. echo " Gomobile version: ${GOMOBILEVERSION}"
  31. echo ""
  32. gomobile bind -v -target=android/arm -ldflags="$LDFLAGS" github.com/Psiphon-Labs/psiphon-tunnel-core/AndroidLibrary/psi
  33. if [ $? != 0 ]; then
  34. echo "..'gomobile bind' failed, exiting"
  35. exit $?
  36. fi
  37. echo "Done"