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