aboutsummaryrefslogtreecommitdiffhomepage
path: root/protoc-artifacts
diff options
context:
space:
mode:
Diffstat (limited to 'protoc-artifacts')
-rw-r--r--protoc-artifacts/Dockerfile22
-rw-r--r--protoc-artifacts/README.md24
-rwxr-xr-xprotoc-artifacts/build-protoc.sh19
-rwxr-xr-xprotoc-artifacts/build-zip.sh6
-rw-r--r--protoc-artifacts/pom.xml4
-rwxr-xr-xprotoc-artifacts/scl-enable-devtoolset.sh13
6 files changed, 68 insertions, 20 deletions
diff --git a/protoc-artifacts/Dockerfile b/protoc-artifacts/Dockerfile
index 43e6863c..c346586b 100644
--- a/protoc-artifacts/Dockerfile
+++ b/protoc-artifacts/Dockerfile
@@ -11,7 +11,9 @@ RUN yum install -y git \
libtool \
glibc-static.i686 \
glibc-devel \
- glibc-devel.i686
+ glibc-devel.i686 \
+ && \
+ yum clean all
# Install Java 8
RUN wget -q --no-cookies --no-check-certificate \
@@ -27,15 +29,17 @@ RUN wget -q http://apache.cs.utah.edu/maven/maven-3/3.3.9/binaries/apache-maven-
ENV PATH /var/local/apache-maven-3.3.9/bin:$PATH
# Install GCC 4.7 to support -static-libstdc++
-RUN wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo -P /etc/yum.repos.d
-RUN bash -c 'echo "enabled=1" >> /etc/yum.repos.d/devtools-1.1.repo'
-RUN bash -c "sed -e 's/\$basearch/i386/g' /etc/yum.repos.d/devtools-1.1.repo > /etc/yum.repos.d/devtools-i386-1.1.repo"
-RUN sed -e 's/testing-/testing-i386-/g' -i /etc/yum.repos.d/devtools-i386-1.1.repo
-RUN rpm --rebuilddb && yum install -y devtoolset-1.1 \
+RUN wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo -P /etc/yum.repos.d && \
+ bash -c 'echo "enabled=1" >> /etc/yum.repos.d/devtools-1.1.repo' && \
+ bash -c "sed -e 's/\$basearch/i386/g' /etc/yum.repos.d/devtools-1.1.repo > /etc/yum.repos.d/devtools-i386-1.1.repo" && \
+ sed -e 's/testing-/testing-i386-/g' -i /etc/yum.repos.d/devtools-i386-1.1.repo && \
+ rpm --rebuilddb && \
+ yum install -y devtoolset-1.1 \
devtoolset-1.1-libstdc++-devel \
- devtoolset-1.1-libstdc++-devel.i686
+ devtoolset-1.1-libstdc++-devel.i686 && \
+ yum clean all
-RUN git clone --depth 1 https://github.com/google/protobuf.git
+COPY scl-enable-devtoolset.sh /var/local/
# Start in devtoolset environment that uses GCC 4.7
-CMD ["scl", "enable", "devtoolset-1.1", "bash"]
+ENTRYPOINT ["/var/local/scl-enable-devtoolset.sh"]
diff --git a/protoc-artifacts/README.md b/protoc-artifacts/README.md
index 17eb77f8..dcaec987 100644
--- a/protoc-artifacts/README.md
+++ b/protoc-artifacts/README.md
@@ -68,11 +68,11 @@ 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 and x86_64)
+- Linux (x86_32, x86_64 and cross compiled aarch_64)
- Windows (x86_32 and x86_64) with
- - Cygwin64 with MinGW compilers (x86_64)
- - MSYS with MinGW32 (x86_32)
- - Cross compile in Linux with MinGW-w64 (x86_32, x86_64)
+ - Cygwin64 with MinGW compilers (x86_64)
+ - MSYS with MinGW32 (x86_32)
+ - Cross compile in Linux with MinGW-w64 (x86_32, x86_64)
- MacOSX (x86_32 and x86_64)
As for MSYS2/MinGW64 for Windows: protoc will build, but it insists on
@@ -99,6 +99,9 @@ $ mvn clean deploy -P release -Dstaging.repository=comgoogle-123
A 32-bit artifact can be deployed from a 64-bit host with
``-Dos.detected.arch=x86_32``
+An arm64 artifact can be deployed from x86 host with
+``-Dos.detected.arch=aarch_64``
+
A windows artifact can be deployed from a linux machine with
``-Dos.detected.name=windows``
@@ -137,10 +140,14 @@ $ docker build -t protoc-artifacts .
To run the image:
```
-$ docker run -it --rm=true protoc-artifacts
+$ docker run -it --rm=true protoc-artifacts bash
```
-The Protobuf repository has been cloned into ``/protobuf``.
+To checkout protobuf (run within the container):
+```
+$ # Replace v3.5.1 with the version you want
+$ wget -O - https://github.com/google/protobuf/archive/v3.5.1.tar.gz | tar xvzp
+```
### Tips for deploying on Windows
Under Windows the following error may occur: ``gpg: cannot open tty `no tty':
@@ -174,8 +181,9 @@ stored:
### Tested build environments
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
+ - Centos 6.6 (within Docker 1.6.1)
+ - Ubuntu 14.04.2 64-bit
+- 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
- Windows x86_64: Cygwin64 with ``mingw64-x86_64-gcc-g++ 4.8.3-1`` on Windows 7 64-bit
diff --git a/protoc-artifacts/build-protoc.sh b/protoc-artifacts/build-protoc.sh
index 57523a41..b78abbcf 100755
--- a/protoc-artifacts/build-protoc.sh
+++ b/protoc-artifacts/build-protoc.sh
@@ -6,6 +6,12 @@
# Usage: build-protoc.sh <OS> <ARCH> <TARGET>
# <OS> and <ARCH> are ${os.detected.name} and ${os.detected.arch} from os-maven-plugin
# <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
ARCH=$2
MAKE_TARGET=$3
@@ -73,6 +79,10 @@ checkArch ()
assertEq $format "elf32-i386" $LINENO
elif [[ "$ARCH" == x86_64 ]]; then
assertEq $format "elf64-x86-64" $LINENO
+ elif [[ "$ARCH" == aarch_64 ]]; then
+ assertEq $format "elf64-little" $LINENO
+ elif [[ "$ARCH" == ppcle_64 ]]; then
+ assertEq $format "elf64-powerpcle" $LINENO
else
fail "Unsupported arch: $ARCH"
fi
@@ -116,6 +126,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" == ppcle_64 ]]; then
+ 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'
+ white_list="libpthread\.so\.0\|libc\.so\.6\|ld-linux-aarch64\.so\.1"
fi
elif [[ "$OS" == osx ]]; then
dump_cmd='otool -L '"$1"' | fgrep dylib'
@@ -180,6 +195,10 @@ elif [[ "$(uname)" == Linux* ]]; then
CXXFLAGS="$CXXFLAGS -m64"
elif [[ "$ARCH" == x86_32 ]]; then
CXXFLAGS="$CXXFLAGS -m32"
+ elif [[ "$ARCH" == aarch_64 ]]; then
+ CONFIGURE_ARGS="$CONFIGURE_ARGS --host=aarch64-linux-gnu"
+ elif [[ "$ARCH" == ppcle_64 ]]; then
+ CXXFLAGS="$CXXFLAGS -m64"
else
fail "Unsupported arch: $ARCH"
fi
diff --git a/protoc-artifacts/build-zip.sh b/protoc-artifacts/build-zip.sh
index a124ed7c..26b6cc93 100755
--- a/protoc-artifacts/build-zip.sh
+++ b/protoc-artifacts/build-zip.sh
@@ -13,12 +13,14 @@ 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 5 zip packages:
+included. Each invocation will create 7 zip packages:
dist/<TARGET>-<VERSION_NUMBER>-win32.zip
dist/<TARGET>-<VERSION_NUMBER>-osx-x86_32.zip
dist/<TARGET>-<VERSION_NUMBER>-osx-x86_64.zip
dist/<TARGET>-<VERSION_NUMBER>-linux-x86_32.zip
dist/<TARGET>-<VERSION_NUMBER>-linux-x86_64.zip
+ dist/<TARGET>-<VERSION_NUMBER>-linux-aarch_64.zip
+ dist/<TARGET>-<VERSION_NUMBER>-linux-ppcle_64.zip
EOF
exit 1
fi
@@ -33,6 +35,8 @@ declare -a FILE_NAMES=( \
osx-x86_64.zip osx-x86_64.exe \
linux-x86_32.zip linux-x86_32.exe \
linux-x86_64.zip linux-x86_64.exe \
+ linux-aarch_64.zip linux-aarch_64.exe \
+ linux-ppcle_64.zip linux-ppcle_64.exe \
)
# List of all well-known types to be included.
diff --git a/protoc-artifacts/pom.xml b/protoc-artifacts/pom.xml
index c6f5a77f..667a0215 100644
--- a/protoc-artifacts/pom.xml
+++ b/protoc-artifacts/pom.xml
@@ -10,7 +10,7 @@
</parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protoc</artifactId>
- <version>3.4.1</version>
+ <version>3.6.0</version>
<packaging>pom</packaging>
<name>Protobuf Compiler</name>
<description>
@@ -37,7 +37,7 @@
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
- <version>1.2.3.Final</version>
+ <version>1.5.0.Final</version>
</extension>
</extensions>
<plugins>
diff --git a/protoc-artifacts/scl-enable-devtoolset.sh b/protoc-artifacts/scl-enable-devtoolset.sh
new file mode 100755
index 00000000..8d9585ea
--- /dev/null
+++ b/protoc-artifacts/scl-enable-devtoolset.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+set -eu -o pipefail
+
+quote() {
+ local arg
+ for arg in "$@"; do
+ printf "'"
+ printf "%s" "$arg" | sed -e "s/'/'\\\\''/g"
+ printf "' "
+ done
+}
+
+exec scl enable devtoolset-1.1 "$(quote "$@")"