File: rules

package info (click to toggle)
python-numarray 1.5.2-4
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 8,668 kB
  • ctags: 11,384
  • sloc: ansic: 113,864; python: 22,422; makefile: 197; sh: 11
file content (175 lines) | stat: -rwxr-xr-x 5,026 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#!/usr/bin/make -f
# -*- mode: makefile -*-
# Made with the aid of debmake, by Christoph Lameter,
# based on the sample debian/rules file for GNU hello by Ian Jackson.

SHELL	= /bin/bash
PWD	= $(shell pwd)
PLATFORM= $(shell python -c \
		'import distutils.util; print distutils.util.get_platform()')

# all versions
PYVERS	:= $(shell pyversions -vs)
PYVER	:= $(shell pyversions -vd)

changes_file = Doc/release_notes/ANNOUNCE-1.5

p_num	= python-numarray
p_ext	= python-numarray-ext
p_dbg	= python-numarray-dbg
p_doc	= python-numarray-doc

d_num	= debian/$(p_num)
d_ext	= debian/$(p_ext)
d_dbg	= debian/$(p_dbg)
d_doc	= debian/$(p_doc)

DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)

ifneq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH),arm))
  USE_LAPACK = --use_lapack
endif

build: stamp-build
stamp-build: $(PYVERS:%=stamp-build-%)
	touch $@

stamp-build-%:
	dh_testdir
	/usr/bin/python$* setup.py config build --gencode $(USE_LAPACK)
	/usr/bin/python$*-dbg setup.py config build --gencode $(USE_LAPACK)
	touch $@

stamp-build-doc:
	touch $@

# this requires as additional build dependencies: latex2html, netpbm
PDOC = /usr/lib/python$(PYVER)/doc
my-build-doc:
	ln -sf $(PDOC)/html/icons Doc/manual/.
	ln -sf $(PDOC)/tools/mkhowto Doc/manual/.
	ln -sf $(PDOC)/tools/mkinfo Doc/manual/.
	rm -rf Doc/manual/numarray
	mkdir -p Doc/manual/numarray
	cp -pr /usr/lib/python$(PYVER)/doc/html/icons Doc/manual/numarray/.
#	$(MAKE) -C Doc/manual \
#		MKHOWTO="python ./mkhowto -i" numarray.html
	$(MAKE) -C Doc/manual \
		MKHOWTO="python $(PDOC)/tools/mkhowto -i" numarray.html
	rm -f Doc/manual/numarray/images.*
	rm -rf Doc/manual/html
	mv Doc/manual/numarray Doc/manual/html
	for i in Doc/manual/html/*.html; do \
	  sed 's,src="../icons/,src="icons/,g' $$i > $$i.new; \
	  mv -f $$i.new $$i; \
	done
	cd Doc/manual && GZIP=-9v tar cfj html.tbz html
	mv Doc/manual/html.tbz .

clean:
	dh_testdir
	dh_testroot
	rm -f stamp-*
	-rm -rf `find -name build -type d`
	-find -name '*.py[co]' | xargs rm -f
	rm -f Src/_{conv,sort,bytes,ufunc[A-Z]*}module.c
	rm -f Src/libnumarraymodule.c
	rm -rf Doc/manual/{html,icons,mkhowto,mkinfo,numarray}
	rm -f Lib/numinclude.py
	dh_clean

install: build pre-install $(PYVERS:%=stamp-install-%)
pre-install:
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

stamp-install-%: stamp-build-%
	/usr/bin/python$* setup.py config install  $(USE_LAPACK) \
		--root=$(PWD)/$(d_num)
	rm -f $(d_num)/usr/lib/python$*/site-packages/numarray/LICENSE.txt
	rm -rf $(d_num)/usr/lib/python$*/site-packages/numarray/examples
	find $(d_num) -name '*.py[co]' | xargs -r rm -f

	: # Replace all '#!' calls to python with python
	: # and make them executable
	for i in `find $(d_num) -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

	/usr/bin/python$*-dbg setup.py config install  $(USE_LAPACK) \
		--root=$(PWD)/$(d_dbg) \
		--install-headers=/usr/include/python$*_d/numarray
	rm -rf $(d_dbg)/usr/lib/python$*/site-packages/numarray/examples
	for i in $(d_dbg)/usr/include/python$*_d/numarray/*.h; do \
	  ln -sf ../../python$*/numarray/$$(basename $$i) $$i; \
	done
	find $(d_dbg) ! -type d ! \( -name '*_d.so' -o -name '*.h' \) \
		| xargs rm -f
	find $(d_num) $(d_dbg) -depth -empty -exec rmdir {} \;


binary-indep: build stamp-build-doc install
	dh_testdir
	dh_testroot

	dh_installdocs -p$(p_doc)
	mkdir -p $(d_doc)/usr/share/doc/$(p_doc)
	cd $(d_doc)/usr/share/doc/$(p_doc) && tar xfj $(PWD)/html.tbz
	dh_installchangelogs -p$(p_doc) $(changes_file)
	dh_installexamples -p$(p_doc) Examples/*

	: # Replace all '#!' calls to python with python
	: # and make them executable
	for i in `find $(d_doc) -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

	dh_compress -i -X.py -X.pik -X.pdf -X.css -X.c
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdocs -p$(p_num) \
		README.txt Doc/{Announce,Design,Repackaging,UsersGuide}.txt
	dh_installchangelogs -p$(p_num) $(changes_file)
	mkdir -p $(d_ext)/usr/share/doc
	ln -sf $(p_num) $(d_ext)/usr/share/doc/$(p_ext)
	mkdir -p $(d_dbg)/usr/share/doc
	ln -sf $(p_num) $(d_dbg)/usr/share/doc/$(p_dbg)
	dh_pycentral -a
	dh_strip -ppython-numarray --dbg-package=python-numarray-dbg
	dh_compress -a -X.py
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	sed -i -e 's/atlas3-base | lapack3/lapack3 | atlas3-base/; s/atlas3-base | refblas3/refblas3 | atlas3-base/' debian/python*.substvars
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-arch binary-indep

.PHONY: binary binary-arch binary-indep clean