generate_csd.sh 1022 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env bash
  2. # A script to generate
  3. # chromium/chrome/common/safe_browsing/csd.pb.{cc,h} for use in
  4. # nsIApplicationReputationQuery. This script assumes you have
  5. # downloaded and installed the protocol buffer compiler.
  6. set -e
  7. if [ "${PROTOC_PATH:+set}" != "set" ]; then
  8. PROTOC_PATH=/usr/local/bin/protoc
  9. fi
  10. echo "Using $PROTOC_PATH as protocol compiler"
  11. if [ ! -e $PROTOC_PATH ]; then
  12. echo "You must install the protocol compiler from " \
  13. "https://github.com/google/protobuf/releases"
  14. exit 1
  15. fi
  16. if [ ! -f nsDownloadManager.cpp ]; then
  17. echo "You must run this script in the toolkit/components/downloads" >&2
  18. echo "directory of the source tree." >&2
  19. exit 1
  20. fi
  21. # Get the protocol buffer and compile it
  22. CSD_PROTO_URL="https://chromium.googlesource.com/chromium/src/+/master/chrome/common/safe_browsing/csd.proto?format=TEXT"
  23. CSD_PATH="chromium/chrome/common/safe_browsing"
  24. curl "$CSD_PROTO_URL" | base64 --decode > "$CSD_PATH"/csd.proto
  25. "$PROTOC_PATH" "$CSD_PATH"/csd.proto --cpp_out=.