Commit 7ba4a99e authored by salamaniibm's avatar salamaniibm Committed by Adam Cozzette

adding protoc support for s390x

parent 36bdcb5a
...@@ -11,16 +11,20 @@ git submodule update --init --recursive ...@@ -11,16 +11,20 @@ git submodule update --init --recursive
# Generate the configure script. # Generate the configure script.
./autogen.sh ./autogen.sh
# Cross-build for aarch64 and ppc64le. Note: we do these builds first to avoid # Cross-build for aarch64, ppc64le and s390x. Note: we do these builds first to avoid
# file permission issues. The Docker builds will create directories owned by # file permission issues. The Docker builds will create directories owned by
# root, which causes problems if we try to add new artifacts to those # root, which causes problems if we try to add new artifacts to those
# directories afterward. # directories afterward.
sudo apt install -y g++-aarch64-linux-gnu sudo apt install -y g++-aarch64-linux-gnu
protoc-artifacts/build-protoc.sh linux aarch_64 protoc protoc-artifacts/build-protoc.sh linux aarch_64 protoc
sudo apt install -y g++-powerpc64le-linux-gnu sudo apt install -y g++-powerpc64le-linux-gnu
protoc-artifacts/build-protoc.sh linux ppcle_64 protoc protoc-artifacts/build-protoc.sh linux ppcle_64 protoc
sudo apt install -y g++-s390x-linux-gnu
protoc-artifacts/build-protoc.sh linux s390x_64 protoc
# Use docker image to build linux artifacts. # Use docker image to build linux artifacts.
DOCKER_IMAGE_NAME=protobuf/protoc_$(sha1sum protoc-artifacts/Dockerfile | cut -f1 -d " ") DOCKER_IMAGE_NAME=protobuf/protoc_$(sha1sum protoc-artifacts/Dockerfile | cut -f1 -d " ")
docker pull $DOCKER_IMAGE_NAME docker pull $DOCKER_IMAGE_NAME
......
...@@ -123,6 +123,8 @@ target directory layout: ...@@ -123,6 +123,8 @@ target directory layout:
protoc.exe protoc.exe
+ ppcle_64 + ppcle_64
protoc.exe protoc.exe
+ s390x_64
protoc.exe
+ osx + osx
+ x86_64 + x86_64
protoc.exe protoc.exe
...@@ -169,6 +171,7 @@ dist/protoc-3.6.0-linux-x86_32.zip ...@@ -169,6 +171,7 @@ dist/protoc-3.6.0-linux-x86_32.zip
dist/protoc-3.6.0-linux-x86_64.zip dist/protoc-3.6.0-linux-x86_64.zip
dist/protoc-3.6.0-linux-aarch_64.zip dist/protoc-3.6.0-linux-aarch_64.zip
dist/protoc-3.6.0-linux-ppcle_64.zip dist/protoc-3.6.0-linux-ppcle_64.zip
dist/protoc-3.6.0-linux-s390x_64.zip
``` ```
Before running the script, make sure the artifacts are accessible from: Before running the script, make sure the artifacts are accessible from:
......
...@@ -93,6 +93,12 @@ checkArch () ...@@ -93,6 +93,12 @@ checkArch ()
assertEq $format "elf64-x86-64" $LINENO assertEq $format "elf64-x86-64" $LINENO
elif [[ "$ARCH" == aarch_64 ]]; then elif [[ "$ARCH" == aarch_64 ]]; then
assertEq $format "elf64-little" $LINENO assertEq $format "elf64-little" $LINENO
elif [[ "$ARCH" == s390x_64 ]]; then
if [[ $host_machine == s390x ]];then
assertEq $format "elf64-s390" $LINENO
else
assertEq $format "elf64-big" $LINENO
fi
elif [[ "$ARCH" == ppcle_64 ]]; then elif [[ "$ARCH" == ppcle_64 ]]; then
if [[ $host_machine == ppc64le ]];then if [[ $host_machine == ppc64le ]];then
assertEq $format "elf64-powerpcle" $LINENO assertEq $format "elf64-powerpcle" $LINENO
...@@ -143,6 +149,11 @@ checkDependencies () ...@@ -143,6 +149,11 @@ checkDependencies ()
white_list="linux-gate\.so\.1\|libpthread\.so\.0\|libm\.so\.6\|libc\.so\.6\|ld-linux\.so\.2" white_list="linux-gate\.so\.1\|libpthread\.so\.0\|libm\.so\.6\|libc\.so\.6\|ld-linux\.so\.2"
elif [[ "$ARCH" == x86_64 ]]; then elif [[ "$ARCH" == x86_64 ]]; then
white_list="linux-vdso\.so\.1\|libpthread\.so\.0\|libm\.so\.6\|libc\.so\.6\|ld-linux-x86-64\.so\.2" white_list="linux-vdso\.so\.1\|libpthread\.so\.0\|libm\.so\.6\|libc\.so\.6\|ld-linux-x86-64\.so\.2"
elif [[ "$ARCH" == s390x_64 ]]; then
if [[ $host_machine != s390x ]];then
dump_cmd='objdump -p '"$1"' | grep NEEDED'
fi
white_list="linux-vdso64\.so\.1\|libpthread\.so\.0\|libm\.so\.6\|libc\.so\.6\|libz\.so\.1\|ld64\.so\.1"
elif [[ "$ARCH" == ppcle_64 ]]; then elif [[ "$ARCH" == ppcle_64 ]]; then
if [[ $host_machine != ppc64le ]];then if [[ $host_machine != ppc64le ]];then
dump_cmd='objdump -p '"$1"' | grep NEEDED' dump_cmd='objdump -p '"$1"' | grep NEEDED'
...@@ -215,6 +226,9 @@ elif [[ "$(uname)" == Linux* ]]; then ...@@ -215,6 +226,9 @@ elif [[ "$(uname)" == Linux* ]]; then
elif [[ "$ARCH" == ppcle_64 ]]; then elif [[ "$ARCH" == ppcle_64 ]]; then
CXXFLAGS="$CXXFLAGS -m64" CXXFLAGS="$CXXFLAGS -m64"
CONFIGURE_ARGS="$CONFIGURE_ARGS --host=powerpc64le-linux-gnu" CONFIGURE_ARGS="$CONFIGURE_ARGS --host=powerpc64le-linux-gnu"
elif [[ "$ARCH" == s390x_64 ]]; then
CXXFLAGS="$CXXFLAGS -m64"
CONFIGURE_ARGS="$CONFIGURE_ARGS --host=s390x-linux-gnu"
else else
fail "Unsupported arch: $ARCH" fail "Unsupported arch: $ARCH"
fi fi
......
...@@ -13,7 +13,7 @@ Example: ...@@ -13,7 +13,7 @@ Example:
This script will download pre-built protoc or protoc plugin binaries from maven This script will download pre-built protoc or protoc plugin binaries from maven
repository and create .zip packages suitable to be included in the github repository and create .zip packages suitable to be included in the github
release page. If the target is protoc, well-known type .proto files will also be release page. If the target is protoc, well-known type .proto files will also be
included. Each invocation will create 8 zip packages: included. Each invocation will create 9 zip packages:
dist/<TARGET>-<VERSION_NUMBER>-win32.zip dist/<TARGET>-<VERSION_NUMBER>-win32.zip
dist/<TARGET>-<VERSION_NUMBER>-win64.zip dist/<TARGET>-<VERSION_NUMBER>-win64.zip
dist/<TARGET>-<VERSION_NUMBER>-osx-x86_32.zip dist/<TARGET>-<VERSION_NUMBER>-osx-x86_32.zip
...@@ -22,6 +22,7 @@ included. Each invocation will create 8 zip packages: ...@@ -22,6 +22,7 @@ included. Each invocation will create 8 zip packages:
dist/<TARGET>-<VERSION_NUMBER>-linux-x86_64.zip dist/<TARGET>-<VERSION_NUMBER>-linux-x86_64.zip
dist/<TARGET>-<VERSION_NUMBER>-linux-aarch_64.zip dist/<TARGET>-<VERSION_NUMBER>-linux-aarch_64.zip
dist/<TARGET>-<VERSION_NUMBER>-linux-ppcle_64.zip dist/<TARGET>-<VERSION_NUMBER>-linux-ppcle_64.zip
dist/<TARGET>-<VERSION_NUMBER>-linux-s390x_64.zip
EOF EOF
exit 1 exit 1
fi fi
...@@ -39,6 +40,7 @@ declare -a FILE_NAMES=( \ ...@@ -39,6 +40,7 @@ declare -a FILE_NAMES=( \
linux-x86_64.zip linux-x86_64.exe \ linux-x86_64.zip linux-x86_64.exe \
linux-aarch_64.zip linux-aarch_64.exe \ linux-aarch_64.zip linux-aarch_64.exe \
linux-ppcle_64.zip linux-ppcle_64.exe \ linux-ppcle_64.zip linux-ppcle_64.exe \
linux-s390x_64.zip linux-s390x_64.exe \
) )
# List of all well-known types to be included. # List of all well-known types to be included.
......
...@@ -84,6 +84,11 @@ ...@@ -84,6 +84,11 @@
<file>${basedir}/target/linux/ppcle_64/protoc.exe</file> <file>${basedir}/target/linux/ppcle_64/protoc.exe</file>
<classifier>linux-ppcle_64</classifier> <classifier>linux-ppcle_64</classifier>
<type>exe</type> <type>exe</type>
</artifact>
<artifact>
<file>${basedir}/target/linux/s390x_64/protoc.exe</file>
<classifier>linux-s390x_64</classifier>
<type>exe</type>
</artifact> </artifact>
</artifacts> </artifacts>
</configuration> </configuration>
......
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