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