File: rules

package info (click to toggle)
python2.2 2.2.3dfsg-2sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 36,920 kB
  • ctags: 69,127
  • sloc: ansic: 219,839; python: 203,969; sh: 9,690; makefile: 3,468; perl: 3,454; lisp: 3,248; xml: 2,262; cpp: 106; sed: 2
file content (593 lines) | stat: -rwxr-xr-x 17,405 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.

export SHELL = /bin/bash

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This is the debhelper compatibility version to use.
export DH_COMPAT=3

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

export VER=2.2
export NVER=2.3
export PVER=python$(VER)
export PICLIB=libpython$(VER)-pic.a
export PRIORITY=$(shell echo $(VER) | tr -d '.')0

PREVVER	:= $(shell awk '/^python/ && NR > 1 {print substr($$2,2,length($$2)-2); exit}' debian/changelog)

DEFAULT_VERSION = no
STATIC_PYTHON=yes

# set this (in the environment), when regenerating the docs. requires
# latex2html as a build dependency.
USE_L2H ?= no

ifeq ($(DEFAULT_VERSION),yes)
  PY_INTERPRETER = /usr/bin/python
  PY_PRIO = standard
  PY_STDDEP = , python (>= $(VER))
else
  PY_INTERPRETER = /usr/bin/python$(VER)
  PY_PRIO = optional
endif

CC = gcc

# on alpha, use -O2 only, use -mieee
ifeq ($(DEB_HOST_ARCH),alpha)
    OPTSETTINGS = OPT="-DNDEBUG -g -O2 -mieee -fno-strict-aliasing -Wall -Wstrict-prototypes"
endif

# on arm, use gcc-3.2
#GCCBDEP = , gcc-3.2 [arm]
#ifeq ($(DEB_HOST_ARCH),arm)
#    CC = gcc-3.2
#    GCCDEP = , gcc-3.2
#endif

# don't run tests, which cause timeouts on some buildd's
TESTOPTS = -l -x test_linuxaudiodev
ifneq (,$(findstring $(DEB_HOST_ARCH),mips))
  TESTOPTS = -l -x test_threaded_import test_linuxaudiodev
endif

builddir := $(shell pwd)/builddir
d	 := debian/tmp

# package names and directories
p_base	:= $(PVER)
p_tk	:= $(PVER)-tk
p_gdbm	:= $(PVER)-gdbm
p_mpz	:= $(PVER)-mpz
p_zlib	:= $(PVER)-zlib
p_dev	:= $(PVER)-dev
p_exam	:= $(PVER)-examples
p_xml	:= $(PVER)-xmlbase
p_idle	:= idle-$(PVER)
p_doc	:= $(PVER)-doc

d_base	:= debian/$(p_base)
d_tk	:= debian/$(p_tk)
d_gdbm	:= debian/$(p_gdbm)
d_mpz	:= debian/$(p_mpz)
d_zlib	:= debian/$(p_zlib)
d_dev	:= debian/$(p_dev)
d_exam	:= debian/$(p_exam)
d_xml	:= debian/$(p_xml)
d_idle	:= debian/$(p_idle)
d_doc	:= debian/$(p_doc)

build: build-stamp check-stamp
build-stamp: configure-stamp
	dh_testdir
	$(MAKE) -C $(builddir) \
		STATIC_PYTHON=$(STATIC_PYTHON) RUNSHARED= LINKCC=$(CC)
	$(MAKE) -C $(builddir) PICLIBRARY=$(PICLIB) RUNSHARED= $(PICLIB)
	touch build-stamp


check-stamp:
	@echo "BEGIN test"
	-$(MAKE) -C $(builddir) test TESTOPTS="$(TESTOPTS)" \
		2>&1 | tee debian/test_results
	@echo "END test"
	touch check-stamp

stamp-doc-html:
	dh_testdir
	LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}$(builddir) \
		$(MAKE) -C Doc tarhtml PYTHON=$(builddir)/python
	touch stamp-doc-html

stamp-doc-info:
	dh_testdir
	$(MAKE) -C Doc/info VERSION=$(VER)
	touch stamp-doc-info

ifeq ($(USE_L2H),yes)
stamp-doc: stamp-doc-html stamp-doc-info update-doc
	touch stamp-doc
else
stamp-doc: stamp-unpack-doc
	touch stamp-doc
endif

update-doc:
	: # copy just build docs to debian/patches
	tar cfj - Doc/html-*.tar Doc/info/*.info* \
	    | uuencode -m docs.tar.bz2 > debian/patches/docs.uue

stamp-unpack-doc:
	uudecode debian/patches/docs.uue
	tar xfj docs.tar.bz2
	rm -f docs.tar.bz2
	touch stamp-unpack-doc

control-file:
	sed -e "s/@PVER@/$(PVER)/g" \
	    -e "s/@VER@/$(VER)/g" \
	    -e "s/@PYSTDDEP@/$(PYSTDDEP)/g" \
	    -e "s/@GCCDEP@/$(GCCDEP)/g" \
	    -e "s/@GCCBDEP@/$(GCCBDEP)/g" \
	    -e "s/@PRIO@/$(PY_PRIO)/g" \
		<debian/control.in >debian/control.tmp
ifeq ($(DEFAULT_VERSION),yes)
	sed -e "s/@PVER@/$(PVER)/g" \
	    -e "s/@NVER@/$(NVER)/g" \
	    -e "s/@VER@/$(VER)/g" \
	    -e "s/@PREVVER@/$(PREVVER)/g" \
	    -e "s/@PRIO@/$(PY_PRIO)/g" \
		<debian/control.in-legacy >>debian/control.tmp
endif
	[ -e debian/control ] \
	  && cmp -s debian/control debian/control.tmp \
	  && rm -f debian/control.tmp && exit 0; \
	  mv debian/control.tmp debian/control

configure: control-file configure-stamp
configure-stamp: patch-stamp
	mkdir -p $(builddir)
	cd $(builddir) && \
	  CC="$(CC)" \
	  $(OPTSETTINGS) \
	    ../configure \
		--prefix=/usr \
		--with-fpectl \
		--enable-ipv6
	touch configure-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f configure-stamp build-stamp install-stamp doc-stamp* check-stamp
	$(MAKE) -f debian/rules unpatch
	rm -f stamp-*
	rm -f patch-stamp* pxxx
	rm -f debian/test_results

	-$(MAKE) -C $(builddir) clean
	-$(MAKE) -C Doc realclean
	-$(MAKE) -C Doc/info clobber
	rm -f Doc/html-*.t??
	-$(MAKE) -f Makefile.pre.in srcdir=. distclean
	rm -rf $(builddir)
	-find -name '*.py[co]' | xargs -n 50 rm -f

	for f in debian/*.in; do \
	    f2=`echo $$f | sed "s,PVER,$(PVER),g;s/@VER@/$(VER)/g;s,\.in$$,,"`; \
	    if [ $$f2 != debian/control ]; then \
	        rm -f $$f2; \
	    fi; \
	done

	dh_clean

control-stamp:
	: # We have to prepare the various control files

	for f in debian/*.in; do \
	    f2=`echo $$f | sed "s,PVER,$(PVER),g;s/@VER@/$(VER)/g;s,\.in$$,,"`; \
	    if [ $$f2 != debian/control ]; then \
		sed "s/@PVER@/$(PVER)/g;s/@VER@/$(VER)/g;s/@PRIORITY@/$(PRIORITY)/g" <$$f >$$f2; \
	    fi; \
	done

install: install-stamp
install-stamp: build-stamp control-stamp
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	: # make install into tmp and subsequently move the files into
	: # their packages' directories.
	install -d $(d)/usr \
		$(d)/usr/share/man/man1
	$(MAKE) -C $(builddir) prefix=`pwd`/$(d)/usr install \
		STATIC_PYTHON=$(STATIC_PYTHON) RUNSHARED=

	: # move manpage to new name
	mv $(d)/usr/man/man1/python.1 $(d)/usr/share/man/man1/python$(VER).1
	rmdir $(d)/usr/man/man1 $(d)/usr/man
	cp -p debian/pydoc.1 $(d)/usr/share/man/man1/pydoc$(VER).1

	: # Symlinks to /usr/bin for some tools
	dh_link -p$(p_base) \
	    /usr/lib/python$(VER)/pdb.py /usr/bin/pdb$(VER)
	cp -p debian/pdb.1 $(d)/usr/share/man/man1/pdb$(VER).1

	ln -sf ../../libpython$(VER).so \
		$(d)/usr/lib/python$(VER)/config/libpython$(VER).so

	mv $(d)/usr/bin/pydoc $(d)/usr/bin/pydoc$(VER)
	cp -p Tools/i18n/pygettext.py $(d)/usr/bin/pygettext$(VER)
	cp -p debian/pygettext.1 $(d)/usr/share/man/man1/pygettext$(VER).1

	: # Move the static library and the header files into $(p_dev).
	dh_installdirs -p$(p_dev) \
		usr/lib/python$(VER) usr/include usr/lib
	dh_movefiles -p$(p_dev) --sourcedir=$(d) \
		usr/lib/python$(VER)/config \
		usr/include/python$(VER) \
		usr/lib/libpython$(VER).so
	cp -p $(builddir)/$(PICLIB) $(d_dev)/usr/lib/python$(VER)/config/

	: # Move the Tkinter files into $(p_tk).
	dh_installdirs -p$(p_tk) \
		usr/lib/python$(VER)/lib-dynload
	dh_movefiles -p$(p_tk) --sourcedir=$(d) \
		usr/lib/python$(VER)/lib-tk \
		usr/lib/python$(VER)/lib-dynload/_tkinter.so

	: # mpz module into $(p_mpz).
	dh_installdirs -p$(p_mpz) \
		usr/lib/python$(VER)/lib-dynload
	dh_movefiles -p$(p_mpz) --sourcedir=$(d) \
		usr/lib/python$(VER)/lib-dynload/mpz.so

	: # gdbm and dbm modules into $(p_gdbm).
	dh_installdirs -p$(p_gdbm) \
		usr/lib/python$(VER)/lib-dynload
	dh_movefiles -p$(p_gdbm) --sourcedir=$(d) \
		usr/lib/python$(VER)/lib-dynload/gdbm.so

	: # xml module into $(p_xml).
	dh_installdirs -p$(p_xml) \
		usr/lib/python$(VER)/lib-dynload
	dh_movefiles -p$(p_xml) --sourcedir=$(d) \
		usr/lib/python$(VER)/lib-dynload/pyexpat.so \
		usr/lib/python$(VER)/xml

#	: # The test framework into $(p_base), regression tests dropped
	dh_movefiles -p$(p_base) --sourcedir=$(d) \
		usr/lib/python$(VER)/test/{regrtest.py,test_support.py,__init__.py,README,pystone.py}
	rm -rf $(d)/usr/lib/python$(VER)/test

#	: # Prepare python-mode.el in $(p_elisp).
#	dh_installdirs -p$(p_elisp) \
#		usr/lib/emacsen-common/packages/install \
#		usr/lib/emacsen-common/packages/remove \
#		usr/share/emacs/site-lisp/$(p_elisp) \
#		etc/emacs/site-start.d

#	install -m755 debian/$(p_elisp).install \
#		$(d_elisp)/usr/lib/emacsen-common/packages/install/$(p_elisp)
#	install -m755 debian/$(p_elisp).remove \
#		$(d_elisp)/usr/lib/emacsen-common/packages/remove/$(p_elisp)
#	install -m644 Misc/python-mode.el \
#		$(d_elisp)/usr/share/emacs/site-lisp/$(p_elisp)/
#	install -m644 debian/50python-mode.el $(d_elisp)/etc/emacs/site-start.d/

	: # IDLE
	dh_installdirs -p$(p_idle) \
		usr/lib/idle-python$(VER) \
		usr/bin \
		usr/share/man/man1 \
		etc/idle-python$(VER)
	cp -rp Tools/idle/* $(d_idle)/usr/lib/idle-python$(VER)
	rm $(d_idle)/usr/lib/idle-python$(VER)/{NEWS,README,TODO,extend}.txt
	rm $(d_idle)/usr/lib/idle-python$(VER)/{ChangeLog,*.bat,*.pyw}
	ln -sf ../lib/idle-python$(VER)/idle.py \
		$(d_idle)/usr/bin/idle-python$(VER)
	for i in config-unix.txt config-win.txt config.txt; do \
	  mv $(d_idle)/usr/lib/idle-python$(VER)/$$i \
	    $(d_idle)/etc/idle-python$(VER)/; \
	  ln -sf /etc/idle-python$(VER)/$$i \
	    $(d_idle)/usr/lib/idle-python$(VER)/$$i; \
	done
	cp -p debian/idle-$(PVER).1 $(d_idle)/usr/share/man/man1/

	: # Move the demos and tools into $(p_exam)'s doc directory
##todo	dh_installexamples
	dh_installdirs -p$(p_exam) \
		usr/share/doc/python$(VER)/examples

	cp -rp Demo Tools $(d_exam)/usr/share/doc/python$(VER)/examples/
	rm -r $(d_exam)/usr/share/doc/python$(VER)/examples/Demo/sgi
	: # IDLE is in its own package:
	rm -rf $(d_exam)/usr/share/doc/python$(VER)/examples/Tools/idle
	: # XXX: We don't need rgb.txt, we'll use our own:
	rm -r $(d_exam)/usr/share/doc/python$(VER)/examples/Tools/pynche/X

	: # XXX: Some files in upstream Demo and Tools have strange
	: # exec permissions, make lintian glad:
	chmod 644 $(d_tk)/usr/lib/python$(VER)/lib-tk/Tix.py

	cd $(d_exam)/usr/share/doc/python$(VER)/examples && chmod 644 \
	  Demo/{classes/{class.doc,*.py*},comparisons/patterns} \
	  Demo/{rpc/test,threads/*.py*,md5test/*} \
	  Demo/pdist/{client.py,cmdfw.py,cmptree.py,cvslib.py,cvslock.py,FSProxy.py,mac.py,rcsclient.py,rcslib.py,security.py,server.py,sumtree.py} \
	  Demo/scripts/{morse.py,newslist.doc,wh.py} \
	  Demo/sockets/{broadcast.py,ftp.py,mcast.py,radio.py} \
	  Demo/tix/{bitmaps/{tix.gif,*x[pb]m*},samples/PopMenu.py} \
	  Demo/tkinter/guido/{AttrDialog.py,hanoi.py,hello.py,imagedraw.py,imageview.py,listtree.py,ManPage.py,ShellWindow.py,wish.py} \
	  Tools/scripts/pydocgui.pyw \
	  Tools/{scripts/mailerdaemon.py,modulator/genmodule.py}

	: # Replace all '#!' calls to python with $(PY_INTERPRETER)
	: # and make them executable
	for i in `find debian -mindepth 3 -type f`; do \
	  sed '1s,#!.*python[^ ]*\(.*\),#! $(PY_INTERPRETER)\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

	: # Move the docs into $(p_base)'s /usr/share/doc/$(PVER) directory,
	: # all other packages only have a copyright file.
	dh_installdocs -p$(p_base) \
		README Misc/NEWS Misc/ACKS Misc/HISTORY \
		debian/sample.postinst debian/sample.prerm \
		debian/README.maintainers \
		debian/test_results
	dh_installdocs --all -N$(p_base) debian/README.Debian

	: # IDLE has its own changelogs, docs...
	dh_installchangelogs -p$(p_idle) Tools/idle/ChangeLog
	dh_installdocs -p$(p_idle) Tools/idle/{NEWS,README,TODO,extend}.txt
	: # those packages have own README.Debian's
	install -m 644 -p debian/README.$(p_base) \
		$(d_base)/usr/share/doc/$(PVER)/README.Debian
	install -m 644 -p debian/README.$(p_idle) \
		$(d_idle)/usr/share/doc/$(p_idle)/README.Debian
	cp -p debian/README.Tk $(d_tk)/usr/share/doc/$(p_tk)/

	(cd $(d) && tar cf - .) | (cd $(d_base) && tar xpf -)
	rm -rf $(d_base)/usr/lib/$(PVER)/email/test
	rm -f $(d_base)/usr/lib/$(PVER)/email/_compat21.py
	sh debian/dh_rmemptydirs -p$(p_base)
	rm -f $(d_base)/usr/bin/python

	: # Mark site.py as config file
	dh_installdirs -p$(p_base) etc/$(PVER) usr/share/pixmaps
	mv $(d_base)/usr/lib/$(PVER)/site.py $(d_base)/etc/$(PVER)/
	dh_link -p$(p_base) /etc/$(PVER)/site.py /usr/lib/$(PVER)/site.py

	: # generate binfmt file
	mkdir -p $(d_base)/usr/share/binfmts
	$(builddir)/python debian/mkbinfmt.py \
		> $(d_base)/usr/share/binfmts/$(PVER)

	: # Install menu icon
	cp -p debian/python16.xpm $(d_base)/usr/share/pixmaps/$(PVER)-16.xpm
	cp -p debian/python32.xpm $(d_base)/usr/share/pixmaps/$(PVER)-32.xpm

	-find debian -name '.cvsignore' -o -name CVS | xargs rm -rf

	touch install-stamp

# Build architecture-independent files here.
binary-indep: build install stamp-doc
	dh_testdir -i
	dh_testroot -i

ifeq ($(DEFAULT_VERSION),yes)
	: # provide the python and python.1 defaults
	mkdir -p debian/python/usr/bin
	ln -sf python$(VER) debian/python/usr/bin/python
	ln -sf pydoc$(VER) debian/python/usr/bin/pydoc
	ln -sf pygettext$(VER) debian/python/usr/bin/pygettext

	mkdir -p debian/python/usr/share/man/man1
	ln -sf python$(VER).1.gz \
		debian/python/usr/share/man/man1/python.1.gz
	ln -sf pydoc$(VER).1.gz \
		debian/python/usr/share/man/man1/pydoc.1.gz
	ln -sf pygettext$(VER).1.gz \
		debian/python/usr/share/man/man1/pygettext.1.gz

	mkdir -p debian/python/usr/share/doc/python
	cp -p debian/python-policy.* debian/FAQ.html \
		debian/python/usr/share/doc/python/
	ln -sf ../python$(VER)-doc/html debian/python/usr/share/doc/python/html

	mkdir -p debian/python/usr/share/apps/konsole
	cp -p debian/python.desktop debian/python/usr/share/apps/konsole/

	: # provide the idle and idle.1 defaults
	mkdir -p debian/idle/usr/bin
	ln -sf idle-python$(VER) debian/idle/usr/bin/idle

	mkdir -p debian/idle/usr/share/man/man1
	ln -sf idle-python$(VER).1.gz \
		debian/idle/usr/share/man/man1/idle.1.gz

	mkdir -p debian/python-tk/usr/share/doc/python-tk/
	cp -p debian/README.Tk debian/python-tk/usr/share/doc/python-tk/

	: # put the .cls files needed to build docs into $(p_dev)
	mkdir -p debian/python-dev/usr/share/doc/python-dev/texinputs
	cp -p Doc/texinputs/*.cls \
		debian/python-dev/usr/share/doc/python-dev/texinputs/
endif

	: # $(p_doc) package
	dh_installdirs -p$(p_doc) \
		usr/share/doc/$(p_base)/html \
		usr/share/doc/$(p_doc) \
		usr/share/info
	cat Doc/html*.tar \
		| (cd $(d_doc)/usr/share/doc/$(p_base)/html; tar xf -)
	-find $(d_doc)/usr/share/doc/$(p_base)/html -type f ! -perm 644 \
		| xargs chmod 644

	cp -p Doc/info/*info* \
		$(d_doc)/usr/share/info/
	dh_link -p$(p_doc) \
		/usr/share/doc/$(p_base)/html /usr/share/doc/$(p_doc)/html

#	dh_installdebconf -i
#	dh_installdocs -i
	dh_installexamples -i
	dh_installmenu -i
#	dh_installmime -i
	dh_installcron -i
	dh_installinfo -p$(p_doc) --noscripts \
		Doc/info/*info*
	dh_installchangelogs -i
	dh_link -i
	dh_compress -i -X.py -X.cls -X.css -X.txt
	dh_fixperms -i

	: # make python scripts starting with '#!' executable
	for i in \
	  `find debian -mindepth 2 -type f ! -perm 755 ! -name 'sample.*'`; \
	do \
	  if head -1 $$i | grep -q '^#!'; then \
	    chmod 755 $$i; \
	    echo "make executable: $$i"; \
	  fi; \
	done
	-find $(d_doc) -name '*.txt' -perm 755 -exec chmod 644 {} \;

	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir -a
	dh_testroot -a
#	dh_installdebconf -a
#	dh_installdocs -a
	dh_installexamples -a
	dh_installmenu -a
#	dh_installmime -a
	dh_installcron -a
	dh_installinfo -a
	dh_installchangelogs -a
	dh_strip -a
	dh_link -a
	dh_compress -a -X.py
	dh_fixperms -a

	: # make python scripts starting with '#!' executable
	for i in \
	  `find debian -mindepth 2 -type f ! -perm 755 ! -name 'sample.*'`; \
	do \
	  if head -1 $$i | grep -q '^#!'; then \
	    chmod 755 $$i; \
	    echo "make executable: $$i"; \
	  fi; \
	done

#	dh_makeshlibs -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

# rules to patch the unpacked files in the source directory
# ---------------------------------------------------------------------------
# various rules to unpack addons and (un)apply patches.
# 	- patch / apply-patches
#	- unpatch / reverse-patches

patchdir	= debian/patches

# which patches should be applied?
debian_patches = \
	cvs-updates \
	patchlevel \
	tix-update \
	deb-build \
	build-blt \
	setup \
	hurd \
	deb-locations \
	dlmodule \
	compile \
	py2texi \
	tkinter-update \
	doc-faq \
	webbrowser \
	pydoc \
	socket-ipconst \
	xmllib \
	sysmodule \
	profile-doc \
	dbm \
	pcre-security_CAN-2005-2491 \

#	blt+tix \
#	dbm \

ifeq ($(shell dpkg-architecture -qDEB_HOST_ARCH),hurd-i386)
    debian_patches += cthreads
endif

patch: patch-stamp
apply-patches: patch-stamp

patch-stamp: $(foreach p,$(debian_patches),patch-stamp-$(p))
	echo "\nPatches applied in this version:" > pxxx
	for i in $(debian_patches); do \
	  echo "\n$$i:" >> pxxx; \
	  sed -n 's/^# *DP: */  /p' $(patchdir)/$$i.dpatch >> pxxx; \
	done
	mv -f pxxx $@

reverse-patches: unpatch
unpatch:
	for stamp in none `ls -1t patch-stamp-* 2>/dev/null`; do \
	  case "$$stamp" in none|patched-stamp|patched-\*) continue; esac; \
	  patch=`echo $$stamp | sed -e 's,patch-stamp-,,'`; \
	  echo "trying to revert patch $$patch ..."; \
	  if [ -x $(patchdir)/$$patch.dpatch ]; then true; else \
	    chmod +x $(patchdir)/$$patch.dpatch; fi; \
	  if $(patchdir)/$$patch.dpatch -unpatch; then \
	    echo "reverted $$patch patch."; \
	    rm -f $$stamp; \
	  else \
	    echo "error in reverting $$patch patch."; \
	    exit 1; \
	  fi; \
	done
	rm -f patch-stamp

patch-stamp-%: $(patchdir)/%.dpatch
	if [ -x $< ]; then true; else chmod +x $<; fi
	if [ -f $@ ]; then \
	  echo "$* patches already applied."; exit 1; \
	fi
	$< -patch
	echo "$* patches applied." > $@

binary: binary-indep binary-arch

.PHONY: control-file configure build clean binary-indep binary-arch binary install

# Local Variables:
# mode: makefile
# end: