]> git.donarmstrong.com Git - debhelper.git/blob - debian/rules
cb042bf70c35a554eefadfea876234a994083a9e
[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. That's also why there is a symlink to the 
4 # current Dh_lib.pm and the current Dh_getopt.pm in this debian/ directory.
5 #
6 # This is _not_ a good example of a debhelper rules file.
7
8 # If any automatic script generation is done in building this package, 
9 # be sure to use the new templates from this package.
10 export DH_AUTOSCRIPTDIR=autoscripts
11
12 # Living dangerously :-)
13 export DH_COMPAT=2
14
15 # Figure out the current debhelper version.
16 VERSION=$(shell expr "`dpkg-parsechangelog 2>/dev/null |grep Version:`" : '.*Version: \(.*\)')
17
18 export DH_VERBOSE=1
19
20 build:
21         # Run regression tests.
22         $(MAKE) test
23
24 clean:
25         ./dh_testdir
26         ./dh_testroot
27         ./dh_clean
28
29 test:
30         ./dh_clean
31         DH_VERSION=10 perl -MTest::Harness -e 'runtests grep { ! /CVS/ } @ARGV' t/*
32         ./dh_clean
33
34 # Build architecture-dependent files here.
35 binary-arch: build
36 # Nothing to do.
37
38 # Build architecture-independent files here.
39 binary-indep: build
40         ./dh_testdir
41         ./dh_testroot
42         ./dh_clean -k
43         ./dh_installdirs usr/bin usr/share/debhelper
44
45         echo -e "package Dh_Version;\n\$$version='$(VERSION)';" > debian/debhelper/usr/share/debhelper/Dh_Version.pm
46         find . -perm +111 -maxdepth 1 -type f -not -name "*.pl" \
47                 -exec install -p {} debian/debhelper/usr/bin \;
48         cp -a Dh_*.pm debian/debhelper/usr/share/debhelper
49         cp -a autoscripts debian/debhelper/usr/share/debhelper
50
51         ./dh_installdocs doc/*
52         ./dh_installexamples examples/*
53         ./dh_installmenu
54         ./dh_installmanpages
55         ./dh_installinfo
56         # Fix up all man pages, filling in the modification time for them.
57         # Note this runs beofre the command below so debhelper.1 gets the right
58         # date on it.
59         perl -mPOSIX -e ' \
60                 foreach $$f (@ARGV) { \
61                 @data=stat($$f); \
62                 $$date=POSIX::strftime("%d %B %Y",localtime($$data[9])); \
63                 open (IN,$$f); \
64                 @lines=<IN>; \
65                 close IN; \
66                 $$lines[0]=~s/1 ""/1 "$$date"/; \
67                 open (OUT,">$$f"); \
68                 print OUT @lines; \
69                 close OUT; \
70         }' debian/debhelper/usr/man/man1/*.1
71         # Fix up the debhelper.1 man page, substituting in a list of all
72         # debhelper commands. eek!
73         perl -ne ' \
74                 s/\\- /(1)\n/; \
75                 $$collect.=".TP\n.BR $$_" if $$. eq 3 && /^dh_/; \
76                 close(ARGV) if eof; \
77                 END { \
78                         open(I,"debian/debhelper/usr/man/man1/debhelper.1"); \
79                         @lines=<I>; \
80                         close I; \
81                         open(O,">debian/debhelper/usr/man/man1/debhelper.1"); \
82                         foreach (@lines) { \
83                                 s/#LIST#/$$collect/; \
84                                 print O; \
85                         } \
86                         close O; \
87                 }' *.1
88         ./dh_installchangelogs
89 #       ./dh_movefiles
90         ./dh_link
91         ./dh_compress
92         ./dh_fixperms
93         ./dh_suidregister
94         ./dh_installdeb
95         ./dh_gencontrol
96         ./dh_md5sums
97         ./dh_builddeb
98
99 # Install in the proper location on my ftp server and web server. Not intended
100 # for use by anyone except the author.
101 OLD_VER=$(shell perl -e '<>;<>;while(<>){last if /^ --/};<>;$$_=<>;print m/\((.*?)\)/'<debian/changelog)
102 dist:
103         dpkg-buildpackage -rfakeroot -tc
104         if [ `hostname` = 'kite' ] ; then \
105                 cp ../debhelper_$(VERSION).tar.gz ../../public; \
106                 rm /home/ftp/pub/code/debhelper/* || true; \
107                 cp debian/changelog /home/pub/programs/debhelper/CHANGES; \
108                 echo $(VERSION) > /home/pub/programs/debhelper/LATEST-VERSION-IS; \
109                 cd ..; rm -rf debhelper-$(OLD_VER); \
110                 [ -f ../public/debhelper_$(OLD_VER).tar.gz ] && \
111                 tar zxf ../public/debhelper_$(OLD_VER).tar.gz || \
112                 tar zxf ../outdated/debhelper_$(OLD_VER).tar.gz; \
113                 diff -r -u --new-file debhelper-$(OLD_VER) debhelper-$(VERSION) > \
114                         /home/ftp/pub/code/debhelper/diffs/debhelper-$(VERSION).diff; \
115                 gzip -9f /home/ftp/pub/code/debhelper/diffs/debhelper-$(VERSION).diff; \
116                 cd /tmp; rm -f debhelper-$(OLD-VER); \
117         fi
118
119 binary: binary-indep binary-arch
120 .PHONY: build clean binary-indep binary-arch binary dist