chiark / gitweb /
.debs now have md5sums
[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         cd debian/disorder && \
129                 find -name DEBIAN -prune -o -type f -print \
130                         | sed 's/^\.\///' \
131                         | xargs md5sum > DEBIAN/md5sums
132         dpkg-gencontrol -isp -pdisorder -Pdebian/disorder -Tdebian/substvars.disorder
133         chown -R root:root debian/disorder
134         chmod -R g-ws debian/disorder
135         dpkg --build debian/disorder ..
136
137 pkg-disorder-server: build
138         rm -rf debian/disorder-server
139         $(MKDIR) debian/disorder-server
140         $(MKDIR) debian/disorder-server/DEBIAN
141         $(MKDIR) debian/disorder-server/usr/share/doc/disorder-server
142         $(INSTALL_DATA) debian/copyright \
143                 debian/disorder-server/usr/share/doc/disorder-server/copyright
144         $(INSTALL_DATA) debian/changelog \
145                 debian/disorder-server/usr/share/doc/disorder-server/changelog.Debian
146         gzip -9 debian/disorder-server/usr/share/doc/disorder-server/changelog.Debian
147         @for f in preinst postinst prerm postrm config; do\
148           if test -e debian/$$f.disorder-server; then\
149             echo $(INSTALL_SCRIPT) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \
150             $(INSTALL_SCRIPT) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \
151           fi;\
152         done
153         @for f in conffiles templates; do\
154           if test -e debian/$$f.disorder-server; then\
155             echo $(INSTALL_DATA) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \
156             $(INSTALL_DATA) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \
157           fi;\
158         done
159         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C images
160         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C server
161         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C templates
162         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C driver
163         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C plugins
164         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C sounds
165         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C doc
166         rm -rf debian/disorder-server/usr/share/man/man1
167         rm -rf debian/disorder-server/usr/share/man/man3
168         rm -f debian/disorder-server/usr/share/man/man5/disorder_config.5
169         rm -f debian/disorder-server/usr/share/man/man5/disorder_preferences.5
170         rm -f debian/disorder-server/usr/share/man/man5/disorder_protocol.5
171         find debian/disorder-server -name '*.la' -print0 | xargs -r0 rm -f
172         find debian/disorder-server -name '*.so.0' -print0 | xargs -r0 rm -f
173         @for f in debian/disorder-server/usr/lib/disorder/*.so.0.0.0; do \
174           echo mv $$f $${f/.0.0.0};\
175           mv $$f $${f/.0.0.0};\
176         done
177         @for f in debian/disorder-server/usr/lib/ao/plugins*/*.so.0.0.0; do \
178           echo mv $$f $${f/.0.0.0};\
179           mv $$f $${f/.0.0.0};\
180         done
181         find debian/disorder-server -name '*.so' -print0 | xargs -r0 strip --strip-unneeded
182         find debian/disorder-server -name '*.so' -print0 | xargs -r0 chmod -x
183         $(MKDIR) debian/disorder-server/etc/disorder
184         $(MKDIR) debian/disorder-server/etc/init.d
185         $(MKDIR) debian/disorder-server${cgiexecdir}
186         $(MKDIR) debian/disorder-server/var/lib/disorder
187         $(INSTALL_SCRIPT) examples/disorder.init \
188                 debian/disorder-server/etc/init.d/disorder
189         $(INSTALL_DATA) debian/etc.disorder.config \
190                 debian/disorder-server/etc/disorder/config
191         $(INSTALL_DATA) templates/options \
192                 debian/disorder-server/etc/disorder/options
193         $(INSTALL_DATA) debian/etc.disorder.options.user \
194                 debian/disorder-server/etc/disorder/options.user
195         $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) cgi/disorder \
196                 $(shell pwd)/debian/disorder-server${cgiexecdir}/disorder
197         gzip -9f debian/disorder-server/usr/share/man/man*/*
198         dpkg-shlibdeps -Tdebian/substvars.disorder-server \
199                 debian/disorder-server${cgiexecdir}/disorder \
200                 debian/disorder-server/usr/sbin/* \
201                 debian/disorder-server/usr/lib/disorder/*.so
202         rm -rf debian/disorder-server/usr/share/doc/disorder-server
203         ln -s disorder debian/disorder-server/usr/share/doc/disorder-server
204         cd debian/disorder-server && \
205                 find -name DEBIAN -prune -o -type f -print \
206                         | sed 's/^\.\///' \
207                         | xargs md5sum > DEBIAN/md5sums
208         dpkg-gencontrol -isp -pdisorder-server -Pdebian/disorder-server -Tdebian/substvars.disorder-server
209         chown -R root:root debian/disorder-server
210         chmod -R g-ws debian/disorder-server
211         dpkg --build debian/disorder-server ..
212
213 pkg-disorder-playrtp: build
214         rm -rf debian/disorder-playrtp
215         $(MKDIR) debian/disorder-playrtp
216         $(MKDIR) debian/disorder-playrtp/DEBIAN
217         $(MKDIR) debian/disorder-playrtp/usr/share/doc/disorder-playrtp
218         $(INSTALL_DATA) debian/copyright \
219                 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/copyright
220         $(INSTALL_DATA) debian/changelog \
221                 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/changelog.Debian
222         gzip -9 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/changelog.Debian
223         @for f in preinst postinst prerm postrm conffiles templates config; do\
224           if test -e debian/$$f.disorder-playrtp; then\
225             echo $(INSTALL_SCRIPT) debian/$$f.disorder-playrtp debian/disorder-playrtp/DEBIAN/$$f; \
226             $(INSTALL_SCRIPT) debian/$$f.disorder-playrtp debian/disorder-playrtp/DEBIAN/$$f; \
227           fi;\
228         done
229         $(MKDIR) debian/disorder-playrtp/usr/bin
230         $(MKDIR) debian/disorder-playrtp/usr/share/man/man1
231         $(INSTALL_PROGRAM) clients/disorder-playrtp \
232                 debian/disorder-playrtp/usr/bin/disorder-playrtp
233         $(INSTALL_DATA) doc/disorder-playrtp.1 \
234                 debian/disorder-playrtp/usr/share/man/man1/disorder-playrtp.1
235         dpkg-shlibdeps -Tdebian/substvars.disorder-playrtp \
236                 debian/disorder-playrtp/usr/bin/*
237         $(INSTALL_DATA) debian/README.RTP \
238                 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/README
239         $(INSTALL_DATA) CHANGES.html debian/disorder-playrtp/usr/share/doc/disorder-playrtp/CHANGES.html
240         gzip -9f debian/disorder-playrtp/usr/share/man/man*/*
241         cd debian/disorder-playrtp && \
242                 find -name DEBIAN -prune -o -type f -print \
243                         | sed 's/^\.\///' \
244                         | xargs md5sum > DEBIAN/md5sums
245         dpkg-gencontrol -isp -pdisorder-playrtp -Pdebian/disorder-playrtp -Tdebian/substvars.disorder-playrtp
246         chown -R root:root debian/disorder-playrtp
247         chmod -R g-ws debian/disorder-playrtp
248         dpkg --build debian/disorder-playrtp ..
249
250 pkg-disobedience: build
251         rm -rf debian/disobedience
252         $(MKDIR) debian/disobedience
253         $(MKDIR) debian/disobedience/DEBIAN
254         $(MKDIR) debian/disobedience/usr/share/doc/disobedience
255         $(INSTALL_DATA) debian/copyright \
256                 debian/disobedience/usr/share/doc/disobedience/copyright
257         $(INSTALL_DATA) debian/changelog \
258                 debian/disobedience/usr/share/doc/disobedience/changelog.Debian
259         gzip -9 debian/disobedience/usr/share/doc/disobedience/changelog.Debian
260         @for f in preinst postinst prerm postrm conffiles templates config; do\
261           if test -e debian/$$f.disobedience; then\
262             echo $(INSTALL_SCRIPT) debian/$$f.disobedience debian/disobedience/DEBIAN/$$f; \
263             $(INSTALL_SCRIPT) debian/$$f.disobedience debian/disobedience/DEBIAN/$$f; \
264           fi;\
265         done
266         $(MKDIR) debian/disobedience/usr/bin
267         $(MKDIR) debian/disobedience/usr/share/man/man1
268         $(MKDIR) debian/disobedience/usr/share/pixmaps
269         $(MKDIR) debian/disobedience/usr/share/menu
270         $(MAKE) -C disobedience install DESTDIR=`pwd`/debian/disobedience
271         $(INSTALL_DATA) doc/disobedience.1 \
272                 debian/disobedience/usr/share/man/man1/disobedience.1
273         $(INSTALL_DATA) images/disobedience16x16.xpm \
274                         images/disobedience32x32.xpm \
275                         debian/disobedience/usr/share/pixmaps
276         $(INSTALL_DATA) debian/usr.share.menu.disobedience \
277                 debian/disobedience/usr/share/menu/disobedience
278         gzip -9f debian/disobedience/usr/share/man/man*/*
279         dpkg-shlibdeps -Tdebian/substvars.disobedience \
280                 debian/disobedience/usr/bin/*
281         rm -rf debian/disobedience/usr/share/doc/disobedience
282         ln -s disorder debian/disobedience/usr/share/doc/disobedience
283         cd debian/disobedience && \
284                 find -name DEBIAN -prune -o -type f -print \
285                         | sed 's/^\.\///' \
286                         | xargs md5sum > DEBIAN/md5sums
287         dpkg-gencontrol -isp -pdisobedience -Pdebian/disobedience -Tdebian/substvars.disobedience
288         chown -R root:root debian/disobedience
289         chmod -R g-ws debian/disobedience
290         dpkg --build debian/disobedience ..
291
292 DEBVERSION:=$(shell dpkg-parsechangelog|awk '/Version:/ {print $$2}')
293 DSC=disorder_$(DEBVERSION).dsc
294 DEBSRC=disorder_$(DEBVERSION).tar.gz
295 VERSION=$(shell $(MAKE) echo-version)
296
297 source:
298         $(MAKE) dist
299         rm -rf disorder-$(VERSION)
300         tar xfz disorder-$(VERSION).tar.gz
301         dpkg-source -b disorder-$(VERSION)
302         rm -rf disorder-$(VERSION) disorder-$(VERSION).tar.gz
303
304 source-check: source
305         rm -rf disorder-$(DEBVERSION)
306         dpkg-source -x $(DSC)
307         cd disorder-$(DEBVERSION) && dpkg-buildpackage -r$(FAKEROOT)
308
309 binary: binary-arch binary-indep
310 binary-arch: pkg-disorder pkg-disorder-server pkg-disorder-playrtp \
311              pkg-disobedience
312 binary-indep: 
313
314 clean:
315         test -f Makefile && $(MAKE) distclean
316         rm -f config.cache
317         rm -f debian/files
318         rm -f debian/substvars.*
319         rm -rf debian/disorder
320         rm -rf debian/disorder-server
321         rm -rf debian/disorder-playrtp
322         rm -rf debian/disobedience
323
324 .PHONY: clean build pkg-disorder pkg-disorder-server pkg-disorder-playrtp \
325         pkg-disobedience source source-check binary binary-arch binary-indep