chiark / gitweb /
Merge latest Disobedience work
[disorder] / debian / rules
CommitLineData
48deaa73
RK
1#! /usr/bin/make -f
2#
8f9616f1 3# Copyright (C) 2004-2008 Richard Kettlewell
48deaa73 4#
e7eb3a27 5# This program is free software: you can redistribute it and/or modify
48deaa73 6# it under the terms of the GNU General Public License as published by
e7eb3a27 7# the Free Software Foundation, either version 3 of the License, or
48deaa73
RK
8# (at your option) any later version.
9#
e7eb3a27
RK
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#
48deaa73 15# You should have received a copy of the GNU General Public License
e7eb3a27 16# along with this program. If not, see <http://www.gnu.org/licenses/>.
48deaa73
RK
17#
18
f03d4184 19cgiexecdir=/usr/lib/cgi-bin
64ac73bb
RK
20httpdir=/var/www
21browser=x-www-browser
22
48deaa73 23# Options to configure. This can be overridden by the caller if necessary.
32918782 24CONFIGURE=--prefix=/usr --sysconfdir=/etc --localstatedir=/var/lib --mandir=/usr/share/man --with-browser=${browser} cgiexecdir="${cgiexecdir}" httpdir="${httpdir}"
48deaa73
RK
25
26# Set DEB_BUILD_OPTIONS=noopt to produce a non-optimized build.
27ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
28CFLAGS=-O0 -g
29else
30CFLAGS=-O2 -g
31endif
32export CFLAGS
33
34# Install commands. You wouldn't normally override these.
35INSTALL=install
36INSTALL_DATA=$(INSTALL) -p -o root -g root -m 644
37INSTALL_PROGRAM=$(INSTALL) -p -o root -g root -m 755
38INSTALL_SCRIPT=$(INSTALL) -p -o root -g root -m 755
39MKDIR=mkdir -p -m 755
40
41# Set DEB_BUILD_OPTIONS=nostrip to install debuggable executables.
42ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
43INSTALL_PROGRAM += -s
44endif
45
7323d699
RK
46# Set DEB_BUILD_OPTIONS=parallel=N to do make -jN
47ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
48NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
49PARALLEL = -j$(NUMJOBS)
50endif
51
48deaa73
RK
52export INSTALL_DATA
53export INSTALL_SCRIPT
54export INSTALL_PROGRAM
55
410801ac
RK
56# We override sendmail to the value defined in policy, in case configure picks
57# up some other sendmail.
58SENDMAIL=/usr/sbin/sendmail
59
48deaa73
RK
60LIBTOOL=./libtool
61FAKEROOT=fakeroot
62
e2daf70b
RK
63SHELL=bash
64
48deaa73
RK
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.
67build:
eb5f83f4 68 @set -e;if test ! -f configure; then \
d558cce2
RK
69 echo ./prepare;\
70 ./prepare;\
71 fi
eb5f83f4 72 @set -e;if test ! -f config.status; then \
48deaa73
RK
73 echo ./configure ${CONFIGURE} ${CONFIGURE_EXTRA};\
74 ./configure ${CONFIGURE} ${CONFIGURE_EXTRA};\
75 else\
76 echo ./config.status;\
77 ./config.status;\
78 fi
7323d699 79 $(MAKE) SENDMAIL=${SENDMAIL} ${PARALLEL}
48deaa73 80
48deaa73
RK
81pkg-disorder: build
82 rm -rf debian/disorder
83 $(MKDIR) debian/disorder
84 $(MKDIR) debian/disorder/DEBIAN
85 $(MKDIR) debian/disorder/usr/share/doc/disorder
1b23cbbe 86 $(MKDIR) debian/disorder/etc/bash_completion.d
48deaa73
RK
87 $(INSTALL_DATA) debian/copyright \
88 debian/disorder/usr/share/doc/disorder/copyright
89 $(INSTALL_DATA) debian/changelog \
c94f44c1
RK
90 debian/disorder/usr/share/doc/disorder/changelog
91 gzip -9 debian/disorder/usr/share/doc/disorder/changelog*
a987f4a7
RK
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\
48deaa73
RK
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
0a3004d0
RK
106 strip --remove-section=.comment debian/disorder/usr/bin/disorder
107 strip --remove-section=.comment debian/disorder/usr/bin/disorderfm
48deaa73 108 $(MAKE) DESTDIR=`pwd`/debian/disorder installdirs install -C lib
1b23cbbe
RK
109 $(INSTALL_DATA) scripts/completion.bash \
110 debian/disorder/etc/bash_completion.d/disorder
48deaa73
RK
111 rm -rf debian/disorder/usr/share/man/man8
112 rm -rf debian/disorder/usr/share/disorder/*.html
ae13d68e 113 rm -rf debian/disorder/usr/share/disorder/*.tmpl
1b23cbbe 114 rmdir debian/disorder/usr/share/disorder
48deaa73
RK
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
ae13d68e
RK
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
48deaa73
RK
122 $(MKDIR) debian/disorder/etc/disorder
123 dpkg-shlibdeps -Tdebian/substvars.disorder \
124 debian/disorder/usr/bin/*
b0a578cb 125 $(INSTALL_DATA) CHANGES.html README debian/README.Debian \
48deaa73
RK
126 BUGS README.* \
127 debian/disorder/usr/share/doc/disorder/.
b0a578cb 128 gzip -9f debian/disorder/usr/share/doc/disorder/README \
48deaa73
RK
129 debian/disorder/usr/share/doc/disorder/README.* \
130 debian/disorder/usr/share/doc/disorder/BUGS \
131 debian/disorder/usr/share/man/man*/*
d9690752
RK
132 cd debian/disorder && \
133 find -name DEBIAN -prune -o -type f -print \
134 | sed 's/^\.\///' \
135 | xargs md5sum > DEBIAN/md5sums
48deaa73
RK
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
48deaa73
RK
141pkg-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
cf0c0430
RK
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
48deaa73
RK
149 $(INSTALL_DATA) debian/copyright \
150 debian/disorder-server/usr/share/doc/disorder-server/copyright
151 $(INSTALL_DATA) debian/changelog \
c94f44c1
RK
152 debian/disorder-server/usr/share/doc/disorder-server/changelog
153 gzip -9 debian/disorder-server/usr/share/doc/disorder-server/changelog*
a349d8f9 154 @for f in preinst postinst prerm postrm config; do\
48deaa73
RK
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
a349d8f9
RK
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
64ac73bb
RK
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
48deaa73
RK
173 rm -rf debian/disorder-server/usr/share/man/man1
174 rm -rf debian/disorder-server/usr/share/man/man3
ae13d68e 175 rm -f debian/disorder-server/usr/share/man/man5/disorder_config.5
e600bdf3 176 rm -f debian/disorder-server/usr/share/man/man5/disorder_preferences.5
ae13d68e 177 rm -f debian/disorder-server/usr/share/man/man5/disorder_protocol.5
a349d8f9
RK
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
48deaa73
RK
190 $(MKDIR) debian/disorder-server/etc/disorder
191 $(MKDIR) debian/disorder-server/etc/init.d
f03d4184 192 $(MKDIR) debian/disorder-server${cgiexecdir}
48deaa73
RK
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
8f9616f1 198 $(INSTALL_DATA) templates/options \
48deaa73 199 debian/disorder-server/etc/disorder/options
8f9616f1
RK
200 $(INSTALL_DATA) debian/etc.disorder.options.user \
201 debian/disorder-server/etc/disorder/options.user
4cbafe13 202 $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) cgi/disorder \
f03d4184 203 $(shell pwd)/debian/disorder-server${cgiexecdir}/disorder
a987f4a7 204 gzip -9f debian/disorder-server/usr/share/man/man*/*
48deaa73 205 dpkg-shlibdeps -Tdebian/substvars.disorder-server \
f03d4184 206 debian/disorder-server${cgiexecdir}/disorder \
48deaa73 207 debian/disorder-server/usr/sbin/* \
a349d8f9 208 debian/disorder-server/usr/lib/disorder/*.so
48deaa73
RK
209 rm -rf debian/disorder-server/usr/share/doc/disorder-server
210 ln -s disorder debian/disorder-server/usr/share/doc/disorder-server
0a3004d0
RK
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
d9690752
RK
216 cd debian/disorder-server && \
217 find -name DEBIAN -prune -o -type f -print \
218 | sed 's/^\.\///' \
219 | xargs md5sum > DEBIAN/md5sums
48deaa73
RK
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
48deaa73
RK
225pkg-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 \
c94f44c1
RK
233 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/changelog
234 gzip -9 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/changelog*
48deaa73
RK
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
0a3004d0 245 strip --remove-section=.comment debian/disorder-playrtp/usr/bin/disorder-playrtp
48deaa73
RK
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
bfa2f233
RK
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*/*
d9690752
RK
254 cd debian/disorder-playrtp && \
255 find -name DEBIAN -prune -o -type f -print \
256 | sed 's/^\.\///' \
257 | xargs md5sum > DEBIAN/md5sums
48deaa73
RK
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
48deaa73
RK
263pkg-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 \
c94f44c1
RK
271 debian/disobedience/usr/share/doc/disobedience/changelog
272 gzip -9 debian/disobedience/usr/share/doc/disobedience/changelog*
48deaa73
RK
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
0a3004d0 284 strip --remove-section=.comment debian/disobedience/usr/bin/disobedience
48deaa73
RK
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
a987f4a7 292 gzip -9f debian/disobedience/usr/share/man/man*/*
48deaa73
RK
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
d9690752
RK
297 cd debian/disobedience && \
298 find -name DEBIAN -prune -o -type f -print \
299 | sed 's/^\.\///' \
300 | xargs md5sum > DEBIAN/md5sums
48deaa73
RK
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
48deaa73
RK
306DEBVERSION:=$(shell dpkg-parsechangelog|awk '/Version:/ {print $$2}')
307DSC=disorder_$(DEBVERSION).dsc
308DEBSRC=disorder_$(DEBVERSION).tar.gz
309VERSION=$(shell $(MAKE) echo-version)
310
311source:
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
318source-check: source
319 rm -rf disorder-$(DEBVERSION)
320 dpkg-source -x $(DSC)
321 cd disorder-$(DEBVERSION) && dpkg-buildpackage -r$(FAKEROOT)
322
48deaa73 323binary: binary-arch binary-indep
eb5f83f4
RK
324binary-arch: pkg-disorder pkg-disorder-server pkg-disorder-playrtp \
325 pkg-disobedience
48deaa73
RK
326binary-indep:
327
eb5f83f4 328clean:
41013672 329 test -f Makefile && $(MAKE) distclean
48deaa73
RK
330 rm -f config.cache
331 rm -f debian/files
332 rm -f debian/substvars.*
eb5f83f4
RK
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