Commit e3fac65a authored by Jisi Liu's avatar Jisi Liu

Change the build.zip.sh to support lite

parent e8ae137c
#!/bin/bash #!/bin/bash
if [ $# -eq 0 ]; then if [ $# -ne 2 ]; then
cat <<EOF cat <<EOF
Usage: $0 <VERSION_NUMBER> Usage: $0 <TARGET> <VERSION_NUMBER>
TARGET: protoc | protoc-gen-javalite
Example: Example:
$ $0 3.0.0-beta-4 $ $0 protoc 3.0.0
$ $0 protoc-gen-javalite 3.0.0
This script will download pre-built protoc binaries from maven repository This script will download pre-built protoc or protoc plugin binaries from maven
and package them with well-known type .proto files to create .zip packages repository and create .zip packages suitable to be included in the github
suitable to be included in the github release page. Each invocation will release page. If the target is protoc, well-known type .proto files will also be
create 5 zip packages: included. Each invocation will create 5 zip packages:
dist/protoc-<VERSION_NUMBER>-win32.zip dist/<TARGET>-<VERSION_NUMBER>-win32.zip
dist/protoc-<VERSION_NUMBER>-osx-x86_32.zip dist/<TARGET>-<VERSION_NUMBER>-osx-x86_32.zip
dist/protoc-<VERSION_NUMBER>-osx-x86_64.zip dist/<TARGET>-<VERSION_NUMBER>-osx-x86_64.zip
dist/protoc-<VERSION_NUMBER>-linux-x86_32.zip dist/<TARGET>-<VERSION_NUMBER>-linux-x86_32.zip
dist/protoc-<VERSION_NUMBER>-linux-x86_64.zip dist/<TARGET>-<VERSION_NUMBER>-linux-x86_64.zip
EOF EOF
exit 1 exit 1
fi fi
VERSION_NUMBER=$1 TARGET=$1
VERSION_NUMBER=$2
# <zip file name> <binary file name> pairs. # <zip file name> <binary file name> pairs.
declare -a FILE_NAMES=( \ declare -a FILE_NAMES=( \
...@@ -79,16 +83,20 @@ mkdir -p ${DIR}/bin ...@@ -79,16 +83,20 @@ mkdir -p ${DIR}/bin
for((i=0;i<${#FILE_NAMES[@]};i+=2));do for((i=0;i<${#FILE_NAMES[@]};i+=2));do
ZIP_NAME=${FILE_NAMES[$i]} ZIP_NAME=${FILE_NAMES[$i]}
BINARY_NAME=${FILE_NAMES[$(($i+1))]} BINARY_NAME=${FILE_NAMES[$(($i+1))]}
BINARY_URL=http://repo1.maven.org/maven2/com/google/protobuf/protoc/${VERSION_NUMBER}/protoc-${VERSION_NUMBER}-${BINARY_NAME} BINARY_URL=http://repo1.maven.org/maven2/com/google/protobuf/$TARGET/${VERSION_NUMBER}/$TARGET-${VERSION_NUMBER}-${BINARY_NAME}
if ! wget ${BINARY_URL} -O ${DIR}/bin/protoc &> /dev/null; then if ! wget ${BINARY_URL} -O ${DIR}/bin/$TARGET &> /dev/null; then
echo "[ERROR] Failed to download ${BINARY_URL}" >&2 echo "[ERROR] Failed to download ${BINARY_URL}" >&2
echo "[ERROR] Skipped protoc-${VERSION_NAME}-${ZIP_NAME}" >&2 echo "[ERROR] Skipped $TARGET-${VERSION_NAME}-${ZIP_NAME}" >&2
continue continue
fi fi
TARGET_ZIP_FILE=`pwd`/dist/protoc-${VERSION_NUMBER}-${ZIP_NAME} TARGET_ZIP_FILE=`pwd`/dist/$TARGET-${VERSION_NUMBER}-${ZIP_NAME}
pushd $DIR &> /dev/null pushd $DIR &> /dev/null
chmod +x bin/protoc chmod +x bin/$TARGET
zip -r ${TARGET_ZIP_FILE} include bin readme.txt &> /dev/null if [ "$TARGET" = "protoc" ]; then
zip -r ${TARGET_ZIP_FILE} include bin readme.txt &> /dev/null
else
zip -r ${TARGET_ZIP_FILE} bin &> /dev/null
fi
popd &> /dev/null popd &> /dev/null
echo "[INFO] Successfully created ${TARGET_ZIP_FILE}" echo "[INFO] Successfully created ${TARGET_ZIP_FILE}"
done done
...@@ -33,6 +33,10 @@ AM_LDFLAGS = $(PTHREAD_CFLAGS) ...@@ -33,6 +33,10 @@ AM_LDFLAGS = $(PTHREAD_CFLAGS)
# If I say "dist_include_DATA", automake complains that $(includedir) is not # If I say "dist_include_DATA", automake complains that $(includedir) is not
# a "legitimate" directory for DATA. Screw you, automake. # a "legitimate" directory for DATA. Screw you, automake.
protodir = $(includedir) protodir = $(includedir)
# If you are adding new files here, also remember to change the build files for
# all other languages, //protoc-artifacts/build-zip.sh and run
# //update_file_list.sh for bazel.
nobase_dist_proto_DATA = google/protobuf/descriptor.proto \ nobase_dist_proto_DATA = google/protobuf/descriptor.proto \
google/protobuf/any.proto \ google/protobuf/any.proto \
google/protobuf/api.proto \ google/protobuf/api.proto \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment