diff --git a/kokoro/release/protoc/linux/build.sh b/kokoro/release/protoc/linux/build.sh new file mode 100755 index 0000000000..0b6d55b1cf --- /dev/null +++ b/kokoro/release/protoc/linux/build.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +set -x + +# Change to repo root. +cd $(dirname $0)/../../../.. + +# Use docker image to build linux artifacts. +DOCKER_IMAGE_NAME=protobuf/protoc_$(sha1sum protoc-artifacts/Dockerfile | cut -f1 -d " ") +docker pull $DOCKER_IMAGE_NAME + +docker run -v $(pwd):/var/local/protobuf --rm $DOCKER_IMAGE_NAME \ + bash -l /var/local/protobuf/protoc-artifacts/build-protoc.sh \ + linux x86_64 protoc || { + echo "Failed to build protoc for linux + x86_64." + exit 1 +} + +docker run -v $(pwd):/var/local/protobuf --rm $DOCKER_IMAGE_NAME \ + bash -l /var/local/protobuf/protoc-artifacts/build-protoc.sh \ + linux x86_32 protoc || { + echo "Failed to build protoc for linux + x86_32." + exit 1 +} + +# Cross-build for some architectures. +sudo apt install g++-aarch64-linux-gnu +# TODO(xiaofeng): It currently fails with "machine `aarch64' not recognized" +# error. +# protoc-artifacts/build-protoc.sh linux aarch_64 protoc diff --git a/kokoro/release/protoc/linux/release.cfg b/kokoro/release/protoc/linux/release.cfg new file mode 100644 index 0000000000..4d8b7b612f --- /dev/null +++ b/kokoro/release/protoc/linux/release.cfg @@ -0,0 +1,7 @@ +build_file: "protobuf/kokoro/release/protoc/linux/build.sh" + +action { + define_artifacts { + regex: "**/protoc.exe" + } +} diff --git a/protoc-artifacts/build-protoc.sh b/protoc-artifacts/build-protoc.sh index d5a173d0a0..d6a3cfa397 100755 --- a/protoc-artifacts/build-protoc.sh +++ b/protoc-artifacts/build-protoc.sh @@ -38,7 +38,7 @@ case $MAKE_TARGET in protoc) ;; *) - echo "Target ""$TARGET"" invalid." + echo "Target ""$MAKE_TARGET"" invalid." exit 1 esac @@ -165,7 +165,7 @@ checkDependencies () } ############################################################################ -echo "Building protoc, OS=$OS ARCH=$ARCH TARGET=$TARGET" +echo "Building protoc, OS=$OS ARCH=$ARCH TARGET=$MAKE_TARGET" CONFIGURE_ARGS="--disable-shared"