From 929263748b10aeeedaa2b3a12118ead062aabbf4 Mon Sep 17 00:00:00 2001 From: odidev Date: Tue, 7 Dec 2021 17:47:05 +0530 Subject: [PATCH] Add linux aarch64 wheel build support Signed-off-by: odidev --- .github/workflows/build.yml | 14 +++++++++++++- cibuild/aarch64_extra_steps.sh | 9 +++++++++ cibuild/linux_steps.sh | 7 ++++--- 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 cibuild/aarch64_extra_steps.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 869f047..b26ca8a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,12 +4,16 @@ on: push jobs: build_wheels: - name: Build wheels on ${{ matrix.os }} + name: Build wheels on ${{matrix.arch}} for ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: # os: [ubuntu-18.04, windows-latest, macos-latest] # skip windows os: [ubuntu-20.04, macos-11] + arch: [auto, aarch64] + exclude: + - os: macos-11 + arch: aarch64 steps: - uses: actions/checkout@v2 @@ -23,15 +27,23 @@ jobs: with: python-version: '3.7' + #cibuildwheel support aarch64, via emulation. + #Please refer - https://cibuildwheel.readthedocs.io/en/stable/faq/#emulation + - uses: docker/setup-qemu-action@v1 + if: ${{ matrix.arch == 'aarch64' }} + name: Set up QEMU + - name: Install cibuildwheel run: | python -m pip install cibuildwheel==2.1.1 - name: Build wheels env: + CIBW_ARCHS_LINUX: ${{matrix.arch}} CIBW_SKIP: "pp* *-manylinux_i686" CIBW_BEFORE_BUILD_LINUX: "/bin/bash cibuild/linux_steps.sh" CIBW_BEFORE_BUILD_MACOS: "/bin/bash cibuild/macos_steps.sh" + CIBW_BEFORE_TEST_LINUX: "/bin/bash cibuild/aarch64_extra_steps.sh" CIBW_TEST_COMMAND: "cd {project}/pyosmium && rm -rf build && pytest test" CIBW_TEST_REQUIRES: pytest shapely CIBW_TEST_SKIP: "cp310-macosx*" # missing libgeos diff --git a/cibuild/aarch64_extra_steps.sh b/cibuild/aarch64_extra_steps.sh new file mode 100644 index 0000000..cb07f49 --- /dev/null +++ b/cibuild/aarch64_extra_steps.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ "$(uname -m)" == "aarch64" ] +then + yum install -y wget + wget https://download-ib01.fedoraproject.org/pub/epel/7/aarch64/Packages/g/geos-3.4.2-2.el7.aarch64.rpm + rpm -i geos-3.4.2-2.el7.aarch64.rpm + rm geos-3.4.2-2.el7.aarch64.rpm +fi diff --git a/cibuild/linux_steps.sh b/cibuild/linux_steps.sh index eebcef5..ffbd7fc 100644 --- a/cibuild/linux_steps.sh +++ b/cibuild/linux_steps.sh @@ -6,6 +6,7 @@ echo "Running Linux steps" CMAKE_BIN_URL_64=https://cmake.org/files/v3.6/cmake-3.6.3-Linux-x86_64.sh CMAKE_BIN_URL_32=https://cmake.org/files/v3.6/cmake-3.6.3-Linux-i386.sh +CMAKE_BIN_URL_aarch64=https://cmake.org/files/v3.21/cmake-3.21.0-linux-aarch64.sh function build_boost { mkdir -p boost @@ -27,6 +28,8 @@ function build_boost { function build_cmake { if [ "x${AUDITWHEEL_ARCH}" == "xi686" ] ; then curl -o /tmp/cmake.sh "${CMAKE_BIN_URL_32}" + elif [ "x${AUDITWHEEL_ARCH}" == "xaarch64" ] ; then + curl -o /tmp/cmake.sh "${CMAKE_BIN_URL_aarch64}" else curl -o /tmp/cmake.sh "${CMAKE_BIN_URL_64}" fi @@ -51,9 +54,7 @@ ln -sf $(pwd)/pybind11 pyosmium/contrib/pybind11 ln -sf $(pwd)/libosmium pyosmium/contrib/libosmium ln -sf $(pwd)/protozero pyosmium/contrib/protozero - -yum install -y sparsehash-devel expat-devel boost-devel zlib-devel - +yum install -y expat-devel boost-devel zlib-devel # install bzip2 build_new_zlib