Commit b879abc8 authored by Jisi Liu's avatar Jisi Liu

Supports Arm64 (aarch64) protoc artifacts

parent 0971efb1
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
# Usage: build-protoc.sh <OS> <ARCH> <TARGET> # Usage: build-protoc.sh <OS> <ARCH> <TARGET>
# <OS> and <ARCH> are ${os.detected.name} and ${os.detected.arch} from os-maven-plugin # <OS> and <ARCH> are ${os.detected.name} and ${os.detected.arch} from os-maven-plugin
# <TARGET> can be "protoc" or "protoc-gen-javalite" # <TARGET> can be "protoc" or "protoc-gen-javalite"
#
# The script now supports cross-compiling windows and linux-arm64 in linux-x86
# environment. Required packages:
# - Windows: i686-w64-mingw32-gcc (32bit) and x86_64-w64-mingw32-gcc (64bit)
# - Arm64: g++-aarch64-linux-gnu
OS=$1 OS=$1
ARCH=$2 ARCH=$2
MAKE_TARGET=$3 MAKE_TARGET=$3
...@@ -73,6 +79,8 @@ checkArch () ...@@ -73,6 +79,8 @@ checkArch ()
assertEq $format "elf32-i386" $LINENO assertEq $format "elf32-i386" $LINENO
elif [[ "$ARCH" == x86_64 ]]; then elif [[ "$ARCH" == x86_64 ]]; then
assertEq $format "elf64-x86-64" $LINENO assertEq $format "elf64-x86-64" $LINENO
elif [[ "$ARCH" == aarch_64 ]]; then
assertEq $format "elf64-little" $LINENO
else else
fail "Unsupported arch: $ARCH" fail "Unsupported arch: $ARCH"
fi fi
...@@ -116,6 +124,9 @@ checkDependencies () ...@@ -116,6 +124,9 @@ 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" == aarch_64 ]]; then
dump_cmd='objdump -p '"$1"' | grep NEEDED'
white_list="libpthread\.so\.0\|libc\.so\.6\|ld-linux-aarch64\.so\.1"
fi fi
elif [[ "$OS" == osx ]]; then elif [[ "$OS" == osx ]]; then
dump_cmd='otool -L '"$1"' | fgrep dylib' dump_cmd='otool -L '"$1"' | fgrep dylib'
...@@ -180,6 +191,8 @@ elif [[ "$(uname)" == Linux* ]]; then ...@@ -180,6 +191,8 @@ elif [[ "$(uname)" == Linux* ]]; then
CXXFLAGS="$CXXFLAGS -m64" CXXFLAGS="$CXXFLAGS -m64"
elif [[ "$ARCH" == x86_32 ]]; then elif [[ "$ARCH" == x86_32 ]]; then
CXXFLAGS="$CXXFLAGS -m32" CXXFLAGS="$CXXFLAGS -m32"
elif [[ "$ARCH" == aarch_64 ]]; then
CONFIGURE_ARGS="$CONFIGURE_ARGS --host=aarch64-linux-gnu"
else else
fail "Unsupported arch: $ARCH" fail "Unsupported arch: $ARCH"
fi fi
......
...@@ -13,12 +13,13 @@ Example: ...@@ -13,12 +13,13 @@ 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 5 zip packages: included. Each invocation will create 6 zip packages:
dist/<TARGET>-<VERSION_NUMBER>-win32.zip dist/<TARGET>-<VERSION_NUMBER>-win32.zip
dist/<TARGET>-<VERSION_NUMBER>-osx-x86_32.zip dist/<TARGET>-<VERSION_NUMBER>-osx-x86_32.zip
dist/<TARGET>-<VERSION_NUMBER>-osx-x86_64.zip dist/<TARGET>-<VERSION_NUMBER>-osx-x86_64.zip
dist/<TARGET>-<VERSION_NUMBER>-linux-x86_32.zip dist/<TARGET>-<VERSION_NUMBER>-linux-x86_32.zip
dist/<TARGET>-<VERSION_NUMBER>-linux-x86_64.zip dist/<TARGET>-<VERSION_NUMBER>-linux-x86_64.zip
dist/<TARGET>-<VERSION_NUMBER>-linux-aarch64.zip
EOF EOF
exit 1 exit 1
fi fi
...@@ -33,6 +34,7 @@ declare -a FILE_NAMES=( \ ...@@ -33,6 +34,7 @@ declare -a FILE_NAMES=( \
osx-x86_64.zip osx-x86_64.exe \ osx-x86_64.zip osx-x86_64.exe \
linux-x86_32.zip linux-x86_32.exe \ linux-x86_32.zip linux-x86_32.exe \
linux-x86_64.zip linux-x86_64.exe \ linux-x86_64.zip linux-x86_64.exe \
linux-aarch64.zip linux-aarch64.exe \
) )
# List of all well-known types to be included. # List of all well-known types to be included.
......
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