]> git.llucax.com Git - software/mutt-debian.git/blob - debian/rules
Move Mutt with NNTP support to mutt-nntp package
[software/mutt-debian.git] / debian / rules
1 #!/usr/bin/make -f
2
3 include /usr/share/quilt/quilt.make
4 QUILT = QUILT_PATCHES=$(QUILT_PATCH_DIR) quilt --quiltrc /dev/null
5
6 ###################### user serviceable parts ######################
7
8 ###
9 # build a separate mutt-nntp package?
10 BUILD_NNTP := yes
11 # build a separate mutt-patched package?
12 BUILD_PATCHED := yes
13 ###
14 # header cache backend
15 # HCACHE_DB := bdb
16 # HCACHE_DB := gdbm
17 # HCACHE_DB := qdbm
18 HCACHE_DB := tokyocabinet
19 ###
20 # GPGME backend
21 GPGME := --enable-gpgme
22 ###
23
24 ###################### variables ######################
25
26 ifneq ($(BUILD_NNTP),yes)
27 export DH_OPTIONS += -Nmutt-nntp
28 endif
29
30 ifneq ($(BUILD_PATCHED),yes)
31 export DH_OPTIONS += -Nmutt-patched
32 endif
33
34 # Configure arguments
35
36 ifeq ($(HCACHE_DB),bdb)
37     hcache_db := --without-gdbm --without-qdbm --without-tokyocabinet
38 endif
39 ifeq ($(HCACHE_DB),gdbm)
40     hcache_db := --without-qdbm --without-bdb --without-tokyocabinet
41 endif
42 ifeq ($(HCACHE_DB),qdbm)
43     hcache_db := --without-gdbm --without-bdb --without-tokyocabinet
44 endif
45 ifeq ($(HCACHE_DB),tokyocabinet)
46     hcache_db := --without-gdbm --without-bdb --without-qdbm
47     ifeq ($(shell dpkg --print-architecture),hurd-i386)
48         hcache_db := --without-bdb --without-qdbm
49     endif
50 endif
51
52 confflags =     --prefix=/usr                   \
53                 --sysconfdir=/etc               \
54                 --mandir=/usr/share/man         \
55                 --with-sharedir=/usr/share/mutt \
56                 --with-docdir=/usr/share/doc    \
57                 --with-mailpath=/var/mail       \
58                                                 \
59                 --disable-dependency-tracking   \
60                                                 \
61                 --enable-compressed             \
62                 --enable-debug                  \
63                 --enable-fcntl                  \
64                 --enable-hcache                 \
65                 $(GPGME)                        \
66                 --enable-imap                   \
67                 --enable-smtp                   \
68                 --enable-inodesort              \
69                 --enable-pop                    \
70                                                 \
71                 --with-curses                   \
72                 --with-gnutls                   \
73                 --with-gss                      \
74                 --with-idn                      \
75                 --with-mixmaster                \
76                 --with-sasl                     \
77                                                 \
78                 $(hcache_db)
79
80 DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
81 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
82 confflags += --build $(DEB_BUILD_GNU_TYPE)
83 # Only specify --host when cross-compiling
84 ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
85     confflags += --host $(DEB_HOST_GNU_TYPE)
86 endif
87
88 # CFLAGS
89 CFLAGS   = -Wall -g
90 CPPFLAGS = -I/usr/include/qdbm
91 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
92         CFLAGS += -O0
93 else
94         CFLAGS += -O2
95 endif
96
97 # Directory to make the build on
98 objdir = $(CURDIR)/obj-$(DEB_HOST_GNU_TYPE)
99
100 ###################### main ######################
101
102 $(objdir)-nntp/build-stamp: $(QUILT_STAMPFN)
103         dh_testdir
104         dh_clean
105         -mkdir $(objdir)-nntp
106
107 ifeq ($(BUILD_NNTP),yes)
108         ###################### building mutt-nntp ######################
109         $(QUILT) applied > PATCHES
110         autoreconf --install --include=m4
111         cd $(objdir)-nntp && \
112         env CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
113         ../configure --enable-nntp $(confflags)
114
115         echo '#include "config-debian.h"' >> $(objdir)-nntp/config.h
116
117         # we should just "make mutt" here, but that doesn't work yet
118         cd $(objdir)-nntp && $(MAKE) CFLAGS="$(CFLAGS)"
119 endif
120
121         touch $@
122
123 $(objdir)-patched/build-stamp: $(objdir)-nntp/build-stamp
124         dh_testdir
125         dh_clean
126         -mkdir $(objdir)-patched
127
128 ifeq ($(BUILD_PATCHED),yes)
129         ###################### building mutt-patched ######################
130         $(QUILT) pop mutt.patched
131         $(QUILT) applied > PATCHES
132         autoreconf --install --include=m4
133         cd $(objdir)-patched && \
134         env CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
135         ../configure $(confflags)
136
137         echo '#include "config-debian.h"' >> $(objdir)-patched/config.h
138
139         # we should just "make mutt" here, but that doesn't work yet
140         cd $(objdir)-patched && $(MAKE) CFLAGS="$(CFLAGS)"
141 endif
142
143         touch $@
144
145 build build-arch: $(objdir)/build-stamp
146 $(objdir)/build-stamp: $(objdir)-patched/build-stamp
147         ###################### building mutt ######################
148         $(QUILT) pop mutt.org
149         $(QUILT) applied > PATCHES
150         
151         autoreconf --install --include=m4
152         -mkdir $(objdir)
153         cd $(objdir) && \
154         env CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
155         ../configure $(confflags)
156         
157         echo '#include "config-debian.h"' >>$(objdir)/config.h
158         
159         cd $(objdir) && $(MAKE) CFLAGS="$(CFLAGS)"
160         
161         touch $@
162
163 install: build
164         ###################### install ######################
165         dh_testdir
166         dh_testroot
167         dh_prep
168         cd $(objdir) && $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
169         
170         cd debian/tmp/usr/share/doc && \
171         rm -rf samples/iconv samples/ca-bundle.crt && \
172         mv NEWS NEWS.old && \
173         cp $(CURDIR)/UPDATING NEWS
174         
175         chmod +x debian/extra/lib/*
176         chmod +x debian/header.awk
177         debian/header.awk debian/patches/features/* \
178                 debian/patches/mutt-patched/* > debian/tmp/README.Patches
179         
180         ( sed -e '/## More settings/,$$d' $(objdir)/doc/Muttrc || exit 1 ; \
181           cat debian/extra/rc/Muttrc.foot ) > debian/tmp/Muttrc
182         
183         ( echo "# GnuPG configuration"; \
184           grep '^set' contrib/gpg.rc; \
185           echo ) > debian/tmp/gpg.rc
186         
187         dh_install
188         
189         # prepare files for update-alternatives
190         mv debian/mutt/usr/bin/mutt debian/mutt/usr/bin/mutt-org
191 ifeq ($(BUILD_PATCHED),yes)
192         install -D $(objdir)-patched/mutt debian/mutt-patched/usr/bin/mutt-patched
193 endif
194 ifeq ($(BUILD_NNTP),yes)
195         install -D $(objdir)-nntp/mutt debian/mutt-nntp/usr/bin/mutt-nntp
196 endif
197         
198         # reportbug driver
199         dh_installdirs
200         install -m644 debian/bug/control $(CURDIR)/debian/mutt/usr/share/bug/mutt
201         install       debian/bug/script  $(CURDIR)/debian/mutt/usr/share/bug/mutt
202
203 binary binary-arch: install
204         ###################### binary ######################
205         dh_installman
206         dh_installmenu
207         dh_installmime
208         dh_installdocs
209         dh_installexamples
210         dh_installchangelogs ChangeLog
211         -dh_lintian
212         
213         dh_strip --dbg-package=mutt-dbg
214         rm -rf $(CURDIR)/debian/mutt-dbg/usr/share/doc/mutt-dbg \
215                 $(CURDIR)/debian/mutt-patched/usr/share/doc/mutt-patched \
216                 $(CURDIR)/debian/mutt-nntp/usr/share/doc/mutt-nntp
217         
218         dh_link
219         dh_compress --exclude usr/share/doc/mutt/README.Patches
220         dh_fixperms --exclude usr/bin/mutt_dotlock
221         dh_installdeb
222         dh_shlibdeps
223         dh_gencontrol
224         dh_md5sums
225         dh_builddeb
226
227 build-indep binary-indep:
228         @echo "Nothing to do."
229
230 clean: unpatch
231         ###################### clean ######################
232         dh_testdir
233         dh_testroot
234         
235         # please dpkg-source
236         rm -f po/*.gmo
237         echo -n > PATCHES
238         
239         # remove build trees
240         rm -rf $(objdir) $(objdir)-patched $(objdir)-nntp
241         
242         # remove autotool-generated files so they don't show up in the diff.gz
243         rm -f configure config.h.in
244         rm -f Makefile.in contrib/Makefile.in imap/Makefile.in doc/Makefile.in m4/Makefile.in
245         
246         dh_clean
247
248 .PHONY: configure build build-arch build-indep clean install binary binary-arch binary-indep patch