| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Builds protoc executable into target/protoc.exe | 3 # Builds protoc executable into target/protoc.exe |
| 4 # To be run from Maven. | 4 # To be run from Maven. |
| 5 # Usage: build-protoc.sh <OS> <ARCH> | 5 # Usage: build-protoc.sh <OS> <ARCH> |
| 6 # <OS> and <ARCH> are ${os.detected.name} and ${os.detected.arch} from os-maven-
plugin | 6 # <OS> and <ARCH> are ${os.detected.name} and ${os.detected.arch} from os-maven-
plugin |
| 7 OS=$1 | 7 OS=$1 |
| 8 ARCH=$2 | 8 ARCH=$2 |
| 9 | 9 |
| 10 if [[ $# < 2 ]]; then | 10 if [[ $# < 2 ]]; then |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 # And they don't work under Mac. | 205 # And they don't work under Mac. |
| 206 if [[ "$OS" != osx ]]; then | 206 if [[ "$OS" != osx ]]; then |
| 207 LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++ -s" | 207 LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++ -s" |
| 208 fi | 208 fi |
| 209 | 209 |
| 210 export CXXFLAGS LDFLAGS | 210 export CXXFLAGS LDFLAGS |
| 211 | 211 |
| 212 TARGET_FILE=target/protoc.exe | 212 TARGET_FILE=target/protoc.exe |
| 213 | 213 |
| 214 cd "$WORKING_DIR"/.. && ./configure $CONFIGURE_ARGS && | 214 cd "$WORKING_DIR"/.. && ./configure $CONFIGURE_ARGS && |
| 215 cd src && make clean && make google/protobuf/stubs/pbconfig.h $MAKE_TARGET && | 215 cd src && make clean && make $MAKE_TARGET && |
| 216 cd "$WORKING_DIR" && mkdir -p target && | 216 cd "$WORKING_DIR" && mkdir -p target && |
| 217 (cp ../src/protoc $TARGET_FILE || cp ../src/protoc.exe $TARGET_FILE) || | 217 (cp ../src/protoc $TARGET_FILE || cp ../src/protoc.exe $TARGET_FILE) || |
| 218 exit 1 | 218 exit 1 |
| 219 | 219 |
| 220 if [[ "$OS" == osx ]]; then | 220 if [[ "$OS" == osx ]]; then |
| 221 # Since Mac linker doesn't accept "-s", we need to run strip | 221 # Since Mac linker doesn't accept "-s", we need to run strip |
| 222 strip $TARGET_FILE || exit 1 | 222 strip $TARGET_FILE || exit 1 |
| 223 fi | 223 fi |
| 224 | 224 |
| 225 checkArch $TARGET_FILE && checkDependencies $TARGET_FILE | 225 checkArch $TARGET_FILE && checkDependencies $TARGET_FILE |
| OLD | NEW |