Skip to content
forked from aleaxit/gmpy

Commit

Permalink
Revert part of aleaxit#341 related to arm64 builds (now a separate jo…
Browse files Browse the repository at this point in the history
…b again)
  • Loading branch information
skirpichev committed Jan 30, 2023
1 parent 3301888 commit 8649f9e
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
25 changes: 24 additions & 1 deletion .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,30 @@ jobs:
CIBW_PRERELEASE_PYTHONS: True
CIBW_SKIP: pp*
CIBW_BEFORE_BUILD: bash scripts/before_ci_build.sh
CIBW_ARCHS_MACOS: "auto arm64"
CIBW_TEST_COMMAND: "python {package}/test/runtests.py"

- uses: actions/upload-artifact@v3
with:
name: wheels
path: ./wheelhouse

build_wheels_macos_arm64:
name: Build wheel on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-12]
python-version: ["3.7"]

steps:
- uses: actions/checkout@v3

- name: Build wheel
- uses: pypa/cibuildwheel@v2.12.0
CIBW_PRERELEASE_PYTHONS: True
CIBW_BEFORE_BUILD: bash scripts/before_ci_build_apple_silicon.sh
CIBW_SKIP: pp*
CIBW_ARCHS_MACOS: "arm64"
CIBW_TEST_COMMAND: "python {package}/test/runtests.py"

- uses: actions/upload-artifact@v3
Expand Down
31 changes: 31 additions & 0 deletions scripts/before_ci_build_apple_silicon.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
GMP_VERSION=6.2.1
MPFR_VERSION=4.1.1
MPC_VERSION=1.2.1
export CPPFLAGS=" --target=arm64-apple-macos11"
export LDFLAGS=" -arch arm64"
EXTRA="--build=x86_64-apple-darwin --host=aarch64-apple-darwin --target=aarch64-apple-darwin"
if [ ! -f finish_before_ci_build ]; then
if [[ "$OSTYPE" == "linux-gnu" || "$OSTYPE" == "linux-musl" || "$OSTYPE" == "darwin"* ]]; then
echo $PWD
curl -O https://ftp.gnu.org/gnu/gmp/gmp-${GMP_VERSION}.tar.xz
tar -xf gmp-${GMP_VERSION}.tar.xz
cd gmp-${GMP_VERSION}
patch -N -Z -p0 < ../scripts/patch-arm64.diff
cd ..
# need to set host to the oldest triple to avoid building binaries
# that use build machine micro-architecure. configfsf.guess is the one that
# comes with autotools which is micro-architecture agnostic.
# config.guess is a custom gmp script which knows about micro-architectures.
cd gmp-${GMP_VERSION} && ./configure $EXTRA --enable-fat && make -j4 && make install && cd ../
curl -O -k https://ftp.gnu.org/gnu/mpfr/mpfr-${MPFR_VERSION}.tar.gz
tar -xf mpfr-${MPFR_VERSION}.tar.gz
cd mpfr-${MPFR_VERSION} && ./configure $EXTRA && make -j4 && make install && cd ../
curl -O https://ftp.gnu.org/gnu/mpc/mpc-${MPC_VERSION}.tar.gz
tar -xf mpc-${MPC_VERSION}.tar.gz
cd mpc-${MPC_VERSION} && ./configure $EXTRA && make -j4 && make install && cd ../
pip install Cython
fi
touch finish_before_ci_build
else
echo "has finished before ci build"
fi

0 comments on commit 8649f9e

Please sign in to comment.