Git init
[external/ifupdown.git] / _darcs / current / debian / rules
1 #!/usr/bin/make -f
2
3 ######################################################################
4 # BUILD NOTES
5 #
6 # ifupdown's written in litprog using noweb. noweb is written in icon.
7 # icon isn't as portable as one might hope (it needs to have bits recoded
8 # for each arch and OS it's ported to. ugh).
9 #
10 # So. The "upstream" source is made to not include any of the generated
11 # files. That's neat and tidy. If you want to modify anything, you edit
12 # the .nw file.
13 #
14 # Once you've done all the Debian changes, you run debian/rules binary,
15 # and get all the .c files and such updated. Once you're done, you
16 # run debian/rules clean, which leaves the generated .c files around
17 # for porters. You then generate a .diff.gz, and all should be well.
18 #
19 # Useful targets of the toplevel makefile:
20 # clobber:
21 #   * gets rid of all the generated files except Makefile,
22 #     make{c,nw}dep.sh, which are needed to bootstrap
23 #
24 # distclean:
25 #   * removes ALL generated files.  Use with care.
26 #
27 # docs: 
28 #   * builds the documentation. Note that this is not done per
29 #     default (only executables are built). If this is added to
30 #     the default build process (which will not be done in the near
31 #     future since dia requires an X display even if using the -e option) 
32 #     the 'tetex-base' and 'dia' packages would need to be added to the
33 #     Build-Dep
34 #
35 ######################################################################
36
37 # Uncomment this to turn on verbose mode.
38 #export DH_VERBOSE=1
39
40 # This is the debhelper compatability version to use.
41 export DH_COMPAT=1
42
43 # For working out whether we're cross-building
44 DEB_BUILD_GNU_TYPE      := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
45 DEB_HOST_GNU_TYPE       := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
46
47 # user/group of to-be-installed files
48 ROOT_USER  := 0
49 ROOT_GROUP := 0
50
51 ifeq (,$(wildcard /usr/bin/po2debconf))
52 PO2DEBCONF := no
53 MINDEBCONFVER := 0.5
54 else
55 PO2DEBCONF := yes
56 MINDEBCONFVER := 1.2.0
57 endif
58
59 configure:
60         dh_testdir
61
62 build: build-stamp
63 build-stamp: # configure
64         dh_testdir
65
66         if [ -x /usr/bin/noweb ]; then \
67           $(MAKE) clobber; \
68         else \
69           chmod a+rx defn2c.pl defn2man.pl makecdep.sh makenwdep.sh; \
70         fi
71         $(MAKE)
72         touch build-stamp
73
74 test: build
75         dh_testdir
76
77 ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
78         chmod a+rx debian/testbuild
79         @echo running debian/testbuild
80         @if ! debian/testbuild; then \
81              echo '=================================================='; \
82              echo 'AUTOMATIC TESTS FAILED -- Something built wrong or'; \
83              echo 'there is a bug in the code!!! Either way something'; \
84              echo 'is completely screwed up!!! File a bug!'; \
85              echo ''; \
86              echo 'Aborting build.'; \
87              echo '=================================================='; \
88              exit 1; \
89         fi
90 endif
91
92 clean:
93         dh_testdir
94         dh_testroot
95
96         # Add here commands to clean up after the build process
97         rm -rf tests/
98         rm -f build-stamp install-stamp
99         -$(MAKE) clean
100
101         dh_clean
102 ifeq ($(PO2DEBCONF),yes)
103         # Hack for woody compatibility. This makes sure that the
104         # debian/templates file shipped in the source package doesn't
105         # specify encodings, which woody's debconf can't handle. If building
106         # on a system with po-debconf installed (conveniently debhelper (>=
107         # 4.1.16) depends on it), the binary-arch target will generate a
108         # better version for sarge.
109         echo 1 > debian/po/output
110         po2debconf debian/templates.master > debian/templates
111         rm -f debian/po/output
112 endif
113
114 install-stamp: install
115 install: build test
116         dh_testdir
117         dh_testroot
118         dh_clean -k
119         dh_installdirs etc/network/if-pre-up.d etc/network/if-up.d etc/network/if-down.d etc/network/if-post-down.d
120
121         # Add here commands to install the package into debian/tmp.
122         $(MAKE) install BASEDIR=`pwd`/debian/tmp
123
124         install -o $(ROOT_USER) -g $(ROOT_GROUP) -m 755 debian/upgrade-from-0.5.x.pl \
125                 debian/tmp/usr/share/ifupdown/
126         touch install-stamp
127
128 # Build architecture-independent files here.
129 binary-indep: build-stamp install-stamp
130 # We have nothing to do by default.
131
132 # Build architecture-dependent files here.
133 binary-arch: build install
134 #       dh_testversion
135         dh_testdir
136         dh_testroot
137         dh_installdebconf       
138         dh_installdocs
139         dh_installexamples contrib/*
140         mv debian/tmp/usr/share/doc/ifupdown/examples debian/tmp/usr/share/doc/ifupdown/contrib
141         dh_installexamples examples/*
142         dh_installmenu
143 #       dh_installemacsen
144 #       dh_installpam
145         dh_installinit --name=ifupdown --no-start -- start 39 S .  start 36 0 6 .
146         dh_installinit --name=ifupdown-clean --no-start -- start 18 S .
147         dh_installcron
148 #       dh_installmanpages
149 #          ^-- can't do our symlink trick
150         install -o $(ROOT_USER) -g $(ROOT_GROUP) -m 644 interfaces.5 debian/tmp/usr/share/man/man5/interfaces.5
151         install -o $(ROOT_USER) -g $(ROOT_GROUP) -m 644 ifup.8 debian/tmp/usr/share/man/man8/ifup.8
152         ln -s ifup.8 debian/tmp/usr/share/man/man8/ifdown.8
153         dh_installinfo
154 #       dh_undocumented
155         dh_installchangelogs ChangeLog
156         dh_link
157         dh_strip
158         dh_compress
159         dh_fixperms
160         # You may want to make some executables suid here.
161 #       dh_suidregister
162 #       dh_makeshlibs
163         dh_installdeb
164 #       dh_perl
165         dh_shlibdeps
166 ifeq ($(PO2DEBCONF),yes)
167         po2debconf -e utf8 debian/templates.master > debian/templates
168 endif
169         dh_gencontrol -- -V'debconf-depends=debconf (>= $(MINDEBCONFVER)) | debconf-2.0'
170         dh_md5sums
171         dh_builddeb
172
173 binary: binary-indep binary-arch
174 .PHONY: build clean binary-indep binary-arch binary install configure test