Commit | Line | Data |
---|---|---|
48deaa73 RK |
1 | #! /usr/bin/make -f |
2 | # | |
8f9616f1 | 3 | # Copyright (C) 2004-2008 Richard Kettlewell |
48deaa73 | 4 | # |
e7eb3a27 | 5 | # This program is free software: you can redistribute it and/or modify |
48deaa73 | 6 | # it under the terms of the GNU General Public License as published by |
e7eb3a27 | 7 | # the Free Software Foundation, either version 3 of the License, or |
48deaa73 RK |
8 | # (at your option) any later version. |
9 | # | |
e7eb3a27 RK |
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 | # | |
48deaa73 | 15 | # You should have received a copy of the GNU General Public License |
e7eb3a27 | 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
48deaa73 RK |
17 | # |
18 | ||
f03d4184 | 19 | cgiexecdir=/usr/lib/cgi-bin |
64ac73bb RK |
20 | httpdir=/var/www |
21 | browser=x-www-browser | |
22 | ||
48deaa73 | 23 | # Options to configure. This can be overridden by the caller if necessary. |
32918782 | 24 | CONFIGURE=--prefix=/usr --sysconfdir=/etc --localstatedir=/var/lib --mandir=/usr/share/man --with-browser=${browser} cgiexecdir="${cgiexecdir}" httpdir="${httpdir}" |
48deaa73 RK |
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 | ||
7323d699 RK |
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 | ||
48deaa73 RK |
52 | export INSTALL_DATA |
53 | export INSTALL_SCRIPT | |
54 | export INSTALL_PROGRAM | |
55 | ||
410801ac RK |
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 | ||
48deaa73 RK |
60 | LIBTOOL=./libtool |
61 | FAKEROOT=fakeroot | |
62 | ||
48deaa73 RK |
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: | |
eb5f83f4 | 66 | @set -e;if test ! -f configure; then \ |
d558cce2 RK |
67 | echo ./prepare;\ |
68 | ./prepare;\ | |
69 | fi | |
eb5f83f4 | 70 | @set -e;if test ! -f config.status; then \ |
48deaa73 RK |
71 | echo ./configure ${CONFIGURE} ${CONFIGURE_EXTRA};\ |
72 | ./configure ${CONFIGURE} ${CONFIGURE_EXTRA};\ | |
73 | else\ | |
74 | echo ./config.status;\ | |
75 | ./config.status;\ | |
76 | fi | |
7323d699 | 77 | $(MAKE) SENDMAIL=${SENDMAIL} ${PARALLEL} |
48deaa73 | 78 | |
48deaa73 RK |
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 | |
1b23cbbe | 84 | $(MKDIR) debian/disorder/etc/bash_completion.d |
48deaa73 RK |
85 | $(INSTALL_DATA) debian/copyright \ |
86 | debian/disorder/usr/share/doc/disorder/copyright | |
87 | $(INSTALL_DATA) debian/changelog \ | |
c94f44c1 RK |
88 | debian/disorder/usr/share/doc/disorder/changelog |
89 | gzip -9 debian/disorder/usr/share/doc/disorder/changelog* | |
a987f4a7 RK |
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\ | |
48deaa73 RK |
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 | |
0a3004d0 RK |
104 | strip --remove-section=.comment debian/disorder/usr/bin/disorder |
105 | strip --remove-section=.comment debian/disorder/usr/bin/disorderfm | |
48deaa73 | 106 | $(MAKE) DESTDIR=`pwd`/debian/disorder installdirs install -C lib |
1b23cbbe RK |
107 | $(INSTALL_DATA) scripts/completion.bash \ |
108 | debian/disorder/etc/bash_completion.d/disorder | |
48deaa73 RK |
109 | rm -rf debian/disorder/usr/share/man/man8 |
110 | rm -rf debian/disorder/usr/share/disorder/*.html | |
ae13d68e | 111 | rm -rf debian/disorder/usr/share/disorder/*.tmpl |
1b23cbbe | 112 | rmdir debian/disorder/usr/share/disorder |
48deaa73 RK |
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 | |
ae13d68e RK |
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 | |
48deaa73 RK |
120 | $(MKDIR) debian/disorder/etc/disorder |
121 | dpkg-shlibdeps -Tdebian/substvars.disorder \ | |
122 | debian/disorder/usr/bin/* | |
b0a578cb | 123 | $(INSTALL_DATA) CHANGES.html README debian/README.Debian \ |
48deaa73 RK |
124 | BUGS README.* \ |
125 | debian/disorder/usr/share/doc/disorder/. | |
b0a578cb | 126 | gzip -9f debian/disorder/usr/share/doc/disorder/README \ |
48deaa73 RK |
127 | debian/disorder/usr/share/doc/disorder/README.* \ |
128 | debian/disorder/usr/share/doc/disorder/BUGS \ | |
129 | debian/disorder/usr/share/man/man*/* | |
d9690752 RK |
130 | cd debian/disorder && \ |
131 | find -name DEBIAN -prune -o -type f -print \ | |
132 | | sed 's/^\.\///' \ | |
133 | | xargs md5sum > DEBIAN/md5sums | |
48deaa73 RK |
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 | ||
48deaa73 RK |
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 | |
cf0c0430 RK |
144 | $(MKDIR) debian/disorder-server/usr/share/lintian/overrides |
145 | $(INSTALL_DATA) debian/overrides.disorder-server \ | |
146 | debian/disorder-server/usr/share/lintian/overrides/disorder-server | |
48deaa73 RK |
147 | $(INSTALL_DATA) debian/copyright \ |
148 | debian/disorder-server/usr/share/doc/disorder-server/copyright | |
149 | $(INSTALL_DATA) debian/changelog \ | |
c94f44c1 RK |
150 | debian/disorder-server/usr/share/doc/disorder-server/changelog |
151 | gzip -9 debian/disorder-server/usr/share/doc/disorder-server/changelog* | |
a349d8f9 | 152 | @for f in preinst postinst prerm postrm config; do\ |
48deaa73 RK |
153 | if test -e debian/$$f.disorder-server; then\ |
154 | echo $(INSTALL_SCRIPT) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \ | |
155 | $(INSTALL_SCRIPT) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \ | |
156 | fi;\ | |
157 | done | |
a349d8f9 RK |
158 | @for f in conffiles templates; do\ |
159 | if test -e debian/$$f.disorder-server; then\ | |
160 | echo $(INSTALL_DATA) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \ | |
161 | $(INSTALL_DATA) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \ | |
162 | fi;\ | |
163 | done | |
64ac73bb RK |
164 | $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C images |
165 | $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C server | |
166 | $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C templates | |
167 | $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C driver | |
168 | $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C plugins | |
169 | $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C sounds | |
170 | $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C doc | |
48deaa73 RK |
171 | rm -rf debian/disorder-server/usr/share/man/man1 |
172 | rm -rf debian/disorder-server/usr/share/man/man3 | |
ae13d68e | 173 | rm -f debian/disorder-server/usr/share/man/man5/disorder_config.5 |
e600bdf3 | 174 | rm -f debian/disorder-server/usr/share/man/man5/disorder_preferences.5 |
ae13d68e | 175 | rm -f debian/disorder-server/usr/share/man/man5/disorder_protocol.5 |
a349d8f9 RK |
176 | find debian/disorder-server -name '*.la' -print0 | xargs -r0 rm -f |
177 | find debian/disorder-server -name '*.so.0' -print0 | xargs -r0 rm -f | |
178 | @for f in debian/disorder-server/usr/lib/disorder/*.so.0.0.0; do \ | |
179 | echo mv $$f $${f/.0.0.0};\ | |
180 | mv $$f $${f/.0.0.0};\ | |
181 | done | |
182 | @for f in debian/disorder-server/usr/lib/ao/plugins*/*.so.0.0.0; do \ | |
183 | echo mv $$f $${f/.0.0.0};\ | |
184 | mv $$f $${f/.0.0.0};\ | |
185 | done | |
186 | find debian/disorder-server -name '*.so' -print0 | xargs -r0 strip --strip-unneeded | |
187 | find debian/disorder-server -name '*.so' -print0 | xargs -r0 chmod -x | |
48deaa73 RK |
188 | $(MKDIR) debian/disorder-server/etc/disorder |
189 | $(MKDIR) debian/disorder-server/etc/init.d | |
f03d4184 | 190 | $(MKDIR) debian/disorder-server${cgiexecdir} |
48deaa73 RK |
191 | $(MKDIR) debian/disorder-server/var/lib/disorder |
192 | $(INSTALL_SCRIPT) examples/disorder.init \ | |
193 | debian/disorder-server/etc/init.d/disorder | |
194 | $(INSTALL_DATA) debian/etc.disorder.config \ | |
195 | debian/disorder-server/etc/disorder/config | |
8f9616f1 | 196 | $(INSTALL_DATA) templates/options \ |
48deaa73 | 197 | debian/disorder-server/etc/disorder/options |
8f9616f1 RK |
198 | $(INSTALL_DATA) debian/etc.disorder.options.user \ |
199 | debian/disorder-server/etc/disorder/options.user | |
4cbafe13 | 200 | $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) cgi/disorder \ |
f03d4184 | 201 | $(shell pwd)/debian/disorder-server${cgiexecdir}/disorder |
a987f4a7 | 202 | gzip -9f debian/disorder-server/usr/share/man/man*/* |
48deaa73 | 203 | dpkg-shlibdeps -Tdebian/substvars.disorder-server \ |
f03d4184 | 204 | debian/disorder-server${cgiexecdir}/disorder \ |
48deaa73 | 205 | debian/disorder-server/usr/sbin/* \ |
a349d8f9 | 206 | debian/disorder-server/usr/lib/disorder/*.so |
48deaa73 RK |
207 | rm -rf debian/disorder-server/usr/share/doc/disorder-server |
208 | ln -s disorder debian/disorder-server/usr/share/doc/disorder-server | |
0a3004d0 RK |
209 | strip --remove-section=.comment \ |
210 | debian/disorder-server/usr/sbin/* \ | |
211 | debian/disorder-server${cgiexecdir}/* \ | |
212 | debian/disorder-server/usr/lib/ao/plugins*/*.so \ | |
213 | debian/disorder-server/usr/lib/disorder/*.so | |
d9690752 RK |
214 | cd debian/disorder-server && \ |
215 | find -name DEBIAN -prune -o -type f -print \ | |
216 | | sed 's/^\.\///' \ | |
217 | | xargs md5sum > DEBIAN/md5sums | |
48deaa73 RK |
218 | dpkg-gencontrol -isp -pdisorder-server -Pdebian/disorder-server -Tdebian/substvars.disorder-server |
219 | chown -R root:root debian/disorder-server | |
220 | chmod -R g-ws debian/disorder-server | |
221 | dpkg --build debian/disorder-server .. | |
222 | ||
48deaa73 RK |
223 | pkg-disorder-playrtp: build |
224 | rm -rf debian/disorder-playrtp | |
225 | $(MKDIR) debian/disorder-playrtp | |
226 | $(MKDIR) debian/disorder-playrtp/DEBIAN | |
227 | $(MKDIR) debian/disorder-playrtp/usr/share/doc/disorder-playrtp | |
228 | $(INSTALL_DATA) debian/copyright \ | |
229 | debian/disorder-playrtp/usr/share/doc/disorder-playrtp/copyright | |
230 | $(INSTALL_DATA) debian/changelog \ | |
c94f44c1 RK |
231 | debian/disorder-playrtp/usr/share/doc/disorder-playrtp/changelog |
232 | gzip -9 debian/disorder-playrtp/usr/share/doc/disorder-playrtp/changelog* | |
48deaa73 RK |
233 | @for f in preinst postinst prerm postrm conffiles templates config; do\ |
234 | if test -e debian/$$f.disorder-playrtp; then\ | |
235 | echo $(INSTALL_SCRIPT) debian/$$f.disorder-playrtp debian/disorder-playrtp/DEBIAN/$$f; \ | |
236 | $(INSTALL_SCRIPT) debian/$$f.disorder-playrtp debian/disorder-playrtp/DEBIAN/$$f; \ | |
237 | fi;\ | |
238 | done | |
239 | $(MKDIR) debian/disorder-playrtp/usr/bin | |
240 | $(MKDIR) debian/disorder-playrtp/usr/share/man/man1 | |
241 | $(INSTALL_PROGRAM) clients/disorder-playrtp \ | |
242 | debian/disorder-playrtp/usr/bin/disorder-playrtp | |
0a3004d0 | 243 | strip --remove-section=.comment debian/disorder-playrtp/usr/bin/disorder-playrtp |
48deaa73 RK |
244 | $(INSTALL_DATA) doc/disorder-playrtp.1 \ |
245 | debian/disorder-playrtp/usr/share/man/man1/disorder-playrtp.1 | |
246 | dpkg-shlibdeps -Tdebian/substvars.disorder-playrtp \ | |
247 | debian/disorder-playrtp/usr/bin/* | |
248 | $(INSTALL_DATA) debian/README.RTP \ | |
249 | debian/disorder-playrtp/usr/share/doc/disorder-playrtp/README | |
bfa2f233 RK |
250 | $(INSTALL_DATA) CHANGES.html debian/disorder-playrtp/usr/share/doc/disorder-playrtp/CHANGES.html |
251 | gzip -9f debian/disorder-playrtp/usr/share/man/man*/* | |
d9690752 RK |
252 | cd debian/disorder-playrtp && \ |
253 | find -name DEBIAN -prune -o -type f -print \ | |
254 | | sed 's/^\.\///' \ | |
255 | | xargs md5sum > DEBIAN/md5sums | |
48deaa73 RK |
256 | dpkg-gencontrol -isp -pdisorder-playrtp -Pdebian/disorder-playrtp -Tdebian/substvars.disorder-playrtp |
257 | chown -R root:root debian/disorder-playrtp | |
258 | chmod -R g-ws debian/disorder-playrtp | |
259 | dpkg --build debian/disorder-playrtp .. | |
260 | ||
48deaa73 RK |
261 | pkg-disobedience: build |
262 | rm -rf debian/disobedience | |
263 | $(MKDIR) debian/disobedience | |
264 | $(MKDIR) debian/disobedience/DEBIAN | |
265 | $(MKDIR) debian/disobedience/usr/share/doc/disobedience | |
266 | $(INSTALL_DATA) debian/copyright \ | |
267 | debian/disobedience/usr/share/doc/disobedience/copyright | |
268 | $(INSTALL_DATA) debian/changelog \ | |
c94f44c1 RK |
269 | debian/disobedience/usr/share/doc/disobedience/changelog |
270 | gzip -9 debian/disobedience/usr/share/doc/disobedience/changelog* | |
48deaa73 RK |
271 | @for f in preinst postinst prerm postrm conffiles templates config; do\ |
272 | if test -e debian/$$f.disobedience; then\ | |
273 | echo $(INSTALL_SCRIPT) debian/$$f.disobedience debian/disobedience/DEBIAN/$$f; \ | |
274 | $(INSTALL_SCRIPT) debian/$$f.disobedience debian/disobedience/DEBIAN/$$f; \ | |
275 | fi;\ | |
276 | done | |
277 | $(MKDIR) debian/disobedience/usr/bin | |
278 | $(MKDIR) debian/disobedience/usr/share/man/man1 | |
279 | $(MKDIR) debian/disobedience/usr/share/pixmaps | |
280 | $(MKDIR) debian/disobedience/usr/share/menu | |
281 | $(MAKE) -C disobedience install DESTDIR=`pwd`/debian/disobedience | |
0a3004d0 | 282 | strip --remove-section=.comment debian/disobedience/usr/bin/disobedience |
48deaa73 RK |
283 | $(INSTALL_DATA) doc/disobedience.1 \ |
284 | debian/disobedience/usr/share/man/man1/disobedience.1 | |
285 | $(INSTALL_DATA) images/disobedience16x16.xpm \ | |
286 | images/disobedience32x32.xpm \ | |
287 | debian/disobedience/usr/share/pixmaps | |
288 | $(INSTALL_DATA) debian/usr.share.menu.disobedience \ | |
289 | debian/disobedience/usr/share/menu/disobedience | |
a987f4a7 | 290 | gzip -9f debian/disobedience/usr/share/man/man*/* |
48deaa73 RK |
291 | dpkg-shlibdeps -Tdebian/substvars.disobedience \ |
292 | debian/disobedience/usr/bin/* | |
293 | rm -rf debian/disobedience/usr/share/doc/disobedience | |
294 | ln -s disorder debian/disobedience/usr/share/doc/disobedience | |
d9690752 RK |
295 | cd debian/disobedience && \ |
296 | find -name DEBIAN -prune -o -type f -print \ | |
297 | | sed 's/^\.\///' \ | |
298 | | xargs md5sum > DEBIAN/md5sums | |
48deaa73 RK |
299 | dpkg-gencontrol -isp -pdisobedience -Pdebian/disobedience -Tdebian/substvars.disobedience |
300 | chown -R root:root debian/disobedience | |
301 | chmod -R g-ws debian/disobedience | |
302 | dpkg --build debian/disobedience .. | |
303 | ||
48deaa73 RK |
304 | DEBVERSION:=$(shell dpkg-parsechangelog|awk '/Version:/ {print $$2}') |
305 | DSC=disorder_$(DEBVERSION).dsc | |
306 | DEBSRC=disorder_$(DEBVERSION).tar.gz | |
307 | VERSION=$(shell $(MAKE) echo-version) | |
308 | ||
309 | source: | |
310 | $(MAKE) dist | |
311 | rm -rf disorder-$(VERSION) | |
312 | tar xfz disorder-$(VERSION).tar.gz | |
313 | dpkg-source -b disorder-$(VERSION) | |
314 | rm -rf disorder-$(VERSION) disorder-$(VERSION).tar.gz | |
315 | ||
316 | source-check: source | |
317 | rm -rf disorder-$(DEBVERSION) | |
318 | dpkg-source -x $(DSC) | |
319 | cd disorder-$(DEBVERSION) && dpkg-buildpackage -r$(FAKEROOT) | |
320 | ||
48deaa73 | 321 | binary: binary-arch binary-indep |
eb5f83f4 RK |
322 | binary-arch: pkg-disorder pkg-disorder-server pkg-disorder-playrtp \ |
323 | pkg-disobedience | |
48deaa73 RK |
324 | binary-indep: |
325 | ||
eb5f83f4 | 326 | clean: |
41013672 | 327 | test -f Makefile && $(MAKE) distclean |
48deaa73 RK |
328 | rm -f config.cache |
329 | rm -f debian/files | |
330 | rm -f debian/substvars.* | |
eb5f83f4 RK |
331 | rm -rf debian/disorder |
332 | rm -rf debian/disorder-server | |
333 | rm -rf debian/disorder-playrtp | |
334 | rm -rf debian/disobedience | |
335 | ||
336 | .PHONY: clean build pkg-disorder pkg-disorder-server pkg-disorder-playrtp \ | |
337 | pkg-disobedience source source-check binary binary-arch binary-indep |