temporal | 40ee551 | 2008-07-10 02:12:20 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 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. |
kenton@google.com | 80b1d62 | 2009-07-29 01:13:20 +0000 | [diff] [blame] | 8 | # |
| 9 | # HINT: Flags passed to generate_descriptor_proto.sh will be passed directly |
| 10 | # to make when building protoc. This is particularly useful for passing |
| 11 | # -j4 to run 4 jobs simultaneously. |
temporal | 40ee551 | 2008-07-10 02:12:20 +0000 | [diff] [blame] | 12 | |
temporal | 40ee551 | 2008-07-10 02:12:20 +0000 | [diff] [blame] | 13 | if test ! -e src/google/protobuf/stubs/common.h; then |
| 14 | cat >&2 << __EOF__ |
| 15 | Could not find source code. Make sure you are running this script from the |
| 16 | root of the distribution tree. |
| 17 | __EOF__ |
| 18 | exit 1 |
| 19 | fi |
| 20 | |
| 21 | if test ! -e src/Makefile; then |
| 22 | cat >&2 << __EOF__ |
| 23 | Could not find src/Makefile. You must run ./configure (and perhaps |
| 24 | ./autogen.sh) first. |
| 25 | __EOF__ |
| 26 | exit 1 |
| 27 | fi |
| 28 | |
kenton@google.com | 2f669cb | 2008-12-02 05:59:15 +0000 | [diff] [blame] | 29 | cd src |
Bo Yang | efa666c | 2015-04-30 10:29:47 -0700 | [diff] [blame] | 30 | make $@ google/protobuf/stubs/pbconfig.h |
Jisi Liu | 885b612 | 2015-02-28 14:51:22 -0800 | [diff] [blame] | 31 | CORE_PROTO_IS_CORRECT=0 |
| 32 | while [ $CORE_PROTO_IS_CORRECT -ne 1 ] |
| 33 | do |
| 34 | CORE_PROTO_IS_CORRECT=1 |
| 35 | cp google/protobuf/descriptor.pb.h google/protobuf/descriptor.pb.h.tmp |
| 36 | cp google/protobuf/descriptor.pb.cc google/protobuf/descriptor.pb.cc.tmp |
| 37 | cp google/protobuf/compiler/plugin.pb.h google/protobuf/compiler/plugin.pb.h.tmp |
| 38 | cp google/protobuf/compiler/plugin.pb.cc google/protobuf/compiler/plugin.pb.cc.tmp |
| 39 | |
Jisi Liu | 0b3cfc7 | 2015-03-02 10:54:10 -0800 | [diff] [blame] | 40 | make $@ protoc && |
Jisi Liu | 885b612 | 2015-02-28 14:51:22 -0800 | [diff] [blame] | 41 | ./protoc --cpp_out=dllexport_decl=LIBPROTOBUF_EXPORT:. google/protobuf/descriptor.proto && \ |
| 42 | ./protoc --cpp_out=dllexport_decl=LIBPROTOC_EXPORT:. google/protobuf/compiler/plugin.proto |
| 43 | |
| 44 | diff google/protobuf/descriptor.pb.h google/protobuf/descriptor.pb.h.tmp > /dev/null |
| 45 | if test $? -ne 0; then |
| 46 | CORE_PROTO_IS_CORRECT=0 |
| 47 | fi |
| 48 | diff google/protobuf/descriptor.pb.cc google/protobuf/descriptor.pb.cc.tmp > /dev/null |
| 49 | if test $? -ne 0; then |
| 50 | CORE_PROTO_IS_CORRECT=0 |
| 51 | fi |
| 52 | diff google/protobuf/compiler/plugin.pb.h google/protobuf/compiler/plugin.pb.h.tmp > /dev/null |
| 53 | if test $? -ne 0; then |
| 54 | CORE_PROTO_IS_CORRECT=0 |
| 55 | fi |
| 56 | diff google/protobuf/compiler/plugin.pb.cc google/protobuf/compiler/plugin.pb.cc.tmp > /dev/null |
| 57 | if test $? -ne 0; then |
| 58 | CORE_PROTO_IS_CORRECT=0 |
| 59 | fi |
| 60 | |
| 61 | rm google/protobuf/descriptor.pb.h.tmp |
| 62 | rm google/protobuf/descriptor.pb.cc.tmp |
| 63 | rm google/protobuf/compiler/plugin.pb.h.tmp |
| 64 | rm google/protobuf/compiler/plugin.pb.cc.tmp |
| 65 | done |
kenton@google.com | 2f669cb | 2008-12-02 05:59:15 +0000 | [diff] [blame] | 66 | cd .. |