Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add linux aarch64 wheel build support #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ PY3_WITH_CYTHON=$(shell $(PYTHON3) -c 'import Cython.Compiler' >/dev/null 2>/dev

MANYLINUX_IMAGE_X86_64=quay.io/pypa/manylinux2010_x86_64
MANYLINUX_IMAGE_686=quay.io/pypa/manylinux2010_i686
MANYLINUX_IMAGE_aarch64=quay.io/pypa/manylinux2014_aarch64

.PHONY: all version inplace sdist build clean wheel_manylinux wheel_manylinux32 wheel_manylinux64 wheel
.PHONY: all version inplace sdist build clean wheel_manylinux wheel_manylinux32 wheel_manylinux64 wheel_manylinuxaarch64 wheel

all: inplace

Expand All @@ -30,7 +31,7 @@ build:
wheel:
$(PYTHON) setup.py $(SETUPFLAGS) bdist_wheel $(PYTHON_WITH_CYTHON)

wheel_manylinux: sdist wheel_manylinux64 wheel_manylinux32
wheel_manylinux: sdist wheel_manylinux64 wheel_manylinux32 wheel_manylinuxaarch64

wheel_manylinux32 wheel_manylinux64: dist/$(PACKAGENAME)-$(VERSION).tar.gz
echo "Building wheels for $(PACKAGENAME) $(VERSION)"
Expand Down Expand Up @@ -59,6 +60,34 @@ wheel_manylinux32 wheel_manylinux64: dist/$(PACKAGENAME)-$(VERSION).tar.gz
for whl in dist/$(PACKAGENAME)-$(VERSION)-*-linux_*.whl; do auditwheel repair $$whl -w /io/$$WHEELHOUSE; done; \
'

wheel_manylinuxaarch64: dist/$(PACKAGENAME)-$(VERSION).tar.gz
echo "Building wheels for $(PACKAGENAME) $(VERSION)"
mkdir -p wheelhouse$(subst wheel_manylinux,,$@)
docker run --rm --privileged hypriot/qemu-register
time docker run --rm -t \
-v $(shell pwd):/io \
-e CFLAGS="-O3 -g1 -mtune=generic -pipe -fPIC" \
-e LDFLAGS="$(LDFLAGS) -fPIC" \
-e WHEELHOUSE=wheelhouse$(subst wheel_manylinux,,$@) \
$(MANYLINUX_IMAGE_aarch64) \
bash -c '\
rm -fr $(PACKAGENAME)-$(VERSION)/; \
tar zxf /io/$< && cd $(PACKAGENAME)-$(VERSION)/ || exit 1; \
for PYBIN in /opt/python/cp*/bin; do \
PYVER="$$($$PYBIN/python -V)"; \
PROFDIR="prof-$${PYVER// /_}"; \
echo $$PYVER; \
$$PYBIN/pip install -U pip setuptools; \
make clean; rm -fr $$PROFDIR; \
CFLAGS="$$CFLAGS -fprofile-generate -fprofile-dir=$$PROFDIR" $$PYBIN/python setup.py build_ext -i; \
$$PYBIN/python lockbench.py flock; \
CFLAGS="$$CFLAGS -fprofile-use -fprofile-correction -fprofile-dir=$$PROFDIR" $$PYBIN/python setup.py build_ext -i -f; \
$$PYBIN/python lockbench.py rlock flock; \
CFLAGS="$$CFLAGS -fprofile-use -fprofile-correction -fprofile-dir=$$PROFDIR" $$PYBIN/python setup.py bdist_wheel; \
done; \
for whl in dist/$(PACKAGENAME)-$(VERSION)-*-linux_*.whl; do auditwheel repair $$whl -w /io/$$WHEELHOUSE; done; \
'

clean:
find . \( -name '*.o' -o -name '*.so' -o -name '*.py[cod]' -o -name '*.dll' \) -exec rm -f {} \;
rm -rf build