Skip to content

Commit

Permalink
Repair and simplify PGO wheel build.
Browse files Browse the repository at this point in the history
  • Loading branch information
scoder committed Aug 24, 2018
1 parent 4ed5500 commit 17a4b77
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,23 @@ wheel_manylinux32 wheel_manylinux64: dist/$(PACKAGENAME)-$(VERSION).tar.gz
-e LDFLAGS="$(LDFLAGS) -fPIC" \
-e WHEELHOUSE=wheelhouse$(subst wheel_manylinux,,$@) \
$(if $(patsubst %32,,$@),$(MANYLINUX_IMAGE_X86_64),$(MANYLINUX_IMAGE_686)) \
bash -c 'for PYBIN in /opt/python/*/bin; do \
PYVER="$$($$PYBIN/python -V)"; \
PROFDIR="prof-$${PYVER// /_}"; \
echo $$PYVER; \
$$PYBIN/pip install -U pip setuptools wheel; \
rm -fr /io/$$WHEELHOUSE/$(PACKAGENAME)-$(VERSION)/; \
tar zxf /io/$< -C /io/$$WHEELHOUSE && cd /io/$$WHEELHOUSE/$(PACKAGENAME)-$(VERSION)/ || exit 1; \
CFLAGS="$$CFLAGS -fprofile-generate -fprofile-dir=$$PROFDIR" $$PYBIN/python setup.py build_ext -i; \
$$PYBIN/python lockbench.py rlock flock; \
CFLAGS="$$CFLAGS -fprofile-use -fprofile-correction -fprofile-dir=$$PROFDIR" $$PYBIN/python setup.py build_ext -i -f; \
$$PYBIN/python lockbench.py flock; \
CFLAGS="$$CFLAGS -fprofile-use -fprofile-correction -fprofile-dir=$$PROFDIR" $$PYBIN/python setup.py bdist_wheel; \
mv dist/*.whl /io/$$WHEELHOUSE/; \
rm -fr /io/$$WHEELHOUSE/$(PACKAGENAME)-$(VERSION)/; \
bash -c '\
rm -fr $(PACKAGENAME)-$(VERSION)/; \
tar zxf /io/$< && cd $(PACKAGENAME)-$(VERSION)/ || exit 1; \
for PYBIN in /opt/python/*/bin; do \
PYVER="$$($$PYBIN/python -V)"; \
PROFDIR="prof-$${PYVER// /_}"; \
echo $$PYVER; \
$$PYBIN/pip install -U pip setuptools wheel; \
make clean; rm -fr $$PROFDIR; \
CFLAGS="$$CFLAGS -fprofile-generate -fprofile-dir=$$PROFDIR" $$PYBIN/python setup.py build_ext -i; \
$$PYBIN/python lockbench.py rlock flock; \
CFLAGS="$$CFLAGS -fprofile-use -fprofile-correction -fprofile-dir=$$PROFDIR" $$PYBIN/python setup.py build_ext -i -f; \
$$PYBIN/python lockbench.py 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'
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 {} \;
Expand Down

0 comments on commit 17a4b77

Please sign in to comment.