Debian Codegraph @

Makefile

raw symbols SCIP
1 PYTHON?=python3
2 USE_BUNDLE?=true
3 VERSION?=$(shell sed -ne "s|^VERSION\s*=\s*'\([^']*\)'.*|\1|p" setup.py)
4 WITH_CYTHON?=$(shell $(PYTHON) -c 'import Cython.Build.Dependencies' >/dev/null 2>/dev/null && echo " --with-cython" || true)
5 WITH_PARALLEL?=$(shell $(PYTHON) -c 'import sys ; print("-j6" if sys.version_info[0] >= 3 else "")' || true)
6 WITH_LUA_DLOPEN?=true
7 PYTHON_BUILD_VERSION?=*
8
9 MANYLINUX_IMAGES= \
10 manylinux1_x86_64 \
11 manylinux1_i686 \
12 manylinux_2_24_i686 \
13 manylinux_2_28_x86_64 \
14 manylinux2014_aarch64 \
15 manylinux_2_24_aarch64 \
16 manylinux_2_28_aarch64 \
17 manylinux_2_24_ppc64le \
18 manylinux_2_24_s390x \
19 musllinux_1_1_x86_64 \
20 musllinux_1_1_aarch64
21
22 .PHONY: all local sdist test clean realclean
23
24 all: local
25
26 local:
27 LUPA_WITH_LUA_DLOPEN=$(WITH_LUA_DLOPEN) ${PYTHON} setup.py build_ext --inplace $(WITH_PARALLEL) $(WITH_CYTHON)
28
29 sdist dist/lupa-$(VERSION).tar.gz:
30 ${PYTHON} setup.py sdist
31
32 test: local
33 PYTHONPATH=. $(PYTHON) -m unittest -v lupa.tests.suite
34
35 clean:
36 rm -fr build lupa/_lupa*.so lupa/lua*.pyx lupa/*.c
37 @for dir in third-party/*/; do $(MAKE) -C $${dir} clean; done
38
39 realclean: clean
40 rm -fr lupa/_lupa.c
41
42 wheel:
43 LUPA_WITH_LUA_DLOPEN=$(WITH_LUA_DLOPEN) $(PYTHON) setup.py build_ext $(WITH_PARALLEL) bdist_wheel $(WITH_CYTHON)
44
45 qemu-user-static:
46 docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
47
48 wheel_manylinux: $(addprefix wheel_,$(MANYLINUX_IMAGES))
49 $(addprefix wheel_,$(filter-out %_x86_64, $(filter-out %_i686, $(MANYLINUX_IMAGES)))): qemu-user-static
50
51 wheel_%: dist/lupa-$(VERSION).tar.gz
52 @echo "Building $(subst wheel_,,$@) wheels for Lupa $(VERSION)"
53 mkdir -p wheelhouse_$(subst wheel_,,$@)
54 time docker run --rm -t \
55 -v $(shell pwd):/io \
56 -e CFLAGS="-O3 -g0 -mtune=generic -pipe -fPIC -flto" \
57 -e LDFLAGS="$(LDFLAGS) -fPIC -flto" \
58 -e LD=gcc-ld \
59 -e AR=gcc-ar \
60 -e NM=gcc-nm \
61 -e RANLIB=gcc-ranlib \
62 -e LUPA_USE_BUNDLE=$(USE_BUNDLE) \
63 -e LUPA_WITH_LUA_DLOPEN=$(WITH_LUA_DLOPEN) \
64 -e WHEELHOUSE=wheelhouse_$(subst wheel_,,$@) \
65 quay.io/pypa/$(subst wheel_,,$@) \
66 bash -c 'echo "Python versions: $$(ls /opt/python/ | xargs -n 100 echo)" ; \
67 for PYBIN in /opt/python/$(PYTHON_BUILD_VERSION)/bin; do \
68 $$PYBIN/python -V; \
69 { time $$PYBIN/pip wheel -v -w /io/$$WHEELHOUSE /io/$< & } ; \
70 done; wait; \
71 for whl in /io/$$WHEELHOUSE/lupa-$(VERSION)-*-linux_*.whl; do auditwheel repair $$whl -w /io/$$WHEELHOUSE; done; \
72 for whl in /io/$$WHEELHOUSE/lupa-$(VERSION)-*-m*linux*.whl; do \
73 pyver=$${whl#*/lupa-$(VERSION)-}; pyver=$${pyver%%-m*}; \
74 echo "Installing in $${pyver}: $${whl}"; \
75 /opt/python/$${pyver}/bin/python -m pip install -U $${whl} && /opt/python/$${pyver}/bin/python -c "import lupa" || exit 1; \
76 /opt/python/$${pyver}/bin/python -m pip uninstall -y lupa; \
77 done; true'