]> git.donarmstrong.com Git - debhelper.git/blob - debian/rules
r256: * Corrected debian/fixlinks to make the correct debian/* symlinks needed
[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: link-stamp
21         # Run regression tests.
22         $(MAKE) test
23
24 clean: link-stamp
25         ./dh_testdir
26         ./dh_testroot
27         ./dh_clean link-stamp
28
29 test: link-stamp
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: link-stamp build
36 # Nothing to do.
37
38 # Build architecture-independent files here.
39 binary-indep: link-stamp 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         rm -rf debian/debhelper/usr/share/debhelper/autoscripts/CVS
51
52         ./dh_installdocs `echo doc/* | sed s/CVS//`
53         ./dh_installexamples `echo examples/* | sed s/CVS//`
54         ./dh_installmenu
55         ./dh_installmanpages
56         ./dh_installinfo
57         # Fix up all man pages, filling in the modification time for them.
58         # Note this runs beofre the command below so debhelper.1 gets the right
59         # date on it.
60         perl -mPOSIX -e ' \
61                 foreach $$f (@ARGV) { \
62                 @data=stat($$f); \
63                 $$date=POSIX::strftime("%d %B %Y",localtime($$data[9])); \
64                 open (IN,$$f); \
65                 @lines=<IN>; \
66                 close IN; \
67                 $$lines[0]=~s/1 ""/1 "$$date"/; \
68                 open (OUT,">$$f"); \
69                 print OUT @lines; \
70                 close OUT; \
71         }' debian/debhelper/usr/man/man1/*.1
72         # Fix up the debhelper.1 man page, substituting in a list of all
73         # debhelper commands. eek!
74         perl -ne ' \
75                 s/\\- /(1)\n/; \
76                 $$collect.=".TP\n.BR $$_" if $$. eq 3 && /^dh_/; \
77                 close(ARGV) if eof; \
78                 END { \
79                         open(I,"debian/debhelper/usr/man/man1/debhelper.1"); \
80                         @lines=<I>; \
81                         close I; \
82                         open(O,">debian/debhelper/usr/man/man1/debhelper.1"); \
83                         foreach (@lines) { \
84                                 s/#LIST#/$$collect/; \
85                                 print O; \
86                         } \
87                         close O; \
88                 }' *.1
89         ./dh_installchangelogs
90 #       ./dh_movefiles
91         ./dh_link
92         ./dh_compress
93         ./dh_fixperms
94         ./dh_suidregister
95         ./dh_installdeb
96         ./dh_gencontrol
97         ./dh_md5sums
98         ./dh_builddeb
99
100 # Install in the proper location on my ftp server and web server. Not intended
101 # for use by anyone except the author.
102 OLD_VER=$(shell perl -e '<>;<>;while(<>){last if /^ --/};<>;$$_=<>;print m/\((.*?)\)/'<debian/changelog)
103 dist: commit link-stamp
104         dpkg-buildpackage -rfakeroot -tc
105         if [ `hostname` = 'kite' ] ; then \
106                 cp ../debhelper_$(VERSION).tar.gz ../../public; \
107                 rm /home/ftp/pub/code/debhelper/* || true; \
108                 cp debian/changelog /home/pub/programs/debhelper/CHANGES; \
109                 echo $(VERSION) > /home/pub/programs/debhelper/LATEST-VERSION-IS; \
110                 cd ..; rm -rf debhelper-$(OLD_VER); \
111                 [ -f ../public/debhelper_$(OLD_VER).tar.gz ] && \
112                 tar zxf ../public/debhelper_$(OLD_VER).tar.gz || \
113                 tar zxf ../outdated/debhelper_$(OLD_VER).tar.gz; \
114                 diff -r -u --new-file debhelper-$(OLD_VER) debhelper-$(VERSION) > \
115                         /home/ftp/pub/code/debhelper/diffs/debhelper-$(VERSION).diff; \
116                 gzip -9f /home/ftp/pub/code/debhelper/diffs/debhelper-$(VERSION).diff; \
117                 cd /tmp; rm -f debhelper-$(OLD-VER); \
118         fi
119
120 link-stamp:
121         sh -e debian/fixlinks
122         touch link-stamp
123
124 # This is for local use - it tags the current code with the debian version
125 # number, then commits the current code using the contents of the changelog
126 # as the cvs changelog, then increments the version number
127 commit:
128         cvs -Q commit -m "`dpkg-parsechangelog | grep '^  '`"
129         cvs -Q tag rel-$(shell dpkg-parsechangelog | grep ^Version: \
130                 |cut -d " " -f 2 |tr '.' '-')
131         
132 new:
133         # Update w/o editing.
134         EDITOR=true dch -i 2>/dev/null
135         # Dch has to change the bloody directory name. Feh.
136         mv . ../debhelper
137
138 binary: binary-indep binary-arch
139 .PHONY: build clean binary-indep binary-arch binary dist