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