generate_descriptors_proto.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/bash
  2. # This script will generate the common descriptors needed by the Objective C
  3. # runtime.
  4. # HINT: Flags passed to generate_descriptor_proto.sh will be passed directly
  5. # to make when building protoc. This is particularly useful for passing
  6. # -j4 to run 4 jobs simultaneously.
  7. set -eu
  8. readonly ScriptDir=$(dirname "$(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,")")
  9. readonly ProtoRootDir="${ScriptDir}/../.."
  10. readonly ProtoC="${ProtoRootDir}/src/protoc"
  11. pushd "${ProtoRootDir}" > /dev/null
  12. # Compiler build fails if config.h hasn't been made yet (even if configure/etc.
  13. # have been run, so get that made first).
  14. make $@ config.h
  15. # Make sure the compiler is current.
  16. cd src
  17. make $@ protoc
  18. # These really should only be run when the inputs or compiler are newer than
  19. # the outputs.
  20. # Needed by the runtime.
  21. ./protoc --objc_out="${ProtoRootDir}/objectivec" google/protobuf/descriptor.proto
  22. # Well known types that the library provides helpers for.
  23. ./protoc --objc_out="${ProtoRootDir}/objectivec" google/protobuf/timestamp.proto
  24. ./protoc --objc_out="${ProtoRootDir}/objectivec" google/protobuf/duration.proto
  25. popd > /dev/null