6
6
PYVERS := $(shell pyversions -vr)
7
7
PYVER := $(shell python -c 'import sys; print sys.version[:3]')
9
PY3VERS := $(shell py3versions -vr)
10
PY3VER := $(shell python3 -c 'import sys; print(sys.version[:3])')
9
12
include /usr/share/python/python.mk
14
include /usr/share/dpkg/architecture.mk
15
ifneq ($(DEB_BUILD_MULTIARCH),$(DEB_HOST_MULTIARCH))
16
SET_CROSS_ENV = PYTHONPATH=/usr/lib/python$$pv/plat-$(DEB_HOST_MULTIARCH)
18
# FIXME: is this sufficient?
19
SET_CROSS_ENV += _PYTHON_HOST_PLATFORM=$(DEB_HOST_GNU_CPU)
12
build-stamp: $(PYVERS:%=build-stamp-python%)
25
build-stamp: $(PYVERS:%=build-stamp-python%) $(PY3VERS:%=build-stamp-python%)
14
27
build-stamp-python%:
15
python$* setup.py build
16
cd Sane && python$* setup.py build
28
$(SET_CROSS_ENV) python$* setup.py build
29
cd Sane && $(SET_CROSS_ENV) python$* setup.py build
18
python$*-dbg setup.py build
19
cd Sane && python$*-dbg setup.py build
31
$(SET_CROSS_ENV) python$*-dbg setup.py build
32
cd Sane && $(SET_CROSS_ENV) python$*-dbg setup.py build
31
45
wget -r --no-parent --no-host-directories --cut-dirs=2 \
32
46
http://www.pythonware.com/library/pil/handbook/index.htm
34
install: build install-prereq $(PYVERS:%=install-python%)
35
dh_installdocs -ppython-imaging-doc Docs/*
48
install: build install-prereq $(PYVERS:%=install-python%) $(PY3VERS:%=install3-python%)
49
dh_installdocs -ppython-imaging-doc #Docs/*
36
50
dh_installexamples -ppython-imaging-doc Scripts/*
38
dh_installdocs -ppython-imaging README
52
dh_installdocs -ppython-imaging README.rst
40
54
dh_installdocs -ppython-imaging-sane Sane/sanedoc.txt
41
dh_installexamples -ppython-imaging-sane Sane/demo*.py
55
# dh_installexamples -ppython-imaging-sane Sane/demo*.py
43
57
: # Replace all '#!' calls to python with /usr/bin/python
44
58
: # and make them executable
45
for i in `find debian -mindepth 3 -type f`; do \
59
for i in `find debian/python-imaging* -mindepth 3 -type f`; do \
46
60
sed '1s,#!.*python[^ ]*\(.*\),#! /usr/bin/python\1,' \
48
62
if cmp --quiet $$i $$i.temp; then \
53
67
echo "fixed interpreter: $$i"; \
70
for i in `find debian/python3-imaging* -mindepth 3 -type f`; do \
71
sed '1s,#!.*python[^ ]*\(.*\),#! /usr/bin/python3\1,' \
73
if cmp --quiet $$i $$i.temp; then \
78
echo "fixed interpreter: $$i"; \
81
for i in debian/python3-imaging/usr/bin/*.py; do \
82
mv $$i debian/python3-imaging/usr/bin/$$(basename $$i .py); \
63
python$* setup.py install --root $(CURDIR)/debian/python-imaging $(py_setup_install_args)
64
cd Sane && python$* setup.py install \
91
$(SET_CROSS_ENV) python$* setup.py install --root $(CURDIR)/debian/python-imaging \
92
$(py_setup_install_args)
93
cd Sane && $(SET_CROSS_ENV) python$* setup.py install \
65
94
--root $(CURDIR)/debian/python-imaging-sane $(py_setup_install_args)
66
95
mkdir -p debian/python-imaging/usr/include/python$*
67
96
install -o root -g root -m 644 \
73
102
dh_movefiles -ppython-imaging-tk \
74
103
--sourcedir=debian/python-imaging \
75
usr/lib/python$*/$(call py_sitename_sh, $*)/PIL/_imagingtk.so \
104
usr/lib/python$*/$(call py_sitename_sh, $*)/_imagingtk.so \
76
105
usr/lib/python$*/$(call py_sitename_sh, $*)/PIL/ImageTk.py
78
python$*-dbg setup.py install --root $(CURDIR)/debian/python-imaging-dbg $(py_setup_install_args)
107
$(SET_CROSS_ENV) python$*-dbg setup.py install --root $(CURDIR)/debian/python-imaging-dbg \
108
$(py_setup_install_args)
79
109
mkdir -p debian/python-imaging-dbg/usr/include/python$*_d
80
110
for i in Imaging.h ImPlatform.h ImDib.h; do \
81
111
ln -sf ../python$*/$$i \
82
112
debian/python-imaging-dbg/usr/include/python$*_d/$$i; \
84
cd Sane && python$*-dbg setup.py install \
114
cd Sane && $(SET_CROSS_ENV) python$*-dbg setup.py install \
85
115
--root $(CURDIR)/debian/python-imaging-sane-dbg $(py_setup_install_args)
87
117
find debian/python-imaging*-dbg \
91
121
dh_movefiles -ppython-imaging-tk-dbg \
92
122
--sourcedir=debian/python-imaging-dbg \
93
usr/lib/python$*/$(call py_sitename_sh, $*)/PIL/_imagingtk_d.so
123
usr/lib/python$*/$(call py_sitename_sh, $*)/_imagingtk_d.so
126
$(SET_CROSS_ENV) python$* setup.py install --root $(CURDIR)/debian/python3-imaging \
127
$(py_setup_install_args)
128
cd Sane && $(SET_CROSS_ENV) python$* setup.py install \
129
--root $(CURDIR)/debian/python3-imaging-sane $(py_setup_install_args)
131
incdir=$$(python$* -c 'import sysconfig; print(sysconfig.get_path("include"))'); \
132
mkdir -p debian/python3-imaging/$$incdir; \
133
install -o root -g root -m 644 \
134
libImaging/Imaging.h \
135
libImaging/ImPlatform.h \
137
debian/python3-imaging/$$incdir
139
abitag=.$$(python$* -c "import sysconfig; print(sysconfig.get_config_var('SOABI'))"); \
140
dh_movefiles -ppython3-imaging-tk \
141
--sourcedir=debian/python3-imaging \
142
usr/lib/python3/$(call py_sitename_sh, $*)/_imagingtk$$abitag.so \
143
usr/lib/python3/$(call py_sitename_sh, $*)/PIL/ImageTk.py
145
$(SET_CROSS_ENV) python$*-dbg setup.py install --root $(CURDIR)/debian/python3-imaging-dbg \
146
$(py_setup_install_args)
148
incname=$$(basename $$(python$* -c 'import sysconfig; print(sysconfig.get_path("include"))')); \
149
incddir=$$(python$*-dbg -c 'import sysconfig; print(sysconfig.get_path("include"))'); \
150
mkdir -p debian/python3-imaging-dbg/$$incddir; \
151
for i in Imaging.h ImPlatform.h ImDib.h; do \
152
ln -sf ../$$incname/$$i \
153
debian/python3-imaging-dbg/$$incddir/$$i; \
155
cd Sane && $(SET_CROSS_ENV) python$*-dbg setup.py install \
156
--root $(CURDIR)/debian/python3-imaging-sane-dbg $(py_setup_install_args)
158
find debian/python3-imaging*-dbg \
159
! -type d ! \( -name '*.so' -o -name '*.h' \) | xargs rm -f
160
find debian/python3-imaging*-dbg -depth -empty -exec rmdir {} \;
162
abitag=.$$(python$*-dbg -c "import sysconfig; print(sysconfig.get_config_var('SOABI'))"); \
163
dh_movefiles -ppython3-imaging-tk-dbg \
164
--sourcedir=debian/python3-imaging-dbg \
165
usr/lib/python3/$(call py_sitename_sh, $*)/_imagingtk$$abitag.so
95
167
# Build architecture-independent files here.
96
168
# Pass -i to all debhelper commands in this target to reduce clutter.
125
197
# dh_installman -a
126
198
# dh_installinfo -a
127
199
# dh_undocumented -a
128
dh_installchangelogs -a CHANGES
129
for p in python-imaging python-imaging-tk python-imaging-sane; do \
200
dh_installchangelogs -a #CHANGES
201
# for p in python-imaging python-imaging-tk python-imaging-sane; do \
204
python-imaging python-imaging-tk python-imaging-sane \
205
python3-imaging python3-imaging-tk python3-imaging-sane; \
130
207
rm -rf debian/$$p-dbg/usr/share/doc/$$p-dbg; \
131
208
ln -s $$p debian/$$p-dbg/usr/share/doc/$$p-dbg; \
134
212
dh_strip -ppython-imaging --dbg-package=python-imaging-dbg
135
213
dh_strip -ppython-imaging-tk --dbg-package=python-imaging-tk-dbg
136
214
dh_strip -ppython-imaging-sane --dbg-package=python-imaging-sane-dbg
215
dh_strip -ppython3-imaging --dbg-package=python3-imaging-dbg
216
dh_strip -ppython3-imaging-tk --dbg-package=python3-imaging-tk-dbg
217
dh_strip -ppython3-imaging-sane --dbg-package=python3-imaging-sane-dbg
138
219
dh_compress -a -X.py