File: rules

package info (click to toggle)
tklib 0.4.1-20080501-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,508 kB
  • ctags: 1,527
  • sloc: tcl: 34,008; sh: 2,318; ansic: 792; makefile: 100; exp: 21; sed: 16
file content (144 lines) | stat: -rwxr-xr-x 3,490 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
#!/usr/bin/make -f
# debian/rules that uses debhelper.

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

export QUILT_PATCHES := debian/patches

version = 0.4.1
cvsdate = 20080501

destdir=debian/tklib
mandir=/usr/share/man
docdir=/usr/share/doc/tklib
exampledir=$(docdir)/examples

unpatch:
	dh_testdir
	quilt pop -a || test $$? = 2
	rm -rf patch-stamp .pc

patch: patch-stamp
patch-stamp:
	dh_testdir
	quilt push -a || test $$? = 2
	touch patch-stamp

clean: clean-patched unpatch
	dh_testdir
	dh_testroot
	dh_clean

clean-patched: patch-stamp
	dh_testdir
	dh_testroot
	#
	[ ! -f Makefile ] || $(MAKE) distclean
	rm -f build-stamp install-stamp

# Build mostly covers docs and such
build: build-stamp
build-stamp: patch-stamp
	dh_testdir
	./configure --prefix=/usr --mandir=$(mandir)
	$(MAKE) doc
	#
	touch build-stamp

install: install-stamp
install-stamp: build-stamp
	dh_testdir
	dh_testroot
	dh_installdirs
	#
	$(MAKE) DESTDIR=$(destdir) install 
	#
	find $(destdir)/usr/lib -name repair.tcl -delete
	#
	# now set the permissions properly, since the Makefile doesn't bother
	find $(destdir)/usr/lib -type f -print | xargs chmod 644
	#
	# move scripts to /usr/share
	mv $(destdir)/usr/lib/* $(destdir)/usr/share/tcltk
	rmdir $(destdir)/usr/lib
	#
	# rename the man pages into section 3, and clean up
	mv $(destdir)$(mandir)/mann $(destdir)$(mandir)/man3
	#
	# Several manpages has incorrect filenames (in lowercase), so take them
	# from the headers
	# Also, replace section n by 3tk
	cd $(destdir)$(mandir)/man3 && \
	  for f in *.n ; do \
	    name=`grep '^\.TH' <$$f | sed 's/^\.TH "\([^ ]\+\)".*/\1/'`; \
	    sed -e'/\.so man.macros/ d' \
	    	-e's/^\.TH \([^ ]\+\) n/.TH \1 3tk/' \
		-e's/clock(n)/clock(3tcl)/g' \
		-e's/(n)/(3tk)/g' \
		-e's/(3)/(3tk)/g' \
		-e's/spIf/sp 1\nIf/' \
		-e's/\.sp Fu/\.sp 1\nFu/' \
		-e's//\\[:u]/g' \
		-e's/"A dialog which allows a user to m/"M/' \
		$$f > $$name.3tk; \
	    rm $$f; \
	  done
	#
	# cleanup docs
	cd doc/html && \
	  for f in *.html ; do \
	    sed -i -e's/clock(n)/clock(3tcl)/g' \
	    	-e's/(n)/(3tk)/g' \
	    	-e's/(3)/(3tk)/g' $$f; \
	  done
	#
	# generate documentation index
	tclsh debian/genindex.tcl doc/html >$(destdir)$(docdir)/html/index.html
	#
	touch install-stamp

binary-indep: build install
	dh_testdir
	dh_testroot
	dh_install
	dh_installdocs
	dh_installexamples
	#
	# Fix incorrect permissions
	find $(destdir)$(exampledir) -type f -print | xargs chmod 644
	#
	dh_installchangelogs ChangeLog
	dh_compress -Xusr/share/doc/tklib/examples/ \
		    -Xusr/share/doc/tklib/html
	dh_fixperms
	dh_installdeb
	tcltk-depends
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-arch: build install

get-orig-source: get-orig-source-cvs

get-orig-source-cvs:
	CURDIR=`pwd` && \
	TMPDIR=`mktemp -d /tmp/tklib.XXXXXX` && \
	SCRDIR=`dirname $(MAKEFILE_LIST)` && \
	expect $$SCRDIR/checkout $$TMPDIR "$(cvsdate)T23:59:59" && \
	rm -rf $$TMPDIR/tklib/config/ && \
	find $$TMPDIR -name CVS -print | xargs rm -rf && \
	cd $$TMPDIR && \
	tar -zcf $$CURDIR/tklib_$(version)-$(cvsdate).orig.tar.gz . && \
	rm -rf $$TMPDIR

get-orig-source-release:
	wget -O tklib_$(version).orig.tar.gz \
		http://heanet.dl.sourceforge.net/sourceforge/tcllib/tklib-$(version).tar.gz 

source diff:
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

binary: binary-indep binary-arch
.PHONY: patch unpatch clean-patched build clean binary-indep binary-arch binary install get-orig-source-cvs get-orig-source-release