Initial import of v2.0.0beta
[protobuf.git] / generate_descriptor_proto.sh
blob53e88e67fae735900df8c58ac488e47f5110c02f
1 #!/bin/sh
3 # Run this script to regenerate descriptor.pb.{h,cc} after the protocol
4 # compiler changes. Since these files are compiled into the protocol compiler
5 # itself, they cannot be generated automatically by a make rule. "make check"
6 # will fail if these files do not match what the protocol compiler would
7 # generate.
9 # Note that this will always need to be run once after running
10 # extract_from_google3.sh. That script initially copies descriptor.pb.{h,cc}
11 # over from the google3 code and fixes it up to compile outside of google3, but
12 # it cannot fix the encoded descriptor embedded in descriptor.pb.cc. So, once
13 # the protocol compiler has been built with the slightly-broken
14 # descriptor.pb.cc, the files must be regenerated and the compiler must be
15 # built again.
17 if test ! -e src/google/protobuf/stubs/common.h; then
18 cat >&2 << __EOF__
19 Could not find source code. Make sure you are running this script from the
20 root of the distribution tree.
21 __EOF__
22 exit 1
25 if test ! -e src/Makefile; then
26 cat >&2 << __EOF__
27 Could not find src/Makefile. You must run ./configure (and perhaps
28 ./autogen.sh) first.
29 __EOF__
30 exit 1
33 pushd src
34 make protoc && ./protoc --cpp_out=dllexport_decl=LIBPROTOBUF_EXPORT:. google/protobuf/descriptor.proto
35 popd