Debian Codegraph @

kokoro/release/protoc/linux/build.sh

raw
1 #!/bin/bash
2
3 set -x
4
5 # Change to repo root.
6 cd $(dirname $0)/../../../..
7
8 # Initialize any submodules.
9 git submodule update --init --recursive
10
11 # Generate the configure script.
12 ./autogen.sh
13
14 # Cross-build for aarch64, ppc64le and s390x. Note: we do these builds first to avoid
15 # file permission issues. The Docker builds will create directories owned by
16 # root, which causes problems if we try to add new artifacts to those
17 # directories afterward.
18
19 sudo apt install -y g++-aarch64-linux-gnu
20 protoc-artifacts/build-protoc.sh linux aarch_64 protoc
21
22 sudo apt install -y g++-powerpc64le-linux-gnu
23 protoc-artifacts/build-protoc.sh linux ppcle_64 protoc
24
25 sudo apt install -y g++-s390x-linux-gnu
26 protoc-artifacts/build-protoc.sh linux s390_64 protoc
27
28 # Use docker image to build linux artifacts.
29 DOCKER_IMAGE_NAME=protobuf/protoc_$(sha1sum protoc-artifacts/Dockerfile | cut -f1 -d " ")
30 docker pull $DOCKER_IMAGE_NAME
31
32 docker run -v $(pwd):/var/local/protobuf --rm $DOCKER_IMAGE_NAME \
33 bash -l /var/local/protobuf/protoc-artifacts/build-protoc.sh \
34 linux x86_64 protoc || {
35 echo "Failed to build protoc for linux + x86_64."
36 exit 1
37 }
38
39 docker run -v $(pwd):/var/local/protobuf --rm $DOCKER_IMAGE_NAME \
40 bash -l /var/local/protobuf/protoc-artifacts/build-protoc.sh \
41 linux x86_32 protoc || {
42 echo "Failed to build protoc for linux + x86_32."
43 exit 1
44 }