868a04250a09d70d37a952c24d5cff545b268a3a
[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         mkdir -p $(CURDIR)/debian/ngircd-full/etc/pam.d
167         cp $(CURDIR)/debian/ngircd.pam $(CURDIR)/debian/ngircd-full/etc/pam.d/ngircd
168
169 install-ngircd-full-dbg: build-ngircd-full-dbg
170         dh_testdir
171         dh_testroot
172         dh_installdirs
173
174         # Add here commands to install the "full" package into debian/ngircd-full:
175         $(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd-full-dbg
176         rm $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd/INSTALL*
177         rm $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd/COPYING*
178         mv $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd \
179          $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd-full-dbg
180         mkdir -p $(CURDIR)/debian/ngircd-full-dbg/var/run/ircd
181         cat $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd-full-dbg/sample-ngircd.conf | \
182          sed -e "s/;ServerUID = 65534/ServerUID = irc/g" | \
183          sed -e "s/;ServerGID = 65534/ServerGID = irc/g" | \
184          sed -e "s/;MotdFile = \/usr\/local\/etc\/ngircd.motd/MotdFile = \/etc\/ngircd\/ngircd.motd/g" | \
185          sed -e "s/;PidFile = \/var\/run\/ngircd\/ngircd.pid/PidFile = \/var\/run\/ircd\/ngircd.pid/g" \
186          >$(CURDIR)/debian/ngircd-full-dbg/etc/ngircd/ngircd.conf
187         touch $(CURDIR)/debian/ngircd-full-dbg/etc/ngircd/ngircd.motd
188         mkdir -p $(CURDIR)/debian/ngircd-full-dbg/etc/pam.d
189         cp $(CURDIR)/debian/ngircd.pam $(CURDIR)/debian/ngircd-full-dbg/etc/pam.d/ngircd
190
191 # Build architecture-independent files here.
192 binary-indep:
193         # We have nothing to do by default.
194
195 # Build architecture-dependent files here.
196 binary-arch: build install
197         ln -s $(CURDIR)/debian/ngircd.default \
198          $(CURDIR)/debian/ngircd-full.default
199         ln -s $(CURDIR)/debian/ngircd.init \
200          $(CURDIR)/debian/ngircd-full.init
201         ln -s $(CURDIR)/debian/ngircd.postinst \
202          $(CURDIR)/debian/ngircd-full.postinst
203
204         ln -s $(CURDIR)/debian/ngircd.default \
205          $(CURDIR)/debian/ngircd-full-dbg.default
206         ln -s $(CURDIR)/debian/ngircd.init \
207          $(CURDIR)/debian/ngircd-full-dbg.init
208         ln -s $(CURDIR)/debian/ngircd.postinst \
209          $(CURDIR)/debian/ngircd-full-dbg.postinst
210
211         dh_testdir
212         dh_testroot
213         dh_installchangelogs -a -A ChangeLog
214         dh_installdocs -a
215         dh_installinit -a
216         dh_strip -a --no-package=ngircd-full-dbg
217         dh_compress -a
218         dh_fixperms -a
219         dh_installdeb -a
220         dh_shlibdeps -a
221         dh_gencontrol -a
222         dh_md5sums -a
223         dh_builddeb -a
224
225 binary: binary-indep binary-arch
226
227 .PHONY: build clean binary-indep binary-arch binary install 
228
229 # -eof-