diff options
author | Jisi Liu <liujisi@google.com> | 2016-07-26 16:51:47 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-26 16:51:47 -0700 |
commit | 7ba044a1c051c61066648b2b4fc80bbbcbe2c79b (patch) | |
tree | 2df0985deb604e24d35bdcf805f03a9be157b3aa /protoc-artifacts/build-protoc.sh | |
parent | b6b521b6b735a0d88432ac621e618dc837cb9509 (diff) | |
parent | 7c9c314ca7641672587d28426a05113e952d4e10 (diff) | |
download | protobuf-7ba044a1c051c61066648b2b4fc80bbbcbe2c79b.tar.gz protobuf-7ba044a1c051c61066648b2b4fc80bbbcbe2c79b.tar.bz2 protobuf-7ba044a1c051c61066648b2b4fc80bbbcbe2c79b.zip |
Merge pull request #1853 from pherl/3.0.0-GA
Make protoc-artifacts able to build plugins.
Diffstat (limited to 'protoc-artifacts/build-protoc.sh')
-rwxr-xr-x | protoc-artifacts/build-protoc.sh | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/protoc-artifacts/build-protoc.sh b/protoc-artifacts/build-protoc.sh index 88e6ae50..328d6731 100755 --- a/protoc-artifacts/build-protoc.sh +++ b/protoc-artifacts/build-protoc.sh @@ -1,17 +1,30 @@ #!/bin/bash -# Builds protoc executable into target/protoc.exe +# Builds protoc executable into target/protoc.exe; optionally build protoc +# plugins into target/protoc-gen-*.exe # To be run from Maven. -# Usage: build-protoc.sh <OS> <ARCH> +# Usage: build-protoc.sh <OS> <ARCH> <TARGET> # <OS> and <ARCH> are ${os.detected.name} and ${os.detected.arch} from os-maven-plugin +# <TARGET> can be "protoc" or "protoc-gen-javalite" OS=$1 ARCH=$2 +MAKE_TARGET=$3 -if [[ $# < 2 ]]; then +if [[ $# < 3 ]]; then echo "No arguments provided. This script is intended to be run from Maven." exit 1 fi +case $MAKE_TARGET in + protoc-gen-javalite) + ;; + protoc) + ;; + *) + echo "Target ""$TARGET"" invalid." + exit 1 +esac + # Under Cygwin, bash doesn't have these in PATH when called from Maven which # runs in Windows version of Java. export PATH="/bin:/usr/bin:$PATH" @@ -126,7 +139,7 @@ checkDependencies () } ############################################################################ -echo "Building protoc, OS=$OS ARCH=$ARCH" +echo "Building protoc, OS=$OS ARCH=$ARCH TARGET=$TARGET" # Nested double quotes are unintuitive, but it works. cd "$(dirname "$0")" @@ -134,7 +147,6 @@ cd "$(dirname "$0")" WORKING_DIR=$(pwd) CONFIGURE_ARGS="--disable-shared" -MAKE_TARGET="protoc" if [[ "$OS" == windows ]]; then MAKE_TARGET="${MAKE_TARGET}.exe" fi @@ -209,12 +221,13 @@ fi export CXXFLAGS LDFLAGS -TARGET_FILE=target/protoc.exe +TARGET_FILE=target/$MAKE_TARGET.exe cd "$WORKING_DIR"/.. && ./configure $CONFIGURE_ARGS && - cd src && make clean && make $MAKE_TARGET && + cd src && make clean && make $MAKE_TARGET -j4 && cd "$WORKING_DIR" && mkdir -p target && - (cp ../src/protoc $TARGET_FILE || cp ../src/protoc.exe $TARGET_FILE) || + (cp ../src/$MAKE_TARGET $TARGET_FILE || + cp ../src/$MAKE_TARGET.exe $TARGET_FILE) || exit 1 if [[ "$OS" == osx ]]; then |