#!/usr/bin/make -f # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 PY3VERS := $(shell py3versions -vr) PY3VER := $(shell python3 -c 'import sys; print(sys.version[:3])') include /usr/share/python3/python.mk include /usr/share/dpkg/architecture.mk ifneq ($(DEB_BUILD_MULTIARCH),$(DEB_HOST_MULTIARCH)) SET_CROSS_ENV = PYTHONPATH=/usr/lib/python$$pv/plat-$(DEB_HOST_MULTIARCH) # FIXME: is this sufficient? SET_CROSS_ENV += _PYTHON_HOST_PLATFORM=$(DEB_HOST_GNU_CPU) endif build-arch: build build-indep: build build: build-stamp build-stamp: $(PY3VERS:%=build-stamp-python%) $(PY3VERS:%=check-stamp-python%) touch $@ build-stamp-python%: $(SET_CROSS_ENV) python$* setup.py build touch $@ pillow_tests = $(wildcard Tests/test*.py) check-stamp-python%: ifeq ($(DEB_BUILD_MULTIARCH),$(DEB_HOST_MULTIARCH)) : # pillow Sane doesn't have any tests endif touch $@ clean: dh_testdir dh_testroot rm -f *-stamp* rm -rf compile build rm -rf debian/PILcompat/build rm -rf Pillow*.egg-info find -name '*.py[co]' -exec rm -f {} \; find -type d -name __pycache__ | xargs -r rm -rf rm -rf tmp dh_clean install: build install-prereq $(PY3VERS:%=install3-python%) dh_installdocs -ppython3-sane sanedoc.txt # dh_installexamples -ppython-sane demo*.py : # Replace all '#!' calls to python with /usr/bin/python : # and make them executable for i in `find debian/python-pil* -mindepth 3 -type f`; do \ sed '1s,#!.*python[^ ]*\(.*\),#! /usr/bin/python\1,' \ $$i > $$i.temp; \ if cmp --quiet $$i $$i.temp; then \ rm -f $$i.temp; \ else \ mv -f $$i.temp $$i; \ chmod 755 $$i; \ echo "fixed interpreter: $$i"; \ fi; \ done for i in `find debian/python3-pil* -mindepth 3 -type f`; do \ sed '1s,#!.*python[^ ]*\(.*\),#! /usr/bin/python3\1,' \ $$i > $$i.temp; \ if cmp --quiet $$i $$i.temp; then \ rm -f $$i.temp; \ else \ mv -f $$i.temp $$i; \ chmod 755 $$i; \ echo "fixed interpreter: $$i"; \ fi; \ done install-prereq: dh_testdir dh_testroot dh_prep install3-python%: $(SET_CROSS_ENV) python$* setup.py install \ --root $(CURDIR)/debian/python3-sane $(py_setup_install_args) # Build architecture-independent files here. # Pass -i to all debhelper commands in this target to reduce clutter. binary-indep: build install dh_testdir -i dh_testroot -i # Build architecture-dependent files here. binary-arch: build install dh_testdir -a dh_testroot -a dh_installdocs -a dh_installexamples -a dh_installchangelogs -a #CHANGES dh_python3 -a dh_numpy3 -a dh_strip -ppython3-sane dh_link -a dh_compress -a -X.py dh_fixperms -a dh_installdeb -a dh_shlibdeps -a dh_gencontrol -a dh_md5sums -a dh_builddeb -a binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install