chiark / gitweb /
Doxygen for C test infrastructure
[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 preinst postinst prerm postrm conffiles templates config; do\
85           if test -e debian/$$f.disorder; then\
86             echo $(INSTALL_SCRIPT) debian/$$f.disorder debian/disorder/DEBIAN/$$f; \
87             $(INSTALL_SCRIPT) debian/$$f.disorder debian/disorder/DEBIAN/$$f; \
88           fi;\
89         done
90         $(MAKE) DESTDIR=`pwd`/debian/disorder installdirs install -C doc
91         $(MAKE) DESTDIR=`pwd`/debian/disorder installdirs install -C clients
92         $(MAKE) DESTDIR=`pwd`/debian/disorder installdirs install -C lib
93         $(INSTALL_DATA) scripts/completion.bash \
94                 debian/disorder/etc/bash_completion.d/disorder
95         rm -rf debian/disorder/usr/share/man/man8
96         rm -rf debian/disorder/usr/share/disorder/*.html
97         rm -rf debian/disorder/usr/share/disorder/*.tmpl
98         rmdir debian/disorder/usr/share/disorder
99         rm -f debian/disorder/usr/bin/disorder-playrtp
100         rm -f debian/disorder/usr/bin/disobedience
101         rm -f debian/disorder/usr/share/man/man1/disorder-playrtp.1
102         rm -f debian/disorder/usr/share/man/man1/disobedience.1
103         rm -f debian/disorder/usr/share/man/man5/disorder_templates.5
104         rm -f debian/disorder/usr/share/man/man5/disorder_actions.5
105         rm -f debian/disorder/usr/share/man/man5/disorder_options.5
106         $(MKDIR) debian/disorder/etc/disorder
107         dpkg-shlibdeps -Tdebian/substvars.disorder \
108                 debian/disorder/usr/bin/*
109         $(INSTALL_DATA) CHANGES.html README debian/README.Debian \
110                 BUGS README.* \
111                 debian/disorder/usr/share/doc/disorder/.
112         gzip -9f debian/disorder/usr/share/doc/disorder/README \
113                  debian/disorder/usr/share/doc/disorder/README.* \
114                  debian/disorder/usr/share/doc/disorder/BUGS \
115                  debian/disorder/usr/share/man/man*/*
116         dpkg-gencontrol -isp -pdisorder -Pdebian/disorder -Tdebian/substvars.disorder
117         chown -R root:root debian/disorder
118         chmod -R g-ws debian/disorder
119         dpkg --build debian/disorder ..
120
121 pkg-disorder-server: build
122         rm -rf debian/disorder-server
123         $(MKDIR) debian/disorder-server
124         $(MKDIR) debian/disorder-server/DEBIAN
125         $(MKDIR) debian/disorder-server/usr/share/doc/disorder-server
126         $(INSTALL_DATA) debian/copyright \
127                 debian/disorder-server/usr/share/doc/disorder-server/copyright
128         $(INSTALL_DATA) debian/changelog \
129                 debian/disorder-server/usr/share/doc/disorder-server/changelog.Debian
130         gzip -9 debian/disorder-server/usr/share/doc/disorder-server/changelog.Debian
131         @for f in preinst postinst prerm postrm conffiles templates config; do\
132           if test -e debian/$$f.disorder-server; then\
133             echo $(INSTALL_SCRIPT) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \
134             $(INSTALL_SCRIPT) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \
135           fi;\
136         done
137         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C images
138         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C server
139         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C templates
140         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C driver
141         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C plugins
142         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C sounds
143         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C doc
144         rm -rf debian/disorder-server/usr/share/man/man1
145         rm -rf debian/disorder-server/usr/share/man/man3
146         rm -f debian/disorder-server/usr/share/man/man5/disorder_config.5
147         rm -f debian/disorder-server/usr/share/man/man5/disorder_protocol.5
148         $(MKDIR) debian/disorder-server/etc/disorder
149         $(MKDIR) debian/disorder-server/etc/init.d
150         $(MKDIR) debian/disorder-server${cgiexecdir}
151         $(MKDIR) debian/disorder-server/var/lib/disorder
152         $(INSTALL_SCRIPT) examples/disorder.init \
153                 debian/disorder-server/etc/init.d/disorder
154         $(INSTALL_DATA) debian/etc.disorder.config \
155                 debian/disorder-server/etc/disorder/config
156         $(INSTALL_DATA) templates/options \
157                 debian/disorder-server/etc/disorder/options
158         $(INSTALL_DATA) debian/etc.disorder.options.user \
159                 debian/disorder-server/etc/disorder/options.user
160         $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) cgi/disorder \
161                 $(shell pwd)/debian/disorder-server${cgiexecdir}/disorder
162         dpkg-shlibdeps -Tdebian/substvars.disorder-server \
163                 debian/disorder-server${cgiexecdir}/disorder \
164                 debian/disorder-server/usr/sbin/* \
165                 debian/disorder-server/usr/lib/disorder/*.so*
166         rm -rf debian/disorder-server/usr/share/doc/disorder-server
167         ln -s disorder debian/disorder-server/usr/share/doc/disorder-server
168         dpkg-gencontrol -isp -pdisorder-server -Pdebian/disorder-server -Tdebian/substvars.disorder-server
169         chown -R root:root debian/disorder-server
170         chmod -R g-ws debian/disorder-server
171         dpkg --build debian/disorder-server ..
172
173 pkg-disorder-playrtp: build
174         rm -rf debian/disorder-playrtp
175         $(MKDIR) debian/disorder-playrtp
176         $(MKDIR) debian/disorder-playrtp/DEBIAN
177         $(MKDIR) debian/disorder-playrtp/usr/share/doc/disorder-playrtp
178         $(INSTALL_DATA) debian/copyright \
179                 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/copyright
180         $(INSTALL_DATA) debian/changelog \
181                 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/changelog.Debian
182         gzip -9 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/changelog.Debian
183         @for f in preinst postinst prerm postrm conffiles templates config; do\
184           if test -e debian/$$f.disorder-playrtp; then\
185             echo $(INSTALL_SCRIPT) debian/$$f.disorder-playrtp debian/disorder-playrtp/DEBIAN/$$f; \
186             $(INSTALL_SCRIPT) debian/$$f.disorder-playrtp debian/disorder-playrtp/DEBIAN/$$f; \
187           fi;\
188         done
189         $(MKDIR) debian/disorder-playrtp/usr/bin
190         $(MKDIR) debian/disorder-playrtp/usr/share/man/man1
191         $(INSTALL_PROGRAM) clients/disorder-playrtp \
192                 debian/disorder-playrtp/usr/bin/disorder-playrtp
193         $(INSTALL_DATA) doc/disorder-playrtp.1 \
194                 debian/disorder-playrtp/usr/share/man/man1/disorder-playrtp.1
195         dpkg-shlibdeps -Tdebian/substvars.disorder-playrtp \
196                 debian/disorder-playrtp/usr/bin/*
197         $(INSTALL_DATA) debian/README.RTP \
198                 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/README
199         $(INSTALL_DATA) CHANGES.html debian/disorder-playrtp/usr/share/doc/disorder-playrtp/CHANGES.html
200         gzip -9f debian/disorder-playrtp/usr/share/man/man*/*
201         dpkg-gencontrol -isp -pdisorder-playrtp -Pdebian/disorder-playrtp -Tdebian/substvars.disorder-playrtp
202         chown -R root:root debian/disorder-playrtp
203         chmod -R g-ws debian/disorder-playrtp
204         dpkg --build debian/disorder-playrtp ..
205
206 pkg-disobedience: build
207         rm -rf debian/disobedience
208         $(MKDIR) debian/disobedience
209         $(MKDIR) debian/disobedience/DEBIAN
210         $(MKDIR) debian/disobedience/usr/share/doc/disobedience
211         $(INSTALL_DATA) debian/copyright \
212                 debian/disobedience/usr/share/doc/disobedience/copyright
213         $(INSTALL_DATA) debian/changelog \
214                 debian/disobedience/usr/share/doc/disobedience/changelog.Debian
215         gzip -9 debian/disobedience/usr/share/doc/disobedience/changelog.Debian
216         @for f in preinst postinst prerm postrm conffiles templates config; do\
217           if test -e debian/$$f.disobedience; then\
218             echo $(INSTALL_SCRIPT) debian/$$f.disobedience debian/disobedience/DEBIAN/$$f; \
219             $(INSTALL_SCRIPT) debian/$$f.disobedience debian/disobedience/DEBIAN/$$f; \
220           fi;\
221         done
222         $(MKDIR) debian/disobedience/usr/bin
223         $(MKDIR) debian/disobedience/usr/share/man/man1
224         $(MKDIR) debian/disobedience/usr/share/pixmaps
225         $(MKDIR) debian/disobedience/usr/share/menu
226         $(MAKE) -C disobedience install DESTDIR=`pwd`/debian/disobedience
227         $(INSTALL_DATA) doc/disobedience.1 \
228                 debian/disobedience/usr/share/man/man1/disobedience.1
229         $(INSTALL_DATA) images/disobedience16x16.xpm \
230                         images/disobedience32x32.xpm \
231                         debian/disobedience/usr/share/pixmaps
232         $(INSTALL_DATA) debian/usr.share.menu.disobedience \
233                 debian/disobedience/usr/share/menu/disobedience
234         dpkg-shlibdeps -Tdebian/substvars.disobedience \
235                 debian/disobedience/usr/bin/*
236         rm -rf debian/disobedience/usr/share/doc/disobedience
237         ln -s disorder debian/disobedience/usr/share/doc/disobedience
238         dpkg-gencontrol -isp -pdisobedience -Pdebian/disobedience -Tdebian/substvars.disobedience
239         chown -R root:root debian/disobedience
240         chmod -R g-ws debian/disobedience
241         dpkg --build debian/disobedience ..
242
243 DEBVERSION:=$(shell dpkg-parsechangelog|awk '/Version:/ {print $$2}')
244 DSC=disorder_$(DEBVERSION).dsc
245 DEBSRC=disorder_$(DEBVERSION).tar.gz
246 VERSION=$(shell $(MAKE) echo-version)
247
248 source:
249         $(MAKE) dist
250         rm -rf disorder-$(VERSION)
251         tar xfz disorder-$(VERSION).tar.gz
252         dpkg-source -b disorder-$(VERSION)
253         rm -rf disorder-$(VERSION) disorder-$(VERSION).tar.gz
254
255 source-check: source
256         rm -rf disorder-$(DEBVERSION)
257         dpkg-source -x $(DSC)
258         cd disorder-$(DEBVERSION) && dpkg-buildpackage -r$(FAKEROOT)
259
260 binary: binary-arch binary-indep
261 binary-arch: pkg-disorder pkg-disorder-server pkg-disorder-playrtp \
262              pkg-disobedience
263 binary-indep: 
264
265 clean:
266         -$(MAKE) distclean
267         rm -f config.cache
268         rm -f debian/files
269         rm -f debian/substvars.*
270         rm -rf debian/disorder
271         rm -rf debian/disorder-server
272         rm -rf debian/disorder-playrtp
273         rm -rf debian/disobedience
274
275 .PHONY: clean build pkg-disorder pkg-disorder-server pkg-disorder-playrtp \
276         pkg-disobedience source source-check binary binary-arch binary-indep