chiark / gitweb /
Merge from uniform audio branch. disorder-playrtp now uses the uaudio
[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 # Set DEB_BUILD_OPTIONS=parallel=N to do make -jN
47 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
48 NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
49 PARALLEL = -j$(NUMJOBS)
50 endif
51
52 export INSTALL_DATA
53 export INSTALL_SCRIPT
54 export INSTALL_PROGRAM
55
56 # We override sendmail to the value defined in policy, in case configure picks
57 # up some other sendmail.
58 SENDMAIL=/usr/sbin/sendmail
59
60 LIBTOOL=./libtool
61 FAKEROOT=fakeroot
62
63 # ./prepare is the script that generates configure etc.  It only needs to be
64 # run if building from a checkout rather than a tarball.
65 build:
66         @set -e;if test ! -f configure; then \
67           echo ./prepare;\
68           ./prepare;\
69         fi
70         @set -e;if test ! -f config.status; then \
71           echo ./configure ${CONFIGURE} ${CONFIGURE_EXTRA};\
72           ./configure ${CONFIGURE} ${CONFIGURE_EXTRA};\
73         else\
74           echo ./config.status;\
75           ./config.status;\
76         fi
77         $(MAKE) SENDMAIL=${SENDMAIL} ${PARALLEL}
78
79 pkg-disorder: build
80         rm -rf debian/disorder
81         $(MKDIR) debian/disorder
82         $(MKDIR) debian/disorder/DEBIAN
83         $(MKDIR) debian/disorder/usr/share/doc/disorder
84         $(MKDIR) debian/disorder/etc/bash_completion.d
85         $(INSTALL_DATA) debian/copyright \
86                 debian/disorder/usr/share/doc/disorder/copyright
87         $(INSTALL_DATA) debian/changelog \
88                 debian/disorder/usr/share/doc/disorder/changelog.Debian
89         gzip -9 debian/disorder/usr/share/doc/disorder/changelog.Debian
90         @for f in conffiles templates; do\
91           if test -e debian/$$f.disorder; then\
92             echo $(INSTALL_DATA) debian/$$f.disorder debian/disorder/DEBIAN/$$f; \
93             $(INSTALL_DATA) debian/$$f.disorder debian/disorder/DEBIAN/$$f; \
94           fi;\
95         done
96         @for f in preinst postinst prerm postrm config; do\
97           if test -e debian/$$f.disorder; then\
98             echo $(INSTALL_SCRIPT) debian/$$f.disorder debian/disorder/DEBIAN/$$f; \
99             $(INSTALL_SCRIPT) debian/$$f.disorder debian/disorder/DEBIAN/$$f; \
100           fi;\
101         done
102         $(MAKE) DESTDIR=`pwd`/debian/disorder installdirs install -C doc
103         $(MAKE) DESTDIR=`pwd`/debian/disorder installdirs install -C clients
104         $(MAKE) DESTDIR=`pwd`/debian/disorder installdirs install -C lib
105         $(INSTALL_DATA) scripts/completion.bash \
106                 debian/disorder/etc/bash_completion.d/disorder
107         rm -rf debian/disorder/usr/share/man/man8
108         rm -rf debian/disorder/usr/share/disorder/*.html
109         rm -rf debian/disorder/usr/share/disorder/*.tmpl
110         rmdir debian/disorder/usr/share/disorder
111         rm -f debian/disorder/usr/bin/disorder-playrtp
112         rm -f debian/disorder/usr/bin/disobedience
113         rm -f debian/disorder/usr/share/man/man1/disorder-playrtp.1
114         rm -f debian/disorder/usr/share/man/man1/disobedience.1
115         rm -f debian/disorder/usr/share/man/man5/disorder_templates.5
116         rm -f debian/disorder/usr/share/man/man5/disorder_actions.5
117         rm -f debian/disorder/usr/share/man/man5/disorder_options.5
118         $(MKDIR) debian/disorder/etc/disorder
119         dpkg-shlibdeps -Tdebian/substvars.disorder \
120                 debian/disorder/usr/bin/*
121         $(INSTALL_DATA) CHANGES.html README debian/README.Debian \
122                 BUGS README.* \
123                 debian/disorder/usr/share/doc/disorder/.
124         gzip -9f debian/disorder/usr/share/doc/disorder/README \
125                  debian/disorder/usr/share/doc/disorder/README.* \
126                  debian/disorder/usr/share/doc/disorder/BUGS \
127                  debian/disorder/usr/share/man/man*/*
128         dpkg-gencontrol -isp -pdisorder -Pdebian/disorder -Tdebian/substvars.disorder
129         chown -R root:root debian/disorder
130         chmod -R g-ws debian/disorder
131         dpkg --build debian/disorder ..
132
133 pkg-disorder-server: build
134         rm -rf debian/disorder-server
135         $(MKDIR) debian/disorder-server
136         $(MKDIR) debian/disorder-server/DEBIAN
137         $(MKDIR) debian/disorder-server/usr/share/doc/disorder-server
138         $(INSTALL_DATA) debian/copyright \
139                 debian/disorder-server/usr/share/doc/disorder-server/copyright
140         $(INSTALL_DATA) debian/changelog \
141                 debian/disorder-server/usr/share/doc/disorder-server/changelog.Debian
142         gzip -9 debian/disorder-server/usr/share/doc/disorder-server/changelog.Debian
143         @for f in preinst postinst prerm postrm config; do\
144           if test -e debian/$$f.disorder-server; then\
145             echo $(INSTALL_SCRIPT) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \
146             $(INSTALL_SCRIPT) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \
147           fi;\
148         done
149         @for f in conffiles templates; do\
150           if test -e debian/$$f.disorder-server; then\
151             echo $(INSTALL_DATA) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \
152             $(INSTALL_DATA) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \
153           fi;\
154         done
155         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C images
156         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C server
157         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C templates
158         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C driver
159         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C plugins
160         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C sounds
161         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C doc
162         rm -rf debian/disorder-server/usr/share/man/man1
163         rm -rf debian/disorder-server/usr/share/man/man3
164         rm -f debian/disorder-server/usr/share/man/man5/disorder_config.5
165         rm -f debian/disorder-server/usr/share/man/man5/disorder_preferences.5
166         rm -f debian/disorder-server/usr/share/man/man5/disorder_protocol.5
167         find debian/disorder-server -name '*.la' -print0 | xargs -r0 rm -f
168         find debian/disorder-server -name '*.so.0' -print0 | xargs -r0 rm -f
169         @for f in debian/disorder-server/usr/lib/disorder/*.so.0.0.0; do \
170           echo mv $$f $${f/.0.0.0};\
171           mv $$f $${f/.0.0.0};\
172         done
173         @for f in debian/disorder-server/usr/lib/ao/plugins*/*.so.0.0.0; do \
174           echo mv $$f $${f/.0.0.0};\
175           mv $$f $${f/.0.0.0};\
176         done
177         find debian/disorder-server -name '*.so' -print0 | xargs -r0 strip --strip-unneeded
178         find debian/disorder-server -name '*.so' -print0 | xargs -r0 chmod -x
179         $(MKDIR) debian/disorder-server/etc/disorder
180         $(MKDIR) debian/disorder-server/etc/init.d
181         $(MKDIR) debian/disorder-server${cgiexecdir}
182         $(MKDIR) debian/disorder-server/var/lib/disorder
183         $(INSTALL_SCRIPT) examples/disorder.init \
184                 debian/disorder-server/etc/init.d/disorder
185         $(INSTALL_DATA) debian/etc.disorder.config \
186                 debian/disorder-server/etc/disorder/config
187         $(INSTALL_DATA) templates/options \
188                 debian/disorder-server/etc/disorder/options
189         $(INSTALL_DATA) debian/etc.disorder.options.user \
190                 debian/disorder-server/etc/disorder/options.user
191         $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) cgi/disorder \
192                 $(shell pwd)/debian/disorder-server${cgiexecdir}/disorder
193         gzip -9f debian/disorder-server/usr/share/man/man*/*
194         dpkg-shlibdeps -Tdebian/substvars.disorder-server \
195                 debian/disorder-server${cgiexecdir}/disorder \
196                 debian/disorder-server/usr/sbin/* \
197                 debian/disorder-server/usr/lib/disorder/*.so
198         rm -rf debian/disorder-server/usr/share/doc/disorder-server
199         ln -s disorder debian/disorder-server/usr/share/doc/disorder-server
200         dpkg-gencontrol -isp -pdisorder-server -Pdebian/disorder-server -Tdebian/substvars.disorder-server
201         chown -R root:root debian/disorder-server
202         chmod -R g-ws debian/disorder-server
203         dpkg --build debian/disorder-server ..
204
205 pkg-disorder-playrtp: build
206         rm -rf debian/disorder-playrtp
207         $(MKDIR) debian/disorder-playrtp
208         $(MKDIR) debian/disorder-playrtp/DEBIAN
209         $(MKDIR) debian/disorder-playrtp/usr/share/doc/disorder-playrtp
210         $(INSTALL_DATA) debian/copyright \
211                 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/copyright
212         $(INSTALL_DATA) debian/changelog \
213                 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/changelog.Debian
214         gzip -9 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/changelog.Debian
215         @for f in preinst postinst prerm postrm conffiles templates config; do\
216           if test -e debian/$$f.disorder-playrtp; then\
217             echo $(INSTALL_SCRIPT) debian/$$f.disorder-playrtp debian/disorder-playrtp/DEBIAN/$$f; \
218             $(INSTALL_SCRIPT) debian/$$f.disorder-playrtp debian/disorder-playrtp/DEBIAN/$$f; \
219           fi;\
220         done
221         $(MKDIR) debian/disorder-playrtp/usr/bin
222         $(MKDIR) debian/disorder-playrtp/usr/share/man/man1
223         $(INSTALL_PROGRAM) clients/disorder-playrtp \
224                 debian/disorder-playrtp/usr/bin/disorder-playrtp
225         $(INSTALL_DATA) doc/disorder-playrtp.1 \
226                 debian/disorder-playrtp/usr/share/man/man1/disorder-playrtp.1
227         dpkg-shlibdeps -Tdebian/substvars.disorder-playrtp \
228                 debian/disorder-playrtp/usr/bin/*
229         $(INSTALL_DATA) debian/README.RTP \
230                 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/README
231         $(INSTALL_DATA) CHANGES.html debian/disorder-playrtp/usr/share/doc/disorder-playrtp/CHANGES.html
232         gzip -9f debian/disorder-playrtp/usr/share/man/man*/*
233         dpkg-gencontrol -isp -pdisorder-playrtp -Pdebian/disorder-playrtp -Tdebian/substvars.disorder-playrtp
234         chown -R root:root debian/disorder-playrtp
235         chmod -R g-ws debian/disorder-playrtp
236         dpkg --build debian/disorder-playrtp ..
237
238 pkg-disobedience: build
239         rm -rf debian/disobedience
240         $(MKDIR) debian/disobedience
241         $(MKDIR) debian/disobedience/DEBIAN
242         $(MKDIR) debian/disobedience/usr/share/doc/disobedience
243         $(INSTALL_DATA) debian/copyright \
244                 debian/disobedience/usr/share/doc/disobedience/copyright
245         $(INSTALL_DATA) debian/changelog \
246                 debian/disobedience/usr/share/doc/disobedience/changelog.Debian
247         gzip -9 debian/disobedience/usr/share/doc/disobedience/changelog.Debian
248         @for f in preinst postinst prerm postrm conffiles templates config; do\
249           if test -e debian/$$f.disobedience; then\
250             echo $(INSTALL_SCRIPT) debian/$$f.disobedience debian/disobedience/DEBIAN/$$f; \
251             $(INSTALL_SCRIPT) debian/$$f.disobedience debian/disobedience/DEBIAN/$$f; \
252           fi;\
253         done
254         $(MKDIR) debian/disobedience/usr/bin
255         $(MKDIR) debian/disobedience/usr/share/man/man1
256         $(MKDIR) debian/disobedience/usr/share/pixmaps
257         $(MKDIR) debian/disobedience/usr/share/menu
258         $(MAKE) -C disobedience install DESTDIR=`pwd`/debian/disobedience
259         $(INSTALL_DATA) doc/disobedience.1 \
260                 debian/disobedience/usr/share/man/man1/disobedience.1
261         $(INSTALL_DATA) images/disobedience16x16.xpm \
262                         images/disobedience32x32.xpm \
263                         debian/disobedience/usr/share/pixmaps
264         $(INSTALL_DATA) debian/usr.share.menu.disobedience \
265                 debian/disobedience/usr/share/menu/disobedience
266         gzip -9f debian/disobedience/usr/share/man/man*/*
267         dpkg-shlibdeps -Tdebian/substvars.disobedience \
268                 debian/disobedience/usr/bin/*
269         rm -rf debian/disobedience/usr/share/doc/disobedience
270         ln -s disorder debian/disobedience/usr/share/doc/disobedience
271         dpkg-gencontrol -isp -pdisobedience -Pdebian/disobedience -Tdebian/substvars.disobedience
272         chown -R root:root debian/disobedience
273         chmod -R g-ws debian/disobedience
274         dpkg --build debian/disobedience ..
275
276 DEBVERSION:=$(shell dpkg-parsechangelog|awk '/Version:/ {print $$2}')
277 DSC=disorder_$(DEBVERSION).dsc
278 DEBSRC=disorder_$(DEBVERSION).tar.gz
279 VERSION=$(shell $(MAKE) echo-version)
280
281 source:
282         $(MAKE) dist
283         rm -rf disorder-$(VERSION)
284         tar xfz disorder-$(VERSION).tar.gz
285         dpkg-source -b disorder-$(VERSION)
286         rm -rf disorder-$(VERSION) disorder-$(VERSION).tar.gz
287
288 source-check: source
289         rm -rf disorder-$(DEBVERSION)
290         dpkg-source -x $(DSC)
291         cd disorder-$(DEBVERSION) && dpkg-buildpackage -r$(FAKEROOT)
292
293 binary: binary-arch binary-indep
294 binary-arch: pkg-disorder pkg-disorder-server pkg-disorder-playrtp \
295              pkg-disobedience
296 binary-indep: 
297
298 clean:
299         test -f Makefile && $(MAKE) distclean
300         rm -f config.cache
301         rm -f debian/files
302         rm -f debian/substvars.*
303         rm -rf debian/disorder
304         rm -rf debian/disorder-server
305         rm -rf debian/disorder-playrtp
306         rm -rf debian/disobedience
307
308 .PHONY: clean build pkg-disorder pkg-disorder-server pkg-disorder-playrtp \
309         pkg-disobedience source source-check binary binary-arch binary-indep