Make the debian/rules a bit more modern
[packages/xinetd.git] / debian / rules
1 #!/usr/bin/make -f
2
3 CFLAGS=-Wall -Wextra -g $(if $(findstring noopt,$(DEB_BUILD_OPTIONS)),-O0,-O2)
4 tmp = $(CURDIR)/debian/xinetd
5
6 srcpkg = $(shell dpkg-parsechangelog | sed -ne 's/Source: *//p')
7 srcver = $(shell dpkg-parsechangelog | sed -ne 's/Version: *\(.*\)-[0-9]*$$/\1/p')
8 pkgdir = '$(CURDIR)'/debian/xinetd
9 #{{{ generic rules
10
11 ../$(srcpkg)_$(srcver).orig.tar.gz:
12         @if git rev-parse --git-dir >/dev/null 2>&1; then                 \
13             echo -n 'Regenerating $(@F)';                                 \
14             git show pristine-tar:$(@F).delta | pristine-tar gentar - $@; \
15             echo .;                                                       \
16         fi
17
18 check-tarball: ../$(srcpkg)_$(srcver).orig.tar.gz
19
20 .PHONY: check-tarball
21
22 #}}}
23 #{{{ maintainer stuff
24
25 refresh-patches: check-tarball
26         @dh_testdir
27         @echo 'refreshing debian/patches:'
28         @rm -rf '$(CURDIR)'/debian/patches
29         @mkdir -p '$(CURDIR)'/debian/patches
30         @cd '$(CURDIR)'/debian/patches && git format-patch upstream..upstream+patches
31         @echo .
32
33 #}}}
34
35 patch: patch-stamp check-tarball
36 patch-stamp:
37         dh_testdir
38         set -e; test -e patch-stamp || \
39             for i in `ls -1 debian/patches/*.patch || :`; do patch -p1 <$$i > /dev/null; done
40         touch $@
41
42 unpatch:
43         dh_testdir
44         set -e; ! test -e patch-stamp || \
45             for i in `ls -1r debian/patches/*.patch || :`; do patch -p1 -R <$$i > /dev/null; done
46         rm -f patch-stamp
47
48 configure: configure-stamp
49 configure-stamp:
50         dh_testdir
51         chmod -R a=rX,u=rwX .
52         CFLAGS="-O2" ./configure --prefix=/usr             \
53                --mandir=\$${prefix}/share/man              \
54                --infodir=\$${prefix}/share/info            \
55                --host=$(DEB_HOST_GNU_TYPE)                 \
56                --build=$(DEB_BUILD_GNU_TYPE)               \
57                \
58                --with-loadavg          \
59                --with-libwrap
60         touch $@
61
62 build: configure-stamp build-stamp
63 build-stamp:
64         dh_testdir
65         $(MAKE)
66         touch $@
67
68 clean: unpatch
69         dh_testdir
70         dh_testroot
71         ! test -e Makefile || $(MAKE) distclean
72         rm -f build-stamp configure-stamp
73         dh_clean
74
75 install: build
76         dh_testdir
77         dh_testroot
78         dh_clean -k
79         dh_installdirs
80         $(MAKE) install prefix=$(pkgdir)
81         mv $(pkgdir)/etc/xinetd.d/xinetd.conf $(pkgdir)/etc/
82
83 binary-indep: build install
84
85 binary-arch: build install
86         dh_testdir
87         dh_testroot
88         dh_installchangelogs CHANGELOG
89         dh_installdocs README debian/README.update-inetd debian/xinetd.org-FAQ.html
90         dh_installexamples xinetd/sample.conf
91         dh_installinit -r
92         dh_installdebconf
93         dh_install
94         dh_strip
95         dh_compress
96         dh_fixperms
97         dh_installdeb
98         dh_shlibdeps
99         dh_gencontrol
100         dh_md5sums
101         dh_builddeb
102
103 binary: binary-indep binary-arch
104
105 .PHONY: build clean binary-indep binary-arch binary install configure