]> git.donarmstrong.com Git - debhelper.git/blob - debian/rules
r362: * Minor man page updates as Overfiend struggles with debhelperizing X
[debhelper.git] / debian / rules
1 #!/usr/bin/make -f
2 # Note that I have to refer to debhelper programs with ./, to make sure
3 # I run the most current ones.
4 #
5 # This is _not_ a good example of a debhelper rules file, but I didn't need
6 # to tell you that; just see the 25 lines of inlined perl below.. 
7 # See examples/ for some good examples.
8
9 # Ensure that builds are self-hosting, which means I have to use the .pm
10 # files in this package, not any that may be on the system.
11 export PERL5LIB=.
12
13 # If any automatic script generation is done in building this package, 
14 # be sure to use the new templates from this package.
15 export DH_AUTOSCRIPTDIR=autoscripts
16
17 # Living dangerously :-)
18 export DH_COMPAT=3
19
20 # Figure out the current debhelper version.
21 VERSION=$(shell expr "`dpkg-parsechangelog 2>/dev/null |grep Version:`" : '.*Version: \(.*\)')
22
23 # Debug
24 #export DH_VERBOSE=1
25
26 build: test
27 # Nothing to do.        
28
29 clean:
30         ./dh_testdir
31         ./dh_testroot
32         ./dh_clean
33
34 test:
35         ./dh_clean
36         DH_VERSION=10 perl -MTest::Harness -e 'runtests grep { ! /CVS/ } @ARGV' t/*
37         ./dh_clean
38
39 # Build architecture-dependent files here.
40 binary-arch: build
41 # Nothing to do.
42
43 # Build architecture-independent files here.
44 binary-indep: build
45         ./dh_testdir
46         ./dh_testroot
47         ./dh_clean -k
48         ./dh_installdirs usr/bin usr/share/debhelper \
49                 usr/lib/perl5/Debian/Debhelper
50
51         echo -e "package Debian::Debhelper::Dh_Version;\n\$$version='$(VERSION)';" > \
52                 debian/debhelper/usr/lib/perl5/Debian/Debhelper/Dh_Version.pm
53         find . -perm +111 -maxdepth 1 -type f -not -name "*.pl" \
54                 -exec install -p {} debian/debhelper/usr/bin \;
55         cp -a Debian/Debhelper/*.pm \
56                 debian/debhelper/usr/lib/perl5/Debian/Debhelper/
57         cp -a autoscripts debian/debhelper/usr/share/debhelper
58         rm -rf debian/debhelper/usr/share/debhelper/autoscripts/CVS
59
60         ./dh_installdocs `find doc -type f | grep -v CVS`
61         ./dh_installexamples `find examples -type f | grep -v CVS`
62         ./dh_installmenu
63         ./dh_installmanpages
64         ./dh_installinfo
65         # Fix up all man pages, filling in the modification time for them.
66         # Note this runs before the command below so debhelper.1 gets the right
67         # date on it.
68         perl -mPOSIX -e ' \
69                 foreach $$f (@ARGV) { \
70                 @data=stat($$f); \
71                 $$date=POSIX::strftime("%d %B %Y",localtime($$data[9])); \
72                 open (IN,$$f); \
73                 @lines=<IN>; \
74                 close IN; \
75                 $$lines[0]=~s/1 ""/1 "$$date"/; \
76                 open (OUT,">$$f"); \
77                 print OUT @lines; \
78                 close OUT; \
79         }' debian/debhelper/usr/share/man/man1/*.1
80         # Fix up the debhelper.1 man page, substituting in a list of all
81         # debhelper commands. Eek!
82         perl -ne ' \
83                 s/\\- /(1)\n/; \
84                 $$collect.=".TP\n.BR $$_" if $$. eq 3 && /^dh_/; \
85                 close(ARGV) if eof; \
86                 END { \
87                         open(I,"debian/debhelper/usr/share/man/man1/debhelper.1"); \
88                         @lines=<I>; \
89                         close I; \
90                         open(O,">debian/debhelper/usr/share/man/man1/debhelper.1"); \
91                         foreach (@lines) { \
92                                 s/#LIST#/$$collect/; \
93                                 print O; \
94                         } \
95                         close O; \
96                 }' *.1
97         ./dh_installchangelogs
98         ./dh_link
99         ./dh_compress
100         ./dh_fixperms
101         ./dh_suidregister
102         ./dh_installdeb
103         ./dh_gencontrol
104         ./dh_md5sums
105         ./dh_builddeb
106
107 # Update the debhelper web page. Not intended for use by anyone except the
108 # author.
109 installhook:
110         cp debian/changelog /home/pub/programs/debhelper/CHANGES
111         echo $(VERSION) > /home/pub/programs/debhelper/LATEST-VERSION-IS
112
113 binary: binary-indep binary-arch
114 .PHONY: build clean binary-indep binary-arch binary dist
115