]> git.donarmstrong.com Git - debhelper.git/blob - debian/rules
r359: * I started work on debhelper v2 over a year ago, with a long list of
[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 export DH_VERBOSE=1
24
25 build: test
26 # Nothing to do.        
27
28 clean:
29         ./dh_testdir
30         ./dh_testroot
31         ./dh_clean
32
33 test:
34         ./dh_clean
35         DH_VERSION=10 perl -MTest::Harness -e 'runtests grep { ! /CVS/ } @ARGV' t/*
36         ./dh_clean
37
38 # Build architecture-dependent files here.
39 binary-arch: build
40 # Nothing to do.
41
42 # Build architecture-independent files here.
43 binary-indep: build
44         ./dh_testdir
45         ./dh_testroot
46         ./dh_clean -k
47         ./dh_installdirs usr/bin usr/share/debhelper \
48                 usr/lib/perl5/Debian/Debhelper
49
50         echo -e "package Debian::Debhelper::Dh_Version;\n\$$version='$(VERSION)';" > \
51                 debian/debhelper/usr/lib/perl5/Debian/Debhelper/Dh_Version.pm
52         find . -perm +111 -maxdepth 1 -type f -not -name "*.pl" \
53                 -exec install -p {} debian/debhelper/usr/bin \;
54         cp -a Debian/Debhelper/*.pm \
55                 debian/debhelper/usr/lib/perl5/Debian/Debhelper/
56         cp -a autoscripts debian/debhelper/usr/share/debhelper
57         rm -rf debian/debhelper/usr/share/debhelper/autoscripts/CVS
58
59         ./dh_installdocs `find doc -type f | grep -v CVS`
60         ./dh_installexamples `find examples -type f | grep -v CVS`
61         ./dh_installmenu
62         ./dh_installmanpages
63         ./dh_installinfo
64         # Fix up all man pages, filling in the modification time for them.
65         # Note this runs before the command below so debhelper.1 gets the right
66         # date on it.
67         perl -mPOSIX -e ' \
68                 foreach $$f (@ARGV) { \
69                 @data=stat($$f); \
70                 $$date=POSIX::strftime("%d %B %Y",localtime($$data[9])); \
71                 open (IN,$$f); \
72                 @lines=<IN>; \
73                 close IN; \
74                 $$lines[0]=~s/1 ""/1 "$$date"/; \
75                 open (OUT,">$$f"); \
76                 print OUT @lines; \
77                 close OUT; \
78         }' debian/debhelper/usr/share/man/man1/*.1
79         # Fix up the debhelper.1 man page, substituting in a list of all
80         # debhelper commands. Eek!
81         perl -ne ' \
82                 s/\\- /(1)\n/; \
83                 $$collect.=".TP\n.BR $$_" if $$. eq 3 && /^dh_/; \
84                 close(ARGV) if eof; \
85                 END { \
86                         open(I,"debian/debhelper/usr/share/man/man1/debhelper.1"); \
87                         @lines=<I>; \
88                         close I; \
89                         open(O,">debian/debhelper/usr/share/man/man1/debhelper.1"); \
90                         foreach (@lines) { \
91                                 s/#LIST#/$$collect/; \
92                                 print O; \
93                         } \
94                         close O; \
95                 }' *.1
96         ./dh_installchangelogs
97         ./dh_link
98         ./dh_compress
99         ./dh_fixperms
100         ./dh_suidregister
101         ./dh_installdeb
102         ./dh_gencontrol
103         ./dh_md5sums
104         ./dh_builddeb
105
106 # Update the debhelper web page. Not intended for use by anyone except the
107 # author.
108 installhook:
109         cp debian/changelog /home/pub/programs/debhelper/CHANGES
110         echo $(VERSION) > /home/pub/programs/debhelper/LATEST-VERSION-IS
111
112 binary: binary-indep binary-arch
113 .PHONY: build clean binary-indep binary-arch binary dist
114