3 include /usr/share/quilt/quilt.make
4 QUILT = QUILT_PATCHES=$(QUILT_PATCH_DIR) quilt --quiltrc /dev/null
6 ###################### user serviceable parts ######################
9 # build a separate mutt-nntp package?
11 # build a separate mutt-patched package?
14 # header cache backend
18 HCACHE_DB := tokyocabinet
21 GPGME := --enable-gpgme
24 ###################### variables ######################
26 ifneq ($(BUILD_NNTP),yes)
27 export DH_OPTIONS += -Nmutt-nntp
30 ifneq ($(BUILD_PATCHED),yes)
31 export DH_OPTIONS += -Nmutt-patched
36 ifeq ($(HCACHE_DB),bdb)
37 hcache_db := --without-gdbm --without-qdbm --without-tokyocabinet
39 ifeq ($(HCACHE_DB),gdbm)
40 hcache_db := --without-qdbm --without-bdb --without-tokyocabinet
42 ifeq ($(HCACHE_DB),qdbm)
43 hcache_db := --without-gdbm --without-bdb --without-tokyocabinet
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
52 confflags = --prefix=/usr \
54 --mandir=/usr/share/man \
55 --with-sharedir=/usr/share/mutt \
56 --with-docdir=/usr/share/doc \
57 --with-mailpath=/var/mail \
59 --disable-dependency-tracking \
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)
90 CPPFLAGS = -I/usr/include/qdbm
91 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
97 # Directory to make the build on
98 objdir = $(CURDIR)/obj-$(DEB_HOST_GNU_TYPE)
100 ###################### main ######################
102 $(objdir)-nntp/build-stamp: $(QUILT_STAMPFN)
105 -mkdir $(objdir)-nntp
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)
115 echo '#include "config-debian.h"' >> $(objdir)-nntp/config.h
117 # we should just "make mutt" here, but that doesn't work yet
118 cd $(objdir)-nntp && $(MAKE) CFLAGS="$(CFLAGS)"
123 $(objdir)-patched/build-stamp: $(objdir)-nntp/build-stamp
126 -mkdir $(objdir)-patched
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)
137 echo '#include "config-debian.h"' >> $(objdir)-patched/config.h
139 # we should just "make mutt" here, but that doesn't work yet
140 cd $(objdir)-patched && $(MAKE) CFLAGS="$(CFLAGS)"
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
151 autoreconf --install --include=m4
154 env CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
155 ../configure $(confflags)
157 echo '#include "config-debian.h"' >>$(objdir)/config.h
159 cd $(objdir) && $(MAKE) CFLAGS="$(CFLAGS)"
164 ###################### install ######################
168 cd $(objdir) && $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
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
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
180 ( sed -e '/## More settings/,$$d' $(objdir)/doc/Muttrc || exit 1 ; \
181 cat debian/extra/rc/Muttrc.foot ) > debian/tmp/Muttrc
183 ( echo "# GnuPG configuration"; \
184 grep '^set' contrib/gpg.rc; \
185 echo ) > debian/tmp/gpg.rc
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
194 ifeq ($(BUILD_NNTP),yes)
195 install -D $(objdir)-nntp/mutt debian/mutt-nntp/usr/bin/mutt-nntp
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
203 binary binary-arch: install
204 ###################### binary ######################
210 dh_installchangelogs ChangeLog
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
219 dh_compress --exclude usr/share/doc/mutt/README.Patches
220 dh_fixperms --exclude usr/bin/mutt_dotlock
227 build-indep binary-indep:
228 @echo "Nothing to do."
231 ###################### clean ######################
240 rm -rf $(objdir) $(objdir)-patched $(objdir)-nntp
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
248 .PHONY: configure build build-arch build-indep clean install binary binary-arch binary-indep patch