chiark / gitweb /
Strip installed objects in .debs
[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 # Set DEB_BUILD_OPTIONS=parallel=N to do make -jN
47 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
48 NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
49 PARALLEL = -j$(NUMJOBS)
50 endif
51
52 export INSTALL_DATA
53 export INSTALL_SCRIPT
54 export INSTALL_PROGRAM
55
56 # We override sendmail to the value defined in policy, in case configure picks
57 # up some other sendmail.
58 SENDMAIL=/usr/sbin/sendmail
59
60 LIBTOOL=./libtool
61 FAKEROOT=fakeroot
62
63 # ./prepare is the script that generates configure etc.  It only needs to be
64 # run if building from a checkout rather than a tarball.
65 build:
66         @set -e;if test ! -f configure; then \
67           echo ./prepare;\
68           ./prepare;\
69         fi
70         @set -e;if test ! -f config.status; then \
71           echo ./configure ${CONFIGURE} ${CONFIGURE_EXTRA};\
72           ./configure ${CONFIGURE} ${CONFIGURE_EXTRA};\
73         else\
74           echo ./config.status;\
75           ./config.status;\
76         fi
77         $(MAKE) SENDMAIL=${SENDMAIL} ${PARALLEL}
78
79 pkg-disorder: build
80         rm -rf debian/disorder
81         $(MKDIR) debian/disorder
82         $(MKDIR) debian/disorder/DEBIAN
83         $(MKDIR) debian/disorder/usr/share/doc/disorder
84         $(MKDIR) debian/disorder/etc/bash_completion.d
85         $(INSTALL_DATA) debian/copyright \
86                 debian/disorder/usr/share/doc/disorder/copyright
87         $(INSTALL_DATA) debian/changelog \
88                 debian/disorder/usr/share/doc/disorder/changelog.Debian
89         gzip -9 debian/disorder/usr/share/doc/disorder/changelog.Debian
90         @for f in conffiles templates; do\
91           if test -e debian/$$f.disorder; then\
92             echo $(INSTALL_DATA) debian/$$f.disorder debian/disorder/DEBIAN/$$f; \
93             $(INSTALL_DATA) debian/$$f.disorder debian/disorder/DEBIAN/$$f; \
94           fi;\
95         done
96         @for f in preinst postinst prerm postrm config; do\
97           if test -e debian/$$f.disorder; then\
98             echo $(INSTALL_SCRIPT) debian/$$f.disorder debian/disorder/DEBIAN/$$f; \
99             $(INSTALL_SCRIPT) debian/$$f.disorder debian/disorder/DEBIAN/$$f; \
100           fi;\
101         done
102         $(MAKE) DESTDIR=`pwd`/debian/disorder installdirs install -C doc
103         $(MAKE) DESTDIR=`pwd`/debian/disorder installdirs install -C clients
104         strip --remove-section=.comment debian/disorder/usr/bin/disorder
105         strip --remove-section=.comment debian/disorder/usr/bin/disorderfm
106         $(MAKE) DESTDIR=`pwd`/debian/disorder installdirs install -C lib
107         $(INSTALL_DATA) scripts/completion.bash \
108                 debian/disorder/etc/bash_completion.d/disorder
109         rm -rf debian/disorder/usr/share/man/man8
110         rm -rf debian/disorder/usr/share/disorder/*.html
111         rm -rf debian/disorder/usr/share/disorder/*.tmpl
112         rmdir debian/disorder/usr/share/disorder
113         rm -f debian/disorder/usr/bin/disorder-playrtp
114         rm -f debian/disorder/usr/bin/disobedience
115         rm -f debian/disorder/usr/share/man/man1/disorder-playrtp.1
116         rm -f debian/disorder/usr/share/man/man1/disobedience.1
117         rm -f debian/disorder/usr/share/man/man5/disorder_templates.5
118         rm -f debian/disorder/usr/share/man/man5/disorder_actions.5
119         rm -f debian/disorder/usr/share/man/man5/disorder_options.5
120         $(MKDIR) debian/disorder/etc/disorder
121         dpkg-shlibdeps -Tdebian/substvars.disorder \
122                 debian/disorder/usr/bin/*
123         $(INSTALL_DATA) CHANGES.html README debian/README.Debian \
124                 BUGS README.* \
125                 debian/disorder/usr/share/doc/disorder/.
126         gzip -9f debian/disorder/usr/share/doc/disorder/README \
127                  debian/disorder/usr/share/doc/disorder/README.* \
128                  debian/disorder/usr/share/doc/disorder/BUGS \
129                  debian/disorder/usr/share/man/man*/*
130         cd debian/disorder && \
131                 find -name DEBIAN -prune -o -type f -print \
132                         | sed 's/^\.\///' \
133                         | xargs md5sum > DEBIAN/md5sums
134         dpkg-gencontrol -isp -pdisorder -Pdebian/disorder -Tdebian/substvars.disorder
135         chown -R root:root debian/disorder
136         chmod -R g-ws debian/disorder
137         dpkg --build debian/disorder ..
138
139 pkg-disorder-server: build
140         rm -rf debian/disorder-server
141         $(MKDIR) debian/disorder-server
142         $(MKDIR) debian/disorder-server/DEBIAN
143         $(MKDIR) debian/disorder-server/usr/share/doc/disorder-server
144         $(INSTALL_DATA) debian/copyright \
145                 debian/disorder-server/usr/share/doc/disorder-server/copyright
146         $(INSTALL_DATA) debian/changelog \
147                 debian/disorder-server/usr/share/doc/disorder-server/changelog.Debian
148         gzip -9 debian/disorder-server/usr/share/doc/disorder-server/changelog.Debian
149         @for f in preinst postinst prerm postrm config; do\
150           if test -e debian/$$f.disorder-server; then\
151             echo $(INSTALL_SCRIPT) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \
152             $(INSTALL_SCRIPT) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \
153           fi;\
154         done
155         @for f in conffiles templates; do\
156           if test -e debian/$$f.disorder-server; then\
157             echo $(INSTALL_DATA) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \
158             $(INSTALL_DATA) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \
159           fi;\
160         done
161         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C images
162         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C server
163         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C templates
164         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C driver
165         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C plugins
166         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C sounds
167         $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C doc
168         rm -rf debian/disorder-server/usr/share/man/man1
169         rm -rf debian/disorder-server/usr/share/man/man3
170         rm -f debian/disorder-server/usr/share/man/man5/disorder_config.5
171         rm -f debian/disorder-server/usr/share/man/man5/disorder_preferences.5
172         rm -f debian/disorder-server/usr/share/man/man5/disorder_protocol.5
173         find debian/disorder-server -name '*.la' -print0 | xargs -r0 rm -f
174         find debian/disorder-server -name '*.so.0' -print0 | xargs -r0 rm -f
175         @for f in debian/disorder-server/usr/lib/disorder/*.so.0.0.0; do \
176           echo mv $$f $${f/.0.0.0};\
177           mv $$f $${f/.0.0.0};\
178         done
179         @for f in debian/disorder-server/usr/lib/ao/plugins*/*.so.0.0.0; do \
180           echo mv $$f $${f/.0.0.0};\
181           mv $$f $${f/.0.0.0};\
182         done
183         find debian/disorder-server -name '*.so' -print0 | xargs -r0 strip --strip-unneeded
184         find debian/disorder-server -name '*.so' -print0 | xargs -r0 chmod -x
185         $(MKDIR) debian/disorder-server/etc/disorder
186         $(MKDIR) debian/disorder-server/etc/init.d
187         $(MKDIR) debian/disorder-server${cgiexecdir}
188         $(MKDIR) debian/disorder-server/var/lib/disorder
189         $(INSTALL_SCRIPT) examples/disorder.init \
190                 debian/disorder-server/etc/init.d/disorder
191         $(INSTALL_DATA) debian/etc.disorder.config \
192                 debian/disorder-server/etc/disorder/config
193         $(INSTALL_DATA) templates/options \
194                 debian/disorder-server/etc/disorder/options
195         $(INSTALL_DATA) debian/etc.disorder.options.user \
196                 debian/disorder-server/etc/disorder/options.user
197         $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) cgi/disorder \
198                 $(shell pwd)/debian/disorder-server${cgiexecdir}/disorder
199         gzip -9f debian/disorder-server/usr/share/man/man*/*
200         dpkg-shlibdeps -Tdebian/substvars.disorder-server \
201                 debian/disorder-server${cgiexecdir}/disorder \
202                 debian/disorder-server/usr/sbin/* \
203                 debian/disorder-server/usr/lib/disorder/*.so
204         rm -rf debian/disorder-server/usr/share/doc/disorder-server
205         ln -s disorder debian/disorder-server/usr/share/doc/disorder-server
206         strip --remove-section=.comment \
207                 debian/disorder-server/usr/sbin/* \
208                 debian/disorder-server${cgiexecdir}/* \
209                 debian/disorder-server/usr/lib/ao/plugins*/*.so \
210                 debian/disorder-server/usr/lib/disorder/*.so
211         cd debian/disorder-server && \
212                 find -name DEBIAN -prune -o -type f -print \
213                         | sed 's/^\.\///' \
214                         | xargs md5sum > DEBIAN/md5sums
215         dpkg-gencontrol -isp -pdisorder-server -Pdebian/disorder-server -Tdebian/substvars.disorder-server
216         chown -R root:root debian/disorder-server
217         chmod -R g-ws debian/disorder-server
218         dpkg --build debian/disorder-server ..
219
220 pkg-disorder-playrtp: build
221         rm -rf debian/disorder-playrtp
222         $(MKDIR) debian/disorder-playrtp
223         $(MKDIR) debian/disorder-playrtp/DEBIAN
224         $(MKDIR) debian/disorder-playrtp/usr/share/doc/disorder-playrtp
225         $(INSTALL_DATA) debian/copyright \
226                 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/copyright
227         $(INSTALL_DATA) debian/changelog \
228                 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/changelog.Debian
229         gzip -9 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/changelog.Debian
230         @for f in preinst postinst prerm postrm conffiles templates config; do\
231           if test -e debian/$$f.disorder-playrtp; then\
232             echo $(INSTALL_SCRIPT) debian/$$f.disorder-playrtp debian/disorder-playrtp/DEBIAN/$$f; \
233             $(INSTALL_SCRIPT) debian/$$f.disorder-playrtp debian/disorder-playrtp/DEBIAN/$$f; \
234           fi;\
235         done
236         $(MKDIR) debian/disorder-playrtp/usr/bin
237         $(MKDIR) debian/disorder-playrtp/usr/share/man/man1
238         $(INSTALL_PROGRAM) clients/disorder-playrtp \
239                 debian/disorder-playrtp/usr/bin/disorder-playrtp
240         strip --remove-section=.comment debian/disorder-playrtp/usr/bin/disorder-playrtp
241         $(INSTALL_DATA) doc/disorder-playrtp.1 \
242                 debian/disorder-playrtp/usr/share/man/man1/disorder-playrtp.1
243         dpkg-shlibdeps -Tdebian/substvars.disorder-playrtp \
244                 debian/disorder-playrtp/usr/bin/*
245         $(INSTALL_DATA) debian/README.RTP \
246                 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/README
247         $(INSTALL_DATA) CHANGES.html debian/disorder-playrtp/usr/share/doc/disorder-playrtp/CHANGES.html
248         gzip -9f debian/disorder-playrtp/usr/share/man/man*/*
249         cd debian/disorder-playrtp && \
250                 find -name DEBIAN -prune -o -type f -print \
251                         | sed 's/^\.\///' \
252                         | xargs md5sum > DEBIAN/md5sums
253         dpkg-gencontrol -isp -pdisorder-playrtp -Pdebian/disorder-playrtp -Tdebian/substvars.disorder-playrtp
254         chown -R root:root debian/disorder-playrtp
255         chmod -R g-ws debian/disorder-playrtp
256         dpkg --build debian/disorder-playrtp ..
257
258 pkg-disobedience: build
259         rm -rf debian/disobedience
260         $(MKDIR) debian/disobedience
261         $(MKDIR) debian/disobedience/DEBIAN
262         $(MKDIR) debian/disobedience/usr/share/doc/disobedience
263         $(INSTALL_DATA) debian/copyright \
264                 debian/disobedience/usr/share/doc/disobedience/copyright
265         $(INSTALL_DATA) debian/changelog \
266                 debian/disobedience/usr/share/doc/disobedience/changelog.Debian
267         gzip -9 debian/disobedience/usr/share/doc/disobedience/changelog.Debian
268         @for f in preinst postinst prerm postrm conffiles templates config; do\
269           if test -e debian/$$f.disobedience; then\
270             echo $(INSTALL_SCRIPT) debian/$$f.disobedience debian/disobedience/DEBIAN/$$f; \
271             $(INSTALL_SCRIPT) debian/$$f.disobedience debian/disobedience/DEBIAN/$$f; \
272           fi;\
273         done
274         $(MKDIR) debian/disobedience/usr/bin
275         $(MKDIR) debian/disobedience/usr/share/man/man1
276         $(MKDIR) debian/disobedience/usr/share/pixmaps
277         $(MKDIR) debian/disobedience/usr/share/menu
278         $(MAKE) -C disobedience install DESTDIR=`pwd`/debian/disobedience
279         strip --remove-section=.comment debian/disobedience/usr/bin/disobedience
280         $(INSTALL_DATA) doc/disobedience.1 \
281                 debian/disobedience/usr/share/man/man1/disobedience.1
282         $(INSTALL_DATA) images/disobedience16x16.xpm \
283                         images/disobedience32x32.xpm \
284                         debian/disobedience/usr/share/pixmaps
285         $(INSTALL_DATA) debian/usr.share.menu.disobedience \
286                 debian/disobedience/usr/share/menu/disobedience
287         gzip -9f debian/disobedience/usr/share/man/man*/*
288         dpkg-shlibdeps -Tdebian/substvars.disobedience \
289                 debian/disobedience/usr/bin/*
290         rm -rf debian/disobedience/usr/share/doc/disobedience
291         ln -s disorder debian/disobedience/usr/share/doc/disobedience
292         cd debian/disobedience && \
293                 find -name DEBIAN -prune -o -type f -print \
294                         | sed 's/^\.\///' \
295                         | xargs md5sum > DEBIAN/md5sums
296         dpkg-gencontrol -isp -pdisobedience -Pdebian/disobedience -Tdebian/substvars.disobedience
297         chown -R root:root debian/disobedience
298         chmod -R g-ws debian/disobedience
299         dpkg --build debian/disobedience ..
300
301 DEBVERSION:=$(shell dpkg-parsechangelog|awk '/Version:/ {print $$2}')
302 DSC=disorder_$(DEBVERSION).dsc
303 DEBSRC=disorder_$(DEBVERSION).tar.gz
304 VERSION=$(shell $(MAKE) echo-version)
305
306 source:
307         $(MAKE) dist
308         rm -rf disorder-$(VERSION)
309         tar xfz disorder-$(VERSION).tar.gz
310         dpkg-source -b disorder-$(VERSION)
311         rm -rf disorder-$(VERSION) disorder-$(VERSION).tar.gz
312
313 source-check: source
314         rm -rf disorder-$(DEBVERSION)
315         dpkg-source -x $(DSC)
316         cd disorder-$(DEBVERSION) && dpkg-buildpackage -r$(FAKEROOT)
317
318 binary: binary-arch binary-indep
319 binary-arch: pkg-disorder pkg-disorder-server pkg-disorder-playrtp \
320              pkg-disobedience
321 binary-indep: 
322
323 clean:
324         test -f Makefile && $(MAKE) distclean
325         rm -f config.cache
326         rm -f debian/files
327         rm -f debian/substvars.*
328         rm -rf debian/disorder
329         rm -rf debian/disorder-server
330         rm -rf debian/disorder-playrtp
331         rm -rf debian/disobedience
332
333 .PHONY: clean build pkg-disorder pkg-disorder-server pkg-disorder-playrtp \
334         pkg-disobedience source source-check binary binary-arch binary-indep