~ubuntu-branches/ubuntu/wily/python-imaging/wily

« back to all changes in this revision

Viewing changes to debian/rules

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-01-31 20:49:20 UTC
  • mfrom: (27.1.1 raring-proposed)
  • Revision ID: package-import@ubuntu.com-20130131204920-b5zshy6vgfvdionl
Tags: 1.1.7+1.7.8-1ubuntu1
Rewrite build dependencies to allow cross builds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
PYVERS  := $(shell pyversions -vr)
7
7
PYVER   := $(shell python -c 'import sys; print sys.version[:3]')
8
8
 
 
9
PY3VERS := $(shell py3versions -vr)
 
10
PY3VER   := $(shell python3 -c 'import sys; print(sys.version[:3])')
 
11
 
9
12
include /usr/share/python/python.mk
10
13
 
 
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)
 
17
 
 
18
  # FIXME: is this sufficient?
 
19
  SET_CROSS_ENV += _PYTHON_HOST_PLATFORM=$(DEB_HOST_GNU_CPU)
 
20
endif
 
21
 
 
22
build-arch: build
 
23
build-indep: build
11
24
build: build-stamp
12
 
build-stamp: $(PYVERS:%=build-stamp-python%)
 
25
build-stamp: $(PYVERS:%=build-stamp-python%) $(PY3VERS:%=build-stamp-python%)
13
26
        touch $@
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
17
30
 
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
20
33
        touch $@
21
34
 
22
35
clean:
24
37
        dh_testroot
25
38
        rm -f *-stamp*
26
39
        rm -rf compile build Sane/build
 
40
        rm -rf Pillow*.egg-info
27
41
        find -name '*.py[co]' -exec rm -f {} \;
28
42
        dh_clean
29
43
 
31
45
        wget -r --no-parent --no-host-directories --cut-dirs=2 \
32
46
                http://www.pythonware.com/library/pil/handbook/index.htm
33
47
 
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/*
37
51
 
38
 
        dh_installdocs -ppython-imaging README
 
52
        dh_installdocs -ppython-imaging README.rst
39
53
 
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
42
56
 
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,' \
47
61
                $$i > $$i.temp; \
48
62
          if cmp --quiet $$i $$i.temp; then \
53
67
            echo "fixed interpreter: $$i"; \
54
68
          fi; \
55
69
        done
 
70
        for i in `find debian/python3-imaging* -mindepth 3 -type f`; do \
 
71
          sed '1s,#!.*python[^ ]*\(.*\),#! /usr/bin/python3\1,' \
 
72
                $$i > $$i.temp; \
 
73
          if cmp --quiet $$i $$i.temp; then \
 
74
            rm -f $$i.temp; \
 
75
          else \
 
76
            mv -f $$i.temp $$i; \
 
77
            chmod 755 $$i; \
 
78
            echo "fixed interpreter: $$i"; \
 
79
          fi; \
 
80
        done
 
81
        for i in debian/python3-imaging/usr/bin/*.py; do \
 
82
          mv $$i debian/python3-imaging/usr/bin/$$(basename $$i .py); \
 
83
        done
56
84
 
57
85
install-prereq:
58
86
        dh_testdir
60
88
        dh_clean -k
61
89
 
62
90
install-python%:
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 \
72
101
 
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
77
106
 
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; \
83
113
        done
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)
86
116
 
87
117
        find debian/python-imaging*-dbg \
90
120
 
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
 
124
 
 
125
install3-python%:
 
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)
 
130
 
 
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 \
 
136
                libImaging/ImDib.h \
 
137
                debian/python3-imaging/$$incdir
 
138
 
 
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
 
144
 
 
145
        $(SET_CROSS_ENV) python$*-dbg setup.py install --root $(CURDIR)/debian/python3-imaging-dbg \
 
146
                $(py_setup_install_args)
 
147
 
 
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; \
 
154
        done
 
155
        cd Sane && $(SET_CROSS_ENV) python$*-dbg setup.py install \
 
156
                --root $(CURDIR)/debian/python3-imaging-sane-dbg  $(py_setup_install_args)
 
157
 
 
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 {} \;
 
161
 
 
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
94
166
 
95
167
# Build architecture-independent files here.
96
168
# Pass -i to all debhelper commands in this target to reduce clutter.
104
176
#       dh_installman -i
105
177
#       dh_installinfo -i
106
178
#       dh_undocumented -i
107
 
        dh_installchangelogs -i CHANGES
 
179
        dh_installchangelogs -i #CHANGES
108
180
        dh_python2 -i
109
181
        dh_link -i
110
182
        dh_compress -i -X.py
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 \
 
202
 
 
203
        for p in \
 
204
          python-imaging python-imaging-tk python-imaging-sane \
 
205
          python3-imaging python3-imaging-tk python3-imaging-sane; \
 
206
        do \
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; \
132
209
        done
133
210
        dh_python2 -a
 
211
        dh_python3 -a
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
137
218
        dh_link -a
138
219
        dh_compress -a -X.py
139
220
        dh_fixperms -a