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