From 1f7837a2abb4445c58f725864a6e721de2698872 Mon Sep 17 00:00:00 2001 From: nashimus Date: Fri, 6 Jul 2018 20:03:25 -0600 Subject: Additional support for building and deploying ppcle_64 artifacts --- protoc-artifacts/README.md | 25 ++++++++++++++++--------- protoc-artifacts/build-protoc.sh | 15 +++++++++++++-- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/protoc-artifacts/README.md b/protoc-artifacts/README.md index dcaec987..5c5ca4ce 100644 --- a/protoc-artifacts/README.md +++ b/protoc-artifacts/README.md @@ -52,7 +52,7 @@ and/or architecture. Valid values are defined as the return values of [os-maven-plugin](https://github.com/trustin/os-maven-plugin/blob/master/src/main/java/kr/motd/maven/os/Detector.java). Frequently used values are: - ``os.detected.name``: ``linux``, ``osx``, ``windows``. -- ``os.detected.arch``: ``x86_32``, ``x86_64`` +- ``os.detected.arch``: ``x86_32``, ``x86_64``, ``ppcle_64`` For example, MinGW32 only ships with 32-bit compilers, but you can still build 32-bit protoc under 64-bit Windows, with the following command: @@ -68,7 +68,7 @@ configure GPG and Sonatype account. You need to perform the deployment for every platform that you want to support. DO NOT close the staging repository until you have done the deployment for all platforms. Currently the following platforms are supported: -- Linux (x86_32, x86_64 and cross compiled aarch_64) +- Linux (x86_32, x86_64, ppcle_64 and cross compiled aarch_64 or ppcle_64) - Windows (x86_32 and x86_64) with - Cygwin64 with MinGW compilers (x86_64) - MSYS with MinGW32 (x86_32) @@ -102,6 +102,9 @@ A 32-bit artifact can be deployed from a 64-bit host with An arm64 artifact can be deployed from x86 host with ``-Dos.detected.arch=aarch_64`` +A ppcle_64 artifact can be deployed from x86 host with +``-Dos.detected.arch=ppcle_64`` + A windows artifact can be deployed from a linux machine with ``-Dos.detected.name=windows`` @@ -115,15 +118,16 @@ build-zip.sh script to bulid zip packages for these protoc binaries and upload these zip packages to the download section of the github release. For example: ``` -$ ./build-zip.sh 3.0.0-beta-4 +$ ./build-zip.sh 3.6.0 ``` -The above command will create 5 zip files: +The above command will create 6 zip files: ``` -dist/protoc-3.0.0-beta-4-win32.zip -dist/protoc-3.0.0-beta-4-osx-x86_32.zip -dist/protoc-3.0.0-beta-4-osx-x86_64.zip -dist/protoc-3.0.0-beta-4-linux-x86_32.zip -dist/protoc-3.0.0-beta-4-linux-x86_64.zip +dist/protoc-3.6.0-win32.zip +dist/protoc-3.6.0-osx-x86_32.zip +dist/protoc-3.6.0-osx-x86_64.zip +dist/protoc-3.6.0-linux-x86_32.zip +dist/protoc-3.6.0-linux-x86_64.zip +dist/protoc-3.6.0-linux-ppcle_64.zip ``` Before running the script, make sure the artifacts are accessible from: http://repo1.maven.org/maven2/com/google/protobuf/protoc/ @@ -183,6 +187,9 @@ We have successfully built artifacts on the following environments: - Linux x86_32 and x86_64: - Centos 6.6 (within Docker 1.6.1) - Ubuntu 14.04.2 64-bit +- Linux ppc64le: + - Debian 9.4 + - Cross compiled with `g++-powerpc64le-linux-gnu` on Debian 9.4 x86_64 - Linux aarch_64: Cross compiled with `g++-aarch64-linux-gnu` on Ubuntu 14.04.2 64-bit - Windows x86_32: MSYS with ``mingw32-gcc-g++ 4.8.1-4`` on Windows 7 64-bit - Windows x86_32: Cross compile with ``i686-w64-mingw32-g++ 4.8.2`` on Ubuntu 14.04.2 64-bit diff --git a/protoc-artifacts/build-protoc.sh b/protoc-artifacts/build-protoc.sh index b78abbcf..c50a1207 100755 --- a/protoc-artifacts/build-protoc.sh +++ b/protoc-artifacts/build-protoc.sh @@ -7,10 +7,11 @@ # and are ${os.detected.name} and ${os.detected.arch} from os-maven-plugin # can be "protoc" or "protoc-gen-javalite" # -# The script now supports cross-compiling windows and linux-arm64 in linux-x86 +# The script now supports cross-compiling windows, linux-arm64, and linux-ppc64le in linux-x86 # environment. Required packages: # - Windows: i686-w64-mingw32-gcc (32bit) and x86_64-w64-mingw32-gcc (64bit) # - Arm64: g++-aarch64-linux-gnu +# - Ppc64le: g++-powerpc64le-linux-gcc OS=$1 ARCH=$2 @@ -75,6 +76,7 @@ checkArch () format="$(objdump -f "$1" | grep -o "file format .*$" | grep -o "[^ ]*$")" echo Format=$format if [[ "$OS" == linux ]]; then + host_machine="$(uname -m)"; if [[ "$ARCH" == x86_32 ]]; then assertEq $format "elf32-i386" $LINENO elif [[ "$ARCH" == x86_64 ]]; then @@ -82,7 +84,11 @@ checkArch () elif [[ "$ARCH" == aarch_64 ]]; then assertEq $format "elf64-little" $LINENO elif [[ "$ARCH" == ppcle_64 ]]; then - assertEq $format "elf64-powerpcle" $LINENO + if [[ $host_machine == ppc64le ]];then + assertEq $format "elf64-powerpcle" $LINENO + else + assertEq $format "elf64-little" $LINENO + fi else fail "Unsupported arch: $ARCH" fi @@ -121,12 +127,16 @@ checkDependencies () dump_cmd='objdump -x '"$1"' | fgrep "DLL Name"' white_list="KERNEL32\.dll\|msvcrt\.dll" elif [[ "$OS" == linux ]]; then + host_machine="$(uname -m)"; dump_cmd='ldd '"$1" if [[ "$ARCH" == x86_32 ]]; then 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" == ppcle_64 ]]; then + if [[ $host_machine != ppc64le ]];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\.2" elif [[ "$ARCH" == aarch_64 ]]; then dump_cmd='objdump -p '"$1"' | grep NEEDED' @@ -199,6 +209,7 @@ elif [[ "$(uname)" == Linux* ]]; then CONFIGURE_ARGS="$CONFIGURE_ARGS --host=aarch64-linux-gnu" elif [[ "$ARCH" == ppcle_64 ]]; then CXXFLAGS="$CXXFLAGS -m64" + CONFIGURE_ARGS="$CONFIGURE_ARGS --host=powerpc64le-linux-gnu" else fail "Unsupported arch: $ARCH" fi -- cgit v1.2.3