Debian packages: build "-full" and "-full-dbg" with support for PAM
[ngircd-alex.git] / contrib / Debian / rules
1 #!/usr/bin/make -f
2 #
3 # ngIRCd -- The Next Generation IRC Daemon
4 # Copyright (c)2001-2009 Alexander Barton <alex@barton.de>
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 # Please read the file COPYING, README and AUTHORS for more information.
11 #
12 # debian/rules for ngIRCd
13 #
14 # Based on the sample debian/rules that uses debhelper,
15 # GNU copyright 1997 to 1999 by Joey Hess.
16 #
17
18 # Uncomment this to turn on verbose mode.
19 #export DH_VERBOSE=1
20
21 # These are used for cross-compiling and for saving the configure script
22 # from having to guess our platform (since we know it already)
23 DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
24 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
25
26 CFLAGS = -Wall -g
27
28 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
29         CFLAGS += -O0
30 else
31         CFLAGS += -O2
32 endif
33 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
34         INSTALL_PROGRAM += -s
35 endif
36
37 configure-ngircd: configure
38         dh_testdir
39
40         # configure "standard" variant:
41         ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
42           --prefix=/usr \
43           --sysconfdir=/etc/ngircd \
44           --mandir=\$${prefix}/share/man \
45           --with-syslog --with-zlib
46
47 configure-ngircd-full: configure
48         dh_testdir
49
50         # configure "full" variant:
51         ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
52           --prefix=/usr \
53           --sysconfdir=/etc/ngircd \
54           --mandir=\$${prefix}/share/man \
55           --with-syslog --with-zlib \
56           --with-gnutls --with-ident --with-tcp-wrappers --with-pam \
57           --enable-ipv6
58
59 configure-ngircd-full-dbg: configure
60         dh_testdir
61
62         # configure "full debug" variant:
63         ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
64           --prefix=/usr \
65           --sysconfdir=/etc/ngircd \
66           --mandir=\$${prefix}/share/man \
67           --enable-debug --enable-sniffer \
68           --with-syslog --with-zlib \
69           --with-gnutls --with-ident --with-tcp-wrappers --with-pam \
70           --enable-ipv6
71
72 build:
73         dh_clean -k
74
75 build-ngircd: build-stamp-ngircd
76 build-stamp-ngircd: configure-ngircd
77         dh_testdir
78         rm -f build-stamp-*
79
80         # Add here commands to compile the "standard" package:
81         $(MAKE)
82
83         touch build-stamp-ngircd
84
85 build-ngircd-full: build-stamp-ngircd-full
86 build-stamp-ngircd-full: configure-ngircd-full
87         dh_testdir
88         rm -f build-stamp-*
89
90         # Add here commands to compile the "full" package:
91         $(MAKE)
92
93         touch build-stamp-ngircd-full
94
95 build-ngircd-full-dbg: build-stamp-ngircd-full-dbg
96 build-stamp-ngircd-full-dbg: configure-ngircd-full-dbg
97         dh_testdir
98         rm -f build-stamp-*
99
100         # Add here commands to compile the "full debug" package:
101         $(MAKE)
102
103         touch build-stamp-ngircd-full
104
105 clean:
106         dh_testdir
107         dh_testroot
108         rm -f build-stamp*
109         rm -f $(CURDIR)/debian/ngircd-full.default
110         rm -f $(CURDIR)/debian/ngircd-full.init
111         rm -f $(CURDIR)/debian/ngircd-full.postinst
112         rm -f $(CURDIR)/debian/ngircd-full-dbg.default
113         rm -f $(CURDIR)/debian/ngircd-full-dbg.postinst
114         rm -f $(CURDIR)/debian/ngircd-full-dbg.init
115
116         # Add here commands to clean up after the build process:
117         [ ! -f Makefile ] || $(MAKE) distclean
118
119 ifneq "$(wildcard /usr/share/misc/config.sub)" ""
120         cp -f /usr/share/misc/config.sub config.sub
121 endif
122 ifneq "$(wildcard /usr/share/misc/config.guess)" ""
123         cp -f /usr/share/misc/config.guess config.guess
124 endif
125         dh_clean
126
127 install: install-ngircd install-ngircd-full install-ngircd-full-dbg
128
129 install-ngircd: build-ngircd
130         dh_testdir
131         dh_testroot
132         dh_installdirs
133
134         # Add here commands to install the "standard" package into debian/ngircd:
135         $(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd
136         rm $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/INSTALL*
137         rm $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/COPYING*
138         mkdir -p $(CURDIR)/debian/ngircd/var/run/ircd
139         cat $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/sample-ngircd.conf | \
140          sed -e "s/;ServerUID = 65534/ServerUID = irc/g" | \
141          sed -e "s/;ServerGID = 65534/ServerGID = irc/g" | \
142          sed -e "s/;MotdFile = \/usr\/local\/etc\/ngircd.motd/MotdFile = \/etc\/ngircd\/ngircd.motd/g" | \
143          sed -e "s/;PidFile = \/var\/run\/ngircd\/ngircd.pid/PidFile = \/var\/run\/ircd\/ngircd.pid/g" \
144          >$(CURDIR)/debian/ngircd/etc/ngircd/ngircd.conf
145         touch $(CURDIR)/debian/ngircd/etc/ngircd/ngircd.motd
146
147 install-ngircd-full: build-ngircd-full
148         dh_testdir
149         dh_testroot
150         dh_installdirs
151
152         # Add here commands to install the "full" package into debian/ngircd-full:
153         $(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd-full
154         rm $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd/INSTALL*
155         rm $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd/COPYING*
156         mv $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd \
157          $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd-full
158         mkdir -p $(CURDIR)/debian/ngircd-full/var/run/ircd
159         cat $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd-full/sample-ngircd.conf | \
160          sed -e "s/;ServerUID = 65534/ServerUID = irc/g" | \
161          sed -e "s/;ServerGID = 65534/ServerGID = irc/g" | \
162          sed -e "s/;MotdFile = \/usr\/local\/etc\/ngircd.motd/MotdFile = \/etc\/ngircd\/ngircd.motd/g" | \
163          sed -e "s/;PidFile = \/var\/run\/ngircd\/ngircd.pid/PidFile = \/var\/run\/ircd\/ngircd.pid/g" \
164          >$(CURDIR)/debian/ngircd-full/etc/ngircd/ngircd.conf
165         touch $(CURDIR)/debian/ngircd-full/etc/ngircd/ngircd.motd
166
167 install-ngircd-full-dbg: build-ngircd-full-dbg
168         dh_testdir
169         dh_testroot
170         dh_installdirs
171
172         # Add here commands to install the "full" package into debian/ngircd-full:
173         $(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd-full-dbg
174         rm $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd/INSTALL*
175         rm $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd/COPYING*
176         mv $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd \
177          $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd-full-dbg
178         mkdir -p $(CURDIR)/debian/ngircd-full-dbg/var/run/ircd
179         cat $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd-full-dbg/sample-ngircd.conf | \
180          sed -e "s/;ServerUID = 65534/ServerUID = irc/g" | \
181          sed -e "s/;ServerGID = 65534/ServerGID = irc/g" | \
182          sed -e "s/;MotdFile = \/usr\/local\/etc\/ngircd.motd/MotdFile = \/etc\/ngircd\/ngircd.motd/g" | \
183          sed -e "s/;PidFile = \/var\/run\/ngircd\/ngircd.pid/PidFile = \/var\/run\/ircd\/ngircd.pid/g" \
184          >$(CURDIR)/debian/ngircd-full-dbg/etc/ngircd/ngircd.conf
185         touch $(CURDIR)/debian/ngircd-full-dbg/etc/ngircd/ngircd.motd
186
187 # Build architecture-independent files here.
188 binary-indep:
189         # We have nothing to do by default.
190
191 # Build architecture-dependent files here.
192 binary-arch: build install
193         ln -s $(CURDIR)/debian/ngircd.default \
194          $(CURDIR)/debian/ngircd-full.default
195         ln -s $(CURDIR)/debian/ngircd.init \
196          $(CURDIR)/debian/ngircd-full.init
197         ln -s $(CURDIR)/debian/ngircd.postinst \
198          $(CURDIR)/debian/ngircd-full.postinst
199
200         ln -s $(CURDIR)/debian/ngircd.default \
201          $(CURDIR)/debian/ngircd-full-dbg.default
202         ln -s $(CURDIR)/debian/ngircd.init \
203          $(CURDIR)/debian/ngircd-full-dbg.init
204         ln -s $(CURDIR)/debian/ngircd.postinst \
205          $(CURDIR)/debian/ngircd-full-dbg.postinst
206
207         dh_testdir
208         dh_testroot
209         dh_installchangelogs -a -A ChangeLog
210         dh_installdocs -a
211         dh_installinit -a
212         dh_strip -a --no-package=ngircd-full-dbg
213         dh_compress -a
214         dh_fixperms -a
215         dh_installdeb -a
216         dh_shlibdeps -a
217         dh_gencontrol -a
218         dh_md5sums -a
219         dh_builddeb -a
220
221 binary: binary-indep binary-arch
222
223 .PHONY: build clean binary-indep binary-arch binary install 
224
225 # -eof-