chiark / gitweb /
Use invoke-rc.d instead of accessing /etc/init.d directly. Lintian again.
[disorder] / debian / rules
1 #! /usr/bin/make -f
2 #
3 # Copyright (C) 2004-2008 Richard Kettlewell
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 #
18
19 cgiexecdir=/usr/lib/cgi-bin
20 httpdir=/var/www
21 browser=x-www-browser
22
23 # Options to configure.  This can be overridden by the caller if necessary.
24 CONFIGURE=--prefix=/usr --sysconfdir=/etc --localstatedir=/var/lib --mandir=/usr/share/man --with-browser=${browser} cgiexecdir="${cgiexecdir}" httpdir="${httpdir}"
25
26 # Set DEB_BUILD_OPTIONS=noopt to produce a non-optimized build.
27 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
28 CFLAGS=-O0 -g
29 else
30 CFLAGS=-O2 -g
31 endif
32 export CFLAGS
33
34 # Install commands.  You wouldn't normally override these.
35 INSTALL=install
36 INSTALL_DATA=$(INSTALL) -p -o root -g root -m 644
37 INSTALL_PROGRAM=$(INSTALL) -p -o root -g root -m 755
38 INSTALL_SCRIPT=$(INSTALL) -p -o root -g root -m 755
39 MKDIR=mkdir -p -m 755
40
41 # Set DEB_BUILD_OPTIONS=nostrip to install debuggable executables.
42 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
43 INSTALL_PROGRAM += -s
44 endif
45
46 export INSTALL_DATA
47 export INSTALL_SCRIPT
48 export INSTALL_PROGRAM
49
50 # We override sendmail to the value defined in policy, in case configure picks
51 # up some other sendmail.
52 SENDMAIL=/usr/sbin/sendmail
53
54 LIBTOOL=./libtool
55 FAKEROOT=fakeroot
56
57 # ./prepare is the script that generates configure etc.  It only needs to be
58 # run if building from a checkout rather than a tarball.
59 build:
60         @set -e;if test ! -f configure; then \
61           echo ./prepare;\
62           ./prepare;\
63         fi
64         @set -e;if test ! -f config.status; then \
65           echo ./configure ${CONFIGURE} ${CONFIGURE_EXTRA};\
66           ./configure ${CONFIGURE} ${CONFIGURE_EXTRA};\
67         else\
68           echo ./config.status;\
69           ./config.status;\
70         fi
71         $(MAKE) SENDMAIL=${SENDMAIL}
72
73 pkg-disorder: build
74         rm -rf debian/disorder
75         $(MKDIR) debian/disorder
76         $(MKDIR) debian/disorder/DEBIAN
77         $(MKDIR) debian/disorder/usr/share/doc/disorder
78         $(MKDIR) debian/disorder/etc/bash_completion.d
79         $(INSTALL_DATA) debian/copyright \
80                 debian/disorder/usr/share/doc/disorder/copyright
81         $(INSTALL_DATA) debian/changelog \
82                 debian/disorder/usr/share/doc/disorder/changelog.Debian
83         gzip -9 debian/disorder/usr/share/doc/disorder/changelog.Debian
84         @for f in conffiles templates; do\
85           if test -e debian/$$f.disorder; then\
86             echo $(INSTALL_DATA) debian/$$f.disorder debian/disorder/DEBIAN/$$f; \
87             $(INSTALL_DATA) debian/$$f.disorder debian/disorder/DEBIAN/$$f; \
88           fi;\
89         done
90         @for f in preinst postinst prerm postrm config; do\
91           if test -e debian/$$f.disorder; then\
92             echo $(INSTALL_SCRIPT) debian/$$f.disorder debian/disorder/DEBIAN/$$f; \
93             $(INSTALL_SCRIPT) debian/$$f.disorder debian/disorder/DEBIAN/$$f; \
94           fi;\
95         done
96         $(MAKE) DESTDIR=`pwd`/debian/disorder installdirs install -C doc
97         $(MAKE) DESTDIR=`pwd`/debian/disorder installdirs install -C clients
98         $(MAKE) DESTDIR=`pwd`/debian/disorder installdirs install -C lib
99         $(INSTALL_DATA) scripts/completion.bash \
100                 debian/disorder/etc/bash_completion.d/disorder
101         rm -rf debian/disorder/usr/share/man/man8
102         rm -rf debian/disorder/usr/share/disorder/*.html
103         rm -rf debian/disorder/usr/share/disorder/*.tmpl
104         rmdir debian/disorder/usr/share/disorder
105         rm -f debian/disorder/usr/bin/disorder-playrtp
106         rm -f debian/disorder/usr/bin/disobedience
107         rm -f debian/disorder/usr/share/man/man1/disorder-playrtp.1
108         rm -f debian/disorder/usr/share/man/man1/disobedience.1
109         rm -f debian/disorder/usr/share/man/man5/disorder_templates.5
110         rm -f debian/disorder/usr/share/man/man5/disorder_actions.5
111         rm -f debian/disorder/usr/share/man/man5/disorder_options.5
112         $(MKDIR) debian/disorder/etc/disorder
113         dpkg-shlibdeps -Tdebian/substvars.disorder \
114                 debian/disorder/usr/bin/*
115         $(INSTALL_DATA) CHANGES.html README debian/README.Debian \
116                 BUGS README.* \
117                 debian/disorder/usr/share/doc/disorder/.
118         gzip -9f debian/disorder/usr/share/doc/disorder/README \
119                  debian/disorder/usr/share/doc/disorder/README.* \
120                  debian/disorder/usr/share/doc/disorder/BUGS \
121                  debian/disorder/usr/share/man/man*/*
122         dpkg-gencontrol -isp -pdisorder -Pdebian/disorder -Tdebian/substvars.disorder
123         chown -R root:root debian/disorder
124         chmod -R g-ws debian/disorder
125         dpkg --build debian/disorder ..
126
127 pkg-disorder-server: build
128         rm -rf debian/disorder-server
129         $(MKDIR) debian/disorder-server
130         $(MKDIR) debian/disorder-server/DEBIAN
131         $(MKDIR) debian/disorder-server/usr/share/doc/disorder-server
132         $(INSTALL_DATA) debian/copyright \
133                 debian/disorder-server/usr/share/doc/disorder-server/copyright
134         $(INSTALL_DATA) debian/changelog \
135                 debian/disorder-server/usr/share/doc/disorder-server/changelog.Debian
136         gzip -9 debian/disorder-server/usr/share/doc/disorder-server/changelog.Debian
137         @for f in preinst postinst prerm postrm config; do\
138           if test -e debian/$$f.disorder-server; then\
139             echo $(INSTALL_SCRIPT) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \
140             $(INSTALL_SCRIPT) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \
141           fi;\
142         done
143         @for f in conffiles templates; do\
144           if test -e debian/$$f.disorder-server; then\
145             echo $(INSTALL_DATA) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \
146             $(INSTALL_DATA) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \
147           fi;\
148         done
149         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C images
150         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C server
151         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C templates
152         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C driver
153         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C plugins
154         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C sounds
155         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C doc
156         rm -rf debian/disorder-server/usr/share/man/man1
157         rm -rf debian/disorder-server/usr/share/man/man3
158         rm -f debian/disorder-server/usr/share/man/man5/disorder_config.5
159         rm -f debian/disorder-server/usr/share/man/man5/disorder_protocol.5
160         find debian/disorder-server -name '*.la' -print0 | xargs -r0 rm -f
161         find debian/disorder-server -name '*.so.0' -print0 | xargs -r0 rm -f
162         @for f in debian/disorder-server/usr/lib/disorder/*.so.0.0.0; do \
163           echo mv $$f $${f/.0.0.0};\
164           mv $$f $${f/.0.0.0};\
165         done
166         @for f in debian/disorder-server/usr/lib/ao/plugins*/*.so.0.0.0; do \
167           echo mv $$f $${f/.0.0.0};\
168           mv $$f $${f/.0.0.0};\
169         done
170         find debian/disorder-server -name '*.so' -print0 | xargs -r0 strip --strip-unneeded
171         find debian/disorder-server -name '*.so' -print0 | xargs -r0 chmod -x
172         $(MKDIR) debian/disorder-server/etc/disorder
173         $(MKDIR) debian/disorder-server/etc/init.d
174         $(MKDIR) debian/disorder-server${cgiexecdir}
175         $(MKDIR) debian/disorder-server/var/lib/disorder
176         $(INSTALL_SCRIPT) examples/disorder.init \
177                 debian/disorder-server/etc/init.d/disorder
178         $(INSTALL_DATA) debian/etc.disorder.config \
179                 debian/disorder-server/etc/disorder/config
180         $(INSTALL_DATA) templates/options \
181                 debian/disorder-server/etc/disorder/options
182         $(INSTALL_DATA) debian/etc.disorder.options.user \
183                 debian/disorder-server/etc/disorder/options.user
184         $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) cgi/disorder \
185                 $(shell pwd)/debian/disorder-server${cgiexecdir}/disorder
186         gzip -9f debian/disorder-server/usr/share/man/man*/*
187         dpkg-shlibdeps -Tdebian/substvars.disorder-server \
188                 debian/disorder-server${cgiexecdir}/disorder \
189                 debian/disorder-server/usr/sbin/* \
190                 debian/disorder-server/usr/lib/disorder/*.so
191         rm -rf debian/disorder-server/usr/share/doc/disorder-server
192         ln -s disorder debian/disorder-server/usr/share/doc/disorder-server
193         dpkg-gencontrol -isp -pdisorder-server -Pdebian/disorder-server -Tdebian/substvars.disorder-server
194         chown -R root:root debian/disorder-server
195         chmod -R g-ws debian/disorder-server
196         dpkg --build debian/disorder-server ..
197
198 pkg-disorder-playrtp: build
199         rm -rf debian/disorder-playrtp
200         $(MKDIR) debian/disorder-playrtp
201         $(MKDIR) debian/disorder-playrtp/DEBIAN
202         $(MKDIR) debian/disorder-playrtp/usr/share/doc/disorder-playrtp
203         $(INSTALL_DATA) debian/copyright \
204                 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/copyright
205         $(INSTALL_DATA) debian/changelog \
206                 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/changelog.Debian
207         gzip -9 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/changelog.Debian
208         @for f in preinst postinst prerm postrm conffiles templates config; do\
209           if test -e debian/$$f.disorder-playrtp; then\
210             echo $(INSTALL_SCRIPT) debian/$$f.disorder-playrtp debian/disorder-playrtp/DEBIAN/$$f; \
211             $(INSTALL_SCRIPT) debian/$$f.disorder-playrtp debian/disorder-playrtp/DEBIAN/$$f; \
212           fi;\
213         done
214         $(MKDIR) debian/disorder-playrtp/usr/bin
215         $(MKDIR) debian/disorder-playrtp/usr/share/man/man1
216         $(INSTALL_PROGRAM) clients/disorder-playrtp \
217                 debian/disorder-playrtp/usr/bin/disorder-playrtp
218         $(INSTALL_DATA) doc/disorder-playrtp.1 \
219                 debian/disorder-playrtp/usr/share/man/man1/disorder-playrtp.1
220         dpkg-shlibdeps -Tdebian/substvars.disorder-playrtp \
221                 debian/disorder-playrtp/usr/bin/*
222         $(INSTALL_DATA) debian/README.RTP \
223                 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/README
224         $(INSTALL_DATA) CHANGES.html debian/disorder-playrtp/usr/share/doc/disorder-playrtp/CHANGES.html
225         gzip -9f debian/disorder-playrtp/usr/share/man/man*/*
226         dpkg-gencontrol -isp -pdisorder-playrtp -Pdebian/disorder-playrtp -Tdebian/substvars.disorder-playrtp
227         chown -R root:root debian/disorder-playrtp
228         chmod -R g-ws debian/disorder-playrtp
229         dpkg --build debian/disorder-playrtp ..
230
231 pkg-disobedience: build
232         rm -rf debian/disobedience
233         $(MKDIR) debian/disobedience
234         $(MKDIR) debian/disobedience/DEBIAN
235         $(MKDIR) debian/disobedience/usr/share/doc/disobedience
236         $(INSTALL_DATA) debian/copyright \
237                 debian/disobedience/usr/share/doc/disobedience/copyright
238         $(INSTALL_DATA) debian/changelog \
239                 debian/disobedience/usr/share/doc/disobedience/changelog.Debian
240         gzip -9 debian/disobedience/usr/share/doc/disobedience/changelog.Debian
241         @for f in preinst postinst prerm postrm conffiles templates config; do\
242           if test -e debian/$$f.disobedience; then\
243             echo $(INSTALL_SCRIPT) debian/$$f.disobedience debian/disobedience/DEBIAN/$$f; \
244             $(INSTALL_SCRIPT) debian/$$f.disobedience debian/disobedience/DEBIAN/$$f; \
245           fi;\
246         done
247         $(MKDIR) debian/disobedience/usr/bin
248         $(MKDIR) debian/disobedience/usr/share/man/man1
249         $(MKDIR) debian/disobedience/usr/share/pixmaps
250         $(MKDIR) debian/disobedience/usr/share/menu
251         $(MAKE) -C disobedience install DESTDIR=`pwd`/debian/disobedience
252         $(INSTALL_DATA) doc/disobedience.1 \
253                 debian/disobedience/usr/share/man/man1/disobedience.1
254         $(INSTALL_DATA) images/disobedience16x16.xpm \
255                         images/disobedience32x32.xpm \
256                         debian/disobedience/usr/share/pixmaps
257         $(INSTALL_DATA) debian/usr.share.menu.disobedience \
258                 debian/disobedience/usr/share/menu/disobedience
259         gzip -9f debian/disobedience/usr/share/man/man*/*
260         dpkg-shlibdeps -Tdebian/substvars.disobedience \
261                 debian/disobedience/usr/bin/*
262         rm -rf debian/disobedience/usr/share/doc/disobedience
263         ln -s disorder debian/disobedience/usr/share/doc/disobedience
264         dpkg-gencontrol -isp -pdisobedience -Pdebian/disobedience -Tdebian/substvars.disobedience
265         chown -R root:root debian/disobedience
266         chmod -R g-ws debian/disobedience
267         dpkg --build debian/disobedience ..
268
269 DEBVERSION:=$(shell dpkg-parsechangelog|awk '/Version:/ {print $$2}')
270 DSC=disorder_$(DEBVERSION).dsc
271 DEBSRC=disorder_$(DEBVERSION).tar.gz
272 VERSION=$(shell $(MAKE) echo-version)
273
274 source:
275         $(MAKE) dist
276         rm -rf disorder-$(VERSION)
277         tar xfz disorder-$(VERSION).tar.gz
278         dpkg-source -b disorder-$(VERSION)
279         rm -rf disorder-$(VERSION) disorder-$(VERSION).tar.gz
280
281 source-check: source
282         rm -rf disorder-$(DEBVERSION)
283         dpkg-source -x $(DSC)
284         cd disorder-$(DEBVERSION) && dpkg-buildpackage -r$(FAKEROOT)
285
286 binary: binary-arch binary-indep
287 binary-arch: pkg-disorder pkg-disorder-server pkg-disorder-playrtp \
288              pkg-disobedience
289 binary-indep: 
290
291 clean:
292         -$(MAKE) distclean
293         rm -f config.cache
294         rm -f debian/files
295         rm -f debian/substvars.*
296         rm -rf debian/disorder
297         rm -rf debian/disorder-server
298         rm -rf debian/disorder-playrtp
299         rm -rf debian/disobedience
300
301 .PHONY: clean build pkg-disorder pkg-disorder-server pkg-disorder-playrtp \
302         pkg-disobedience source source-check binary binary-arch binary-indep