Browse Source

adding protoc support for s390x

salamaniibm 6 năm trước cách đây
mục cha
commit
7ba4a99e00

+ 5 - 1
kokoro/release/protoc/linux/build.sh

@@ -11,16 +11,20 @@ git submodule update --init --recursive
 # Generate the configure script.
 ./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
 # root, which causes problems if we try to add new artifacts to those
 # directories afterward.
+
 sudo apt install -y g++-aarch64-linux-gnu
 protoc-artifacts/build-protoc.sh linux aarch_64 protoc
 
 sudo apt install -y g++-powerpc64le-linux-gnu
 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.
 DOCKER_IMAGE_NAME=protobuf/protoc_$(sha1sum protoc-artifacts/Dockerfile | cut -f1 -d " ")
 docker pull $DOCKER_IMAGE_NAME

+ 3 - 0
protoc-artifacts/README.md

@@ -123,6 +123,8 @@ target directory layout:
           protoc.exe
         + ppcle_64
           protoc.exe
+        + s390x_64
+          protoc.exe
       + osx
         + x86_64
           protoc.exe
@@ -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-aarch_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:

+ 14 - 0
protoc-artifacts/build-protoc.sh

@@ -93,6 +93,12 @@ checkArch ()
         assertEq $format "elf64-x86-64" $LINENO
       elif [[ "$ARCH" == aarch_64 ]]; then
         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
 	if [[ $host_machine == ppc64le ]];then
 	  assertEq $format "elf64-powerpcle" $LINENO
@@ -143,6 +149,11 @@ checkDependencies ()
       white_list="linux-gate\.so\.1\|libpthread\.so\.0\|libm\.so\.6\|libc\.so\.6\|ld-linux\.so\.2"
     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"
+    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
       if [[ $host_machine != ppc64le ]];then
         dump_cmd='objdump -p '"$1"' | grep NEEDED'
@@ -215,6 +226,9 @@ elif [[ "$(uname)" == Linux* ]]; then
     elif [[ "$ARCH" == ppcle_64 ]]; then
       CXXFLAGS="$CXXFLAGS -m64"
       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
       fail "Unsupported arch: $ARCH"
     fi

+ 3 - 1
protoc-artifacts/build-zip.sh

@@ -13,7 +13,7 @@ Example:
 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
 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>-win64.zip
   dist/<TARGET>-<VERSION_NUMBER>-osx-x86_32.zip
@@ -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-aarch_64.zip
   dist/<TARGET>-<VERSION_NUMBER>-linux-ppcle_64.zip
+  dist/<TARGET>-<VERSION_NUMBER>-linux-s390x_64.zip
 EOF
   exit 1
 fi
@@ -39,6 +40,7 @@ declare -a FILE_NAMES=( \
   linux-x86_64.zip linux-x86_64.exe \
   linux-aarch_64.zip linux-aarch_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.

+ 5 - 0
protoc-artifacts/pom.xml

@@ -84,6 +84,11 @@
                   <file>${basedir}/target/linux/ppcle_64/protoc.exe</file>
                   <classifier>linux-ppcle_64</classifier>
                   <type>exe</type>
+	  	</artifact>
+                <artifact>
+                  <file>${basedir}/target/linux/s390x_64/protoc.exe</file>
+                  <classifier>linux-s390x_64</classifier>
+                  <type>exe</type>
                 </artifact>
               </artifacts>
             </configuration>