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