chiark / gitweb /
Updates to Debian scripts:
[disorder] / debian / rules
1 #! /usr/bin/make -f
2 #
3 # Copyright (C) 2004, 2005, 2006, 2007 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 2 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, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 # 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, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18 # USA
19 #
20
21 # Options to configure.  This can be overridden by the caller if necessary.
22 CONFIGURE=--prefix=/usr --sysconfdir=/etc --localstatedir=/var/lib --mandir=/usr/share/man --with-browser=x-www-browser
23
24 # Set DEB_BUILD_OPTIONS=noopt to produce a non-optimized build.
25 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
26 CFLAGS=-O0 -g
27 else
28 CFLAGS=-O2 -g
29 endif
30 export CFLAGS
31
32 # Install commands.  You wouldn't normally override these.
33 INSTALL=install
34 INSTALL_DATA=$(INSTALL) -p -o root -g root -m 644
35 INSTALL_PROGRAM=$(INSTALL) -p -o root -g root -m 755
36 INSTALL_SCRIPT=$(INSTALL) -p -o root -g root -m 755
37 MKDIR=mkdir -p -m 755
38
39 # Set DEB_BUILD_OPTIONS=nostrip to install debuggable executables.
40 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
41 INSTALL_PROGRAM += -s
42 endif
43
44 export INSTALL_DATA
45 export INSTALL_SCRIPT
46 export INSTALL_PROGRAM
47
48 LIBTOOL=./libtool
49 FAKEROOT=fakeroot
50
51 .PHONY: build
52 # ./prepare is the script that generates configure etc.  It only needs to be
53 # run if building from a checkout rather than a tarball.
54 build:
55         @if test ! -f configure; then \
56           echo ./prepare ${CONFIGURE} ${CONFIGURE_EXTRA};\
57           ./prepare ${CONFIGURE} ${CONFIGURE_EXTRA};\
58         elif test ! -f config.status; then \
59           echo ./configure ${CONFIGURE} ${CONFIGURE_EXTRA};\
60           ./configure ${CONFIGURE} ${CONFIGURE_EXTRA};\
61         else\
62           echo ./config.status;\
63           ./config.status;\
64         fi
65         $(MAKE)
66
67 .PHONY: cleanpkg-disorder
68 cleanpkg-disorder:
69         rm -rf debian/disorder
70
71 .PHONY: pkg-disorder
72 pkg-disorder: build
73         rm -rf debian/disorder
74         $(MKDIR) debian/disorder
75         $(MKDIR) debian/disorder/DEBIAN
76         $(MKDIR) debian/disorder/usr/share/doc/disorder
77         $(MKDIR) debian/disorder/etc/bash_completion.d
78         $(INSTALL_DATA) debian/copyright \
79                 debian/disorder/usr/share/doc/disorder/copyright
80         $(INSTALL_DATA) debian/changelog \
81                 debian/disorder/usr/share/doc/disorder/changelog.Debian
82         gzip -9 debian/disorder/usr/share/doc/disorder/changelog.Debian
83         @for f in preinst postinst prerm postrm conffiles templates config; do\
84           if test -e debian/$$f.disorder; then\
85             echo $(INSTALL_SCRIPT) debian/$$f.disorder debian/disorder/DEBIAN/$$f; \
86             $(INSTALL_SCRIPT) debian/$$f.disorder debian/disorder/DEBIAN/$$f; \
87           fi;\
88         done
89         $(MAKE) DESTDIR=`pwd`/debian/disorder installdirs install -C doc
90         $(MAKE) DESTDIR=`pwd`/debian/disorder installdirs install -C clients
91         $(MAKE) DESTDIR=`pwd`/debian/disorder installdirs install -C lib
92         $(INSTALL_DATA) scripts/completion.bash \
93                 debian/disorder/etc/bash_completion.d/disorder
94         rm -rf debian/disorder/usr/share/man/man8
95         rm -rf debian/disorder/usr/share/disorder/*.html
96         rmdir debian/disorder/usr/share/disorder
97         rm -f debian/disorder/usr/bin/disorder-playrtp
98         rm -f debian/disorder/usr/bin/disobedience
99         rm -f debian/disorder/usr/share/man/man1/disorder-playrtp.1
100         rm -f debian/disorder/usr/share/man/man1/disobedience.1
101         $(MKDIR) debian/disorder/etc/disorder
102         dpkg-shlibdeps -Tdebian/substvars.disorder \
103                 debian/disorder/usr/bin/*
104         $(INSTALL_DATA) CHANGES README debian/README.Debian \
105                 BUGS README.* \
106                 debian/disorder/usr/share/doc/disorder/.
107         bzr log > debian/disorder/usr/share/doc/disorder/changelog
108         gzip -9f debian/disorder/usr/share/doc/disorder/changelog \
109                  debian/disorder/usr/share/doc/disorder/CHANGES \
110                  debian/disorder/usr/share/doc/disorder/README \
111                  debian/disorder/usr/share/doc/disorder/README.* \
112                  debian/disorder/usr/share/doc/disorder/BUGS \
113                  debian/disorder/usr/share/man/man*/*
114         dpkg-gencontrol -isp -pdisorder -Pdebian/disorder -Tdebian/substvars.disorder
115         chown -R root:root debian/disorder
116         chmod -R g-ws debian/disorder
117         dpkg --build debian/disorder ..
118
119
120 .PHONY: cleanpkg-disorder-server
121 cleanpkg-disorder-server:
122         rm -rf debian/disorder-server
123
124 .PHONY: pkg-disorder-server
125 pkg-disorder-server: build
126         rm -rf debian/disorder-server
127         $(MKDIR) debian/disorder-server
128         $(MKDIR) debian/disorder-server/DEBIAN
129         $(MKDIR) debian/disorder-server/usr/share/doc/disorder-server
130         $(INSTALL_DATA) debian/copyright \
131                 debian/disorder-server/usr/share/doc/disorder-server/copyright
132         $(INSTALL_DATA) debian/changelog \
133                 debian/disorder-server/usr/share/doc/disorder-server/changelog.Debian
134         gzip -9 debian/disorder-server/usr/share/doc/disorder-server/changelog.Debian
135         @for f in preinst postinst prerm postrm conffiles templates config; do\
136           if test -e debian/$$f.disorder-server; then\
137             echo $(INSTALL_SCRIPT) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \
138             $(INSTALL_SCRIPT) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \
139           fi;\
140         done
141         $(MAKE) DESTDIR=`pwd`/debian/disorder-server staticdir=/var/www/disorder installdirs install -C images
142         $(MAKE) DESTDIR=`pwd`/debian/disorder-server staticdir=/var/www/disorder installdirs install -C server
143         $(MAKE) DESTDIR=`pwd`/debian/disorder-server staticdir=/var/www/disorder installdirs install -C templates
144         $(MAKE) DESTDIR=`pwd`/debian/disorder-server staticdir=/var/www/disorder installdirs install -C driver
145         $(MAKE) DESTDIR=`pwd`/debian/disorder-server staticdir=/var/www/disorder installdirs install -C plugins
146         $(MAKE) DESTDIR=`pwd`/debian/disorder-server staticdir=/var/www/disorder installdirs install -C sounds
147         $(MAKE) DESTDIR=`pwd`/debian/disorder-server staticdir=/var/www/disorder installdirs install -C doc
148         rm -rf debian/disorder-server/usr/share/man/man1
149         rm -rf debian/disorder-server/usr/share/man/man3
150         rm -rf debian/disorder-server/usr/share/man/man5
151         $(MKDIR) debian/disorder-server/etc/disorder
152         $(MKDIR) debian/disorder-server/etc/init.d
153         $(MKDIR) debian/disorder-server/usr/lib/cgi-bin
154         $(MKDIR) debian/disorder-server/var/lib/disorder
155         $(INSTALL_SCRIPT) examples/disorder.init \
156                 debian/disorder-server/etc/init.d/disorder
157         $(INSTALL_DATA) debian/etc.disorder.config \
158                 debian/disorder-server/etc/disorder/config
159         $(INSTALL_DATA) debian/etc.disorder.options \
160                 debian/disorder-server/etc/disorder/options
161         $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) server/disorder.cgi \
162                 $(shell pwd)/debian/disorder-server/usr/lib/cgi-bin/disorder
163         dpkg-shlibdeps -Tdebian/substvars.disorder-server \
164                 debian/disorder-server/usr/lib/cgi-bin/disorder \
165                 debian/disorder-server/usr/sbin/* \
166                 debian/disorder-server/usr/lib/disorder/*.so*
167         rm -rf debian/disorder-server/usr/share/doc/disorder-server
168         ln -s disorder debian/disorder-server/usr/share/doc/disorder-server
169         dpkg-gencontrol -isp -pdisorder-server -Pdebian/disorder-server -Tdebian/substvars.disorder-server
170         chown -R root:root debian/disorder-server
171         chmod -R g-ws debian/disorder-server
172         dpkg --build debian/disorder-server ..
173
174
175 .PHONY: cleanpkg-disorder-playrtp
176 cleanpkg-disorder-playrtp:
177         rm -rf debian/disorder-playrtp
178
179 .PHONY: pkg-disorder-playrtp
180 pkg-disorder-playrtp: build
181         rm -rf debian/disorder-playrtp
182         $(MKDIR) debian/disorder-playrtp
183         $(MKDIR) debian/disorder-playrtp/DEBIAN
184         $(MKDIR) debian/disorder-playrtp/usr/share/doc/disorder-playrtp
185         $(INSTALL_DATA) debian/copyright \
186                 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/copyright
187         $(INSTALL_DATA) debian/changelog \
188                 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/changelog.Debian
189         gzip -9 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/changelog.Debian
190         @for f in preinst postinst prerm postrm conffiles templates config; do\
191           if test -e debian/$$f.disorder-playrtp; then\
192             echo $(INSTALL_SCRIPT) debian/$$f.disorder-playrtp debian/disorder-playrtp/DEBIAN/$$f; \
193             $(INSTALL_SCRIPT) debian/$$f.disorder-playrtp debian/disorder-playrtp/DEBIAN/$$f; \
194           fi;\
195         done
196         $(MKDIR) debian/disorder-playrtp/usr/bin
197         $(MKDIR) debian/disorder-playrtp/usr/share/man/man1
198         $(INSTALL_PROGRAM) clients/disorder-playrtp \
199                 debian/disorder-playrtp/usr/bin/disorder-playrtp
200         $(INSTALL_DATA) doc/disorder-playrtp.1 \
201                 debian/disorder-playrtp/usr/share/man/man1/disorder-playrtp.1
202         dpkg-shlibdeps -Tdebian/substvars.disorder-playrtp \
203                 debian/disorder-playrtp/usr/bin/*
204         $(INSTALL_DATA) debian/README.RTP \
205                 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/README
206         $(INSTALL_DATA) CHANGES debian/disorder-playrtp/usr/share/doc/disorder-playrtp/CHANGES
207         gzip -9f debian/disorder-playrtp/usr/share/doc/disorder-playrtp/CHANGES \
208                  debian/disorder-playrtp/usr/share/man/man*/*
209         dpkg-gencontrol -isp -pdisorder-playrtp -Pdebian/disorder-playrtp -Tdebian/substvars.disorder-playrtp
210         chown -R root:root debian/disorder-playrtp
211         chmod -R g-ws debian/disorder-playrtp
212         dpkg --build debian/disorder-playrtp ..
213
214
215 .PHONY: cleanpkg-disobedience
216 cleanpkg-disobedience:
217         rm -rf debian/disobedience
218
219 .PHONY: pkg-disobedience
220 pkg-disobedience: build
221         rm -rf debian/disobedience
222         $(MKDIR) debian/disobedience
223         $(MKDIR) debian/disobedience/DEBIAN
224         $(MKDIR) debian/disobedience/usr/share/doc/disobedience
225         $(INSTALL_DATA) debian/copyright \
226                 debian/disobedience/usr/share/doc/disobedience/copyright
227         $(INSTALL_DATA) debian/changelog \
228                 debian/disobedience/usr/share/doc/disobedience/changelog.Debian
229         gzip -9 debian/disobedience/usr/share/doc/disobedience/changelog.Debian
230         @for f in preinst postinst prerm postrm conffiles templates config; do\
231           if test -e debian/$$f.disobedience; then\
232             echo $(INSTALL_SCRIPT) debian/$$f.disobedience debian/disobedience/DEBIAN/$$f; \
233             $(INSTALL_SCRIPT) debian/$$f.disobedience debian/disobedience/DEBIAN/$$f; \
234           fi;\
235         done
236         $(MKDIR) debian/disobedience/usr/bin
237         $(MKDIR) debian/disobedience/usr/share/man/man1
238         $(MKDIR) debian/disobedience/usr/share/pixmaps
239         $(MKDIR) debian/disobedience/usr/share/menu
240         $(MAKE) -C disobedience install DESTDIR=`pwd`/debian/disobedience
241         $(INSTALL_DATA) doc/disobedience.1 \
242                 debian/disobedience/usr/share/man/man1/disobedience.1
243         $(INSTALL_DATA) images/disobedience16x16.xpm \
244                         images/disobedience32x32.xpm \
245                         debian/disobedience/usr/share/pixmaps
246         $(INSTALL_DATA) debian/usr.share.menu.disobedience \
247                 debian/disobedience/usr/share/menu/disobedience
248         dpkg-shlibdeps -Tdebian/substvars.disobedience \
249                 debian/disobedience/usr/bin/*
250         rm -rf debian/disobedience/usr/share/doc/disobedience
251         ln -s disorder debian/disobedience/usr/share/doc/disobedience
252         dpkg-gencontrol -isp -pdisobedience -Pdebian/disobedience -Tdebian/substvars.disobedience
253         chown -R root:root debian/disobedience
254         chmod -R g-ws debian/disobedience
255         dpkg --build debian/disobedience ..
256
257
258 DEBVERSION:=$(shell dpkg-parsechangelog|awk '/Version:/ {print $$2}')
259 DSC=disorder_$(DEBVERSION).dsc
260 DEBSRC=disorder_$(DEBVERSION).tar.gz
261 VERSION=$(shell $(MAKE) echo-version)
262
263 source:
264         $(MAKE) dist
265         rm -rf disorder-$(VERSION)
266         tar xfz disorder-$(VERSION).tar.gz
267         dpkg-source -b disorder-$(VERSION)
268         rm -rf disorder-$(VERSION) disorder-$(VERSION).tar.gz
269
270 source-check: source
271         rm -rf disorder-$(DEBVERSION)
272         dpkg-source -x $(DSC)
273         cd disorder-$(DEBVERSION) && dpkg-buildpackage -r$(FAKEROOT)
274
275 .PHONY: source source-check
276
277 .PHONY: binary binary-arch binary-indep
278 binary: binary-arch binary-indep
279 binary-arch:  pkg-disorder pkg-disorder-server pkg-disorder-playrtp pkg-disobedience
280 binary-indep: 
281
282 .PHONY: clean
283 clean:  cleanpkg-disorder cleanpkg-disorder-server cleanpkg-disorder-playrtp cleanpkg-disobedience
284         -$(MAKE) distclean
285         rm -f config.cache
286         rm -f debian/files
287         rm -f debian/substvars.*