caffe 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/bash
  2. set -e
  3. pushd $(cd $(dirname ${0})/..; pwd) > /dev/null
  4. clean() {
  5. echo "caffe clean"
  6. rm -rf "./third_party/source/caffe"
  7. }
  8. sync() {
  9. echo "caffe sync"
  10. mkdir -p "./third_party/source/caffe/src/caffe/proto"
  11. curl --silent --show-error --location --output "./third_party/source/caffe/src/caffe/proto/caffe.proto" "https://github.com/BVLC/caffe/raw/master/src/caffe/proto/caffe.proto"
  12. }
  13. schema() {
  14. echo "caffe schema"
  15. [[ $(grep -U $'\x0D' ./source/caffe-proto.js) ]] && crlf=1
  16. temp=$(mktemp -d)
  17. node ./tools/caffe-script.js ./third_party/source/caffe/src/caffe/proto/caffe.proto ${temp}/caffe.proto
  18. node ./tools/protoc.js --binary --text --root caffe --out ./source/caffe-proto.js ${temp}/caffe.proto
  19. rm -rf ${temp}
  20. if [[ -n ${crlf} ]]; then
  21. unix2dos --quiet --newfile ./source/caffe-proto.js ./source/caffe-proto.js
  22. fi
  23. }
  24. while [ "$#" != 0 ]; do
  25. command="$1" && shift
  26. case "${command}" in
  27. "clean") clean;;
  28. "sync") sync;;
  29. "schema") schema;;
  30. esac
  31. done