debian/rules: whitespace fixes
[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 \
57           --enable-ipv6
58
59 build:
60         dh_clean -k
61
62 build-ngircd: build-stamp-ngircd
63 build-stamp-ngircd: configure-ngircd
64         dh_testdir
65         rm -f build-stamp-*
66
67         # Add here commands to compile the "standard" package:
68         $(MAKE)
69
70         touch build-stamp-ngircd
71
72 build-ngircd-full: build-stamp-ngircd-full
73 build-stamp-ngircd-full: configure-ngircd-full
74         dh_testdir
75         rm -f build-stamp-*
76
77         # Add here commands to compile the "full" package:
78         $(MAKE)
79         
80         touch build-stamp-ngircd-full
81
82 clean:
83         dh_testdir
84         dh_testroot
85         rm -f build-stamp*
86         rm -f $(CURDIR)/debian/ngircd-full.default
87         rm -f $(CURDIR)/debian/ngircd-full.init
88         rm -f $(CURDIR)/debian/ngircd-full.postinst
89         
90         # Add here commands to clean up after the build process:
91         [ ! -f Makefile ] || $(MAKE) distclean
92
93 ifneq "$(wildcard /usr/share/misc/config.sub)" ""
94         cp -f /usr/share/misc/config.sub config.sub
95 endif
96 ifneq "$(wildcard /usr/share/misc/config.guess)" ""
97         cp -f /usr/share/misc/config.guess config.guess
98 endif
99         dh_clean
100
101 install: install-ngircd install-ngircd-full
102
103 install-ngircd: build-ngircd
104         dh_testdir
105         dh_testroot
106         dh_installdirs
107
108         # Add here commands to install the "standard" package into debian/ngircd:
109         $(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd
110         rm $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/INSTALL*
111         rm $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/COPYING*
112         mkdir -p $(CURDIR)/debian/ngircd/var/run/ircd
113         cat $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/sample-ngircd.conf | \
114          sed -e "s/;ServerUID = 65534/ServerUID = irc/g" | \
115          sed -e "s/;ServerGID = 65534/ServerGID = irc/g" | \
116          sed -e "s/;MotdFile = \/usr\/local\/etc\/ngircd.motd/MotdFile = \/etc\/ngircd\/ngircd.motd/g" | \
117          sed -e "s/;PidFile = \/var\/run\/ngircd\/ngircd.pid/PidFile = \/var\/run\/ircd\/ngircd.pid/g" \
118          >$(CURDIR)/debian/ngircd/etc/ngircd/ngircd.conf
119         touch $(CURDIR)/debian/ngircd/etc/ngircd/ngircd.motd
120
121 install-ngircd-full: build-ngircd-full
122         dh_testdir
123         dh_testroot
124         dh_installdirs
125
126         # Add here commands to install the "full" package into debian/ngircd-full:
127         $(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd-full
128         rm $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd/INSTALL*
129         rm $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd/COPYING*
130         mv $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd \
131          $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd-full
132         mkdir -p $(CURDIR)/debian/ngircd-full/var/run/ircd
133         cat $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd-full/sample-ngircd.conf | \
134          sed -e "s/;ServerUID = 65534/ServerUID = irc/g" | \
135          sed -e "s/;ServerGID = 65534/ServerGID = irc/g" | \
136          sed -e "s/;MotdFile = \/usr\/local\/etc\/ngircd.motd/MotdFile = \/etc\/ngircd\/ngircd.motd/g" | \
137          sed -e "s/;PidFile = \/var\/run\/ngircd\/ngircd.pid/PidFile = \/var\/run\/ircd\/ngircd.pid/g" \
138          >$(CURDIR)/debian/ngircd-full/etc/ngircd/ngircd.conf
139         touch $(CURDIR)/debian/ngircd-full/etc/ngircd/ngircd.motd
140
141 # Build architecture-independent files here.
142 binary-indep:
143         # We have nothing to do by default.
144
145 # Build architecture-dependent files here.
146 binary-arch: build install
147         ln -s $(CURDIR)/debian/ngircd.default \
148          $(CURDIR)/debian/ngircd-full.default
149         ln -s $(CURDIR)/debian/ngircd.init \
150          $(CURDIR)/debian/ngircd-full.init
151         ln -s $(CURDIR)/debian/ngircd.postinst \
152          $(CURDIR)/debian/ngircd-full.postinst
153         
154         dh_testdir
155         dh_testroot
156         dh_installchangelogs -a -A ChangeLog
157         dh_installdocs -a
158         dh_installinit -a
159         dh_strip -a
160         dh_compress -a
161         dh_fixperms -a
162         dh_installdeb -a
163         dh_shlibdeps -a
164         dh_gencontrol -a
165         dh_md5sums -a
166         dh_builddeb -a
167
168 binary: binary-indep binary-arch
169
170 .PHONY: build clean binary-indep binary-arch binary install 
171
172 # -eof-