1#!/bin/bash 2 3set -ex 4 5# change to repo root 6pushd $(dirname $0)/../../../.. 7 8# Create stage dir 9ORIGINAL_DIR=`pwd` 10pushd .. 11cp -R $ORIGINAL_DIR stage 12export STAGE_DIR="`pwd`/stage" 13popd 14 15export REPO_DIR=protobuf 16export BUILD_VERSION=`grep -i "version" python/google/protobuf/__init__.py | grep -o "'.*'" | tr -d "'"` 17 18export BUILD_COMMIT=`git rev-parse HEAD` 19export PLAT=x86_64 20export UNICODE_WIDTH=32 21export MACOSX_DEPLOYMENT_TARGET=10.9 22 23rm -rf artifacts/ 24rm -rf multibuild/ 25mkdir artifacts 26export ARTIFACT_DIR=$(pwd)/artifacts 27 28git clone https://github.com/matthew-brett/multibuild.git 29# Pin multibuild scripts at a known commit to avoid potentially unwanted future changes from 30# silently creeping in (see https://github.com/protocolbuffers/protobuf/issues/9180). 31# IMPORTANT: always pin multibuild at the same commit for: 32# - linux/build_artifacts.sh 33# - linux/build_artifacts.sh 34# - windows/build_artifacts.bat 35(cd multibuild; git checkout b89bb903e94308be79abefa4f436bf123ebb1313) 36cp kokoro/release/python/linux/config.sh config.sh 37 38build_artifact_version() { 39 MB_PYTHON_VERSION=$1 40 cp -R $STAGE_DIR $REPO_DIR 41 42 source multibuild/common_utils.sh 43 source multibuild/travis_steps.sh 44 before_install 45 46 clean_code $REPO_DIR $BUILD_COMMIT 47 48 build_wheel $REPO_DIR/python $PLAT 49 50 mv wheelhouse/* $ARTIFACT_DIR 51 52 # Clean up env 53 rm -rf venv 54 sudo rm -rf $REPO_DIR 55} 56 57build_x86_64_manylinux1_artifact_version() { 58 # Explicitly request building manylinux1 wheels, which is no longer the default. 59 # https://github.com/protocolbuffers/protobuf/issues/9180 60 MB_ML_VER=1 61 build_artifact_version $@ 62} 63 64build_x86_64_manylinux2010_artifact_version() { 65 # Explicitly request building manylinux2010 wheels 66 MB_ML_VER=2010 67 build_artifact_version $@ 68} 69 70build_crosscompiled_aarch64_manylinux2014_artifact_version() { 71 # crosscompilation is only supported with the dockcross manylinux2014 image 72 DOCKER_IMAGE=dockcross/manylinux2014-aarch64:20210706-65bf2dd 73 MB_ML_VER=2014 74 PLAT=aarch64 75 76 # TODO(jtatermusch): currently when crosscompiling, "auditwheel repair" will be disabled 77 # since auditwheel doesn't work for crosscomiled wheels. 78 build_artifact_version $@ 79} 80 81build_x86_64_manylinux1_artifact_version 3.6 82build_x86_64_manylinux1_artifact_version 3.7 83build_x86_64_manylinux1_artifact_version 3.8 84build_x86_64_manylinux1_artifact_version 3.9 85build_x86_64_manylinux2010_artifact_version 3.10 86 87build_crosscompiled_aarch64_manylinux2014_artifact_version 3.7 88build_crosscompiled_aarch64_manylinux2014_artifact_version 3.8 89build_crosscompiled_aarch64_manylinux2014_artifact_version 3.9 90build_crosscompiled_aarch64_manylinux2014_artifact_version 3.10 91