Xcode: remove imp.h and exp.h from project file
[ngircd-alex.git] / contrib / Debian / rules
1 #!/usr/bin/make -f
2 #
3 # ngIRCd -- The Next Generation IRC Daemon
4 # Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors
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-iconv --with-ident --with-tcp-wrappers \
57           --with-pam \
58           --enable-ipv6
59
60 configure-ngircd-full-dbg: configure
61         dh_testdir
62
63         # configure "full debug" variant:
64         ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
65           --prefix=/usr \
66           --sysconfdir=/etc/ngircd \
67           --mandir=\$${prefix}/share/man \
68           --enable-debug --enable-sniffer \
69           --with-syslog --with-zlib \
70           --with-gnutls --with-iconv --with-ident --with-tcp-wrappers \
71           --with-pam \
72           --enable-ipv6
73
74 build:
75         dh_clean -k
76
77 build-ngircd: build-stamp-ngircd
78 build-stamp-ngircd: configure-ngircd
79         dh_testdir
80         rm -f build-stamp-*
81
82         # Add here commands to compile the "standard" package:
83         $(MAKE)
84
85         touch build-stamp-ngircd
86
87 build-ngircd-full: build-stamp-ngircd-full
88 build-stamp-ngircd-full: configure-ngircd-full
89         dh_testdir
90         rm -f build-stamp-*
91
92         # Add here commands to compile the "full" package:
93         $(MAKE)
94
95         touch build-stamp-ngircd-full
96
97 build-ngircd-full-dbg: build-stamp-ngircd-full-dbg
98 build-stamp-ngircd-full-dbg: configure-ngircd-full-dbg
99         dh_testdir
100         rm -f build-stamp-*
101
102         # Add here commands to compile the "full debug" package:
103         $(MAKE)
104
105         touch build-stamp-ngircd-full
106
107 clean:
108         dh_testdir
109         dh_testroot
110         rm -f build-stamp*
111         rm -f $(CURDIR)/debian/ngircd-full.default
112         rm -f $(CURDIR)/debian/ngircd-full.init
113         rm -f $(CURDIR)/debian/ngircd-full.postinst
114         rm -f $(CURDIR)/debian/ngircd-full-dbg.default
115         rm -f $(CURDIR)/debian/ngircd-full-dbg.postinst
116         rm -f $(CURDIR)/debian/ngircd-full-dbg.init
117
118         # Add here commands to clean up after the build process:
119         [ ! -f Makefile ] || $(MAKE) distclean
120
121 ifneq "$(wildcard /usr/share/misc/config.sub)" ""
122         cp -f /usr/share/misc/config.sub config.sub
123 endif
124 ifneq "$(wildcard /usr/share/misc/config.guess)" ""
125         cp -f /usr/share/misc/config.guess config.guess
126 endif
127         dh_clean
128
129 install: install-ngircd install-ngircd-full install-ngircd-full-dbg
130
131 install-ngircd: build-ngircd
132         dh_testdir
133         dh_testroot
134         dh_installdirs
135
136         # Add here commands to install the "standard" package into debian/ngircd:
137         $(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd
138         rm $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/INSTALL*
139         rm $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/COPYING*
140         mkdir -p $(CURDIR)/debian/ngircd/var/run/ircd
141         cat $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/sample-ngircd.conf | \
142          sed -e "s|;ServerUID = 65534|ServerUID = irc|g" | \
143          sed -e "s|;ServerGID = 65534|ServerGID = irc|g" | \
144          sed -e "s|;MotdFile = /usr/local/etc/ngircd.motd|MotdFile = |/etc/ngircd/ngircd.motd|g" | \
145          sed -e "s|;PidFile = /var/run/ngircd/ngircd.pid|PidFile = /var/run/ircd/ngircd.pid|g" \
146          >$(CURDIR)/debian/ngircd/etc/ngircd/ngircd.conf
147         touch $(CURDIR)/debian/ngircd/etc/ngircd/ngircd.motd
148
149 install-ngircd-full: build-ngircd-full
150         dh_testdir
151         dh_testroot
152         dh_installdirs
153
154         # Add here commands to install the "full" package into debian/ngircd-full:
155         $(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd-full
156         rm $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd/INSTALL*
157         rm $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd/COPYING*
158         mv $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd \
159          $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd-full
160         mkdir -p $(CURDIR)/debian/ngircd-full/var/run/ircd
161         cat $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd-full/sample-ngircd.conf | \
162          sed -e "s|;ServerUID = 65534|ServerUID = irc|g" | \
163          sed -e "s|;ServerGID = 65534|ServerGID = irc|g" | \
164          sed -e "s|;MotdFile = /usr/local/etc/ngircd.motd|MotdFile = /etc/ngircd/ngircd.motd|g" | \
165          sed -e "s|;HelpFile = /usr/share/doc/ngircd/Commands.txt|HelpFile = /usr/share/doc/ngircd-full/Commands.txt|g" | \
166          sed -e "s|;PidFile = /var/run/ngircd/ngircd.pid|PidFile = /var/run/ircd/ngircd.pid|g" \
167          >$(CURDIR)/debian/ngircd-full/etc/ngircd/ngircd.conf
168         touch $(CURDIR)/debian/ngircd-full/etc/ngircd/ngircd.motd
169         mkdir -p $(CURDIR)/debian/ngircd-full/etc/pam.d
170         cp $(CURDIR)/debian/ngircd.pam $(CURDIR)/debian/ngircd-full/etc/pam.d/ngircd
171
172 install-ngircd-full-dbg: build-ngircd-full-dbg
173         dh_testdir
174         dh_testroot
175         dh_installdirs
176
177         # Add here commands to install the "full" package into debian/ngircd-full:
178         $(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd-full-dbg
179         rm $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd/INSTALL*
180         rm $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd/COPYING*
181         mv $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd \
182          $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd-full-dbg
183         mkdir -p $(CURDIR)/debian/ngircd-full-dbg/var/run/ircd
184         cat $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd-full-dbg/sample-ngircd.conf | \
185          sed -e "s|;ServerUID = 65534|ServerUID = irc|g" | \
186          sed -e "s|;ServerGID = 65534|ServerGID = irc|g" | \
187          sed -e "s|;MotdFile = /usr/local/etc/ngircd.motd|MotdFile = /etc/ngircd/ngircd.motd|g" | \
188          sed -e "s|;HelpFile = /usr/share/doc/ngircd/Commands.txt|HelpFile = /usr/share/doc/ngircd-full-dbg/Commands.txt|g" | \
189          sed -e "s|;PidFile = /var/run/ngircd/ngircd.pid|PidFile = /var/run/ircd/ngircd.pid|g" \
190          >$(CURDIR)/debian/ngircd-full-dbg/etc/ngircd/ngircd.conf
191         touch $(CURDIR)/debian/ngircd-full-dbg/etc/ngircd/ngircd.motd
192         mkdir -p $(CURDIR)/debian/ngircd-full-dbg/etc/pam.d
193         cp $(CURDIR)/debian/ngircd.pam $(CURDIR)/debian/ngircd-full-dbg/etc/pam.d/ngircd
194
195 # Build architecture-independent files here.
196 binary-indep:
197         # We have nothing to do by default.
198
199 # Build architecture-dependent files here.
200 binary-arch: build install
201         ln -s $(CURDIR)/debian/ngircd.default \
202          $(CURDIR)/debian/ngircd-full.default
203         ln -s $(CURDIR)/debian/ngircd.init \
204          $(CURDIR)/debian/ngircd-full.init
205         ln -s $(CURDIR)/debian/ngircd.postinst \
206          $(CURDIR)/debian/ngircd-full.postinst
207
208         ln -s $(CURDIR)/debian/ngircd.default \
209          $(CURDIR)/debian/ngircd-full-dbg.default
210         ln -s $(CURDIR)/debian/ngircd.init \
211          $(CURDIR)/debian/ngircd-full-dbg.init
212         ln -s $(CURDIR)/debian/ngircd.postinst \
213          $(CURDIR)/debian/ngircd-full-dbg.postinst
214
215         dh_testdir
216         dh_testroot
217         dh_installchangelogs -a -A ChangeLog
218         dh_installdocs -a
219         dh_installinit -a
220         dh_strip -a --no-package=ngircd-full-dbg
221         dh_compress -a -XCommands.txt
222         dh_fixperms -a
223         dh_installdeb -a
224         dh_shlibdeps -a
225         dh_gencontrol -a
226         dh_md5sums -a
227         dh_builddeb -a
228
229 binary: binary-indep binary-arch
230
231 .PHONY: build clean binary-indep binary-arch binary install 
232
233 # -eof-