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