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-patched package?
12 # header cache backend
16 HCACHE_DB := tokyocabinet
19 GPGME := --enable-gpgme
22 ###################### variables ######################
24 ifneq ($(BUILD_PATCHED),yes)
25 export DH_OPTIONS := -Nmutt-patched
30 ifeq ($(HCACHE_DB),bdb)
31 hcache_db := --without-gdbm --without-qdbm --without-tokyocabinet
33 ifeq ($(HCACHE_DB),gdbm)
34 hcache_db := --without-qdbm --without-bdb --without-tokyocabinet
36 ifeq ($(HCACHE_DB),qdbm)
37 hcache_db := --without-gdbm --without-bdb --without-tokyocabinet
39 ifeq ($(HCACHE_DB),tokyocabinet)
40 hcache_db := --without-gdbm --without-bdb --without-qdbm
43 confflags = --prefix=/usr \
45 --mandir=/usr/share/man \
46 --with-sharedir=/usr/share/mutt \
47 --with-docdir=/usr/share/doc \
48 --with-mailpath=/var/mail \
50 --disable-dependency-tracking \
71 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
72 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
73 confflags += --build $(DEB_BUILD_GNU_TYPE)
74 # Only specify --host when cross-compiling
75 ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
76 confflags += --host $(DEB_HOST_GNU_TYPE)
81 CPPFLAGS = -I/usr/include/qdbm
82 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
88 # Directory to make the build on
89 objdir = $(CURDIR)/obj-$(DEB_HOST_GNU_TYPE)
91 ###################### main ######################
93 $(objdir)-patched/build-stamp: $(QUILT_STAMPFN)
96 -mkdir $(objdir)-patched
98 ifeq ($(BUILD_PATCHED),yes)
99 ###################### building mutt-patched ######################
100 $(QUILT) applied > PATCHES
101 autoreconf --install --include=m4
102 cd $(objdir)-patched && \
103 env CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
104 ../configure $(confflags)
106 echo '#include "config-debian.h"' >> $(objdir)-patched/config.h
108 # we should just "make mutt" here, but that doesn't work yet
109 cd $(objdir)-patched && $(MAKE) CFLAGS="$(CFLAGS)"
114 build build-arch: $(objdir)/build-stamp
115 $(objdir)/build-stamp: $(objdir)-patched/build-stamp
116 ###################### building mutt ######################
117 $(QUILT) pop mutt.org
118 $(QUILT) applied > PATCHES
120 autoreconf --install --include=m4
123 env CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
124 ../configure $(confflags)
126 echo '#include "config-debian.h"' >>$(objdir)/config.h
128 cd $(objdir) && $(MAKE) CFLAGS="$(CFLAGS)"
133 ###################### install ######################
137 cd $(objdir) && $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
139 cd debian/tmp/usr/share/doc && \
140 rm -rf samples/iconv samples/ca-bundle.crt && \
141 mv NEWS NEWS.old && \
142 cp $(CURDIR)/UPDATING NEWS
144 chmod +x debian/extra/lib/*
145 chmod +x debian/header.awk
146 debian/header.awk debian/patches/features/* \
147 debian/patches/mutt-patched/* > debian/tmp/README.Patches
149 ( sed -e '/## More settings/,$$d' $(objdir)/doc/Muttrc || exit 1 ; \
150 cat debian/extra/rc/Muttrc.foot ) > debian/tmp/Muttrc
152 ( echo "# GnuPG configuration"; \
153 grep '^set' contrib/gpg.rc; \
154 echo ) > debian/tmp/gpg.rc
156 ifeq ($(BUILD_PATCHED),yes)
157 # temporarily call the binary mutt-patched so dh_strip gets the debug file name right
158 install -D $(objdir)-patched/mutt debian/mutt-patched/usr/bin/mutt-patched
163 install -m644 debian/bug/control $(CURDIR)/debian/mutt/usr/share/bug/mutt
164 install debian/bug/script $(CURDIR)/debian/mutt/usr/share/bug/mutt
166 binary binary-arch: install
167 ###################### binary ######################
174 dh_installchangelogs ChangeLog
177 dh_strip --dbg-package=mutt-dbg
178 rm -rf $(CURDIR)/debian/mutt-dbg/usr/share/doc/mutt-dbg \
179 $(CURDIR)/debian/mutt-patched/usr/share/doc/mutt-patched
180 ifeq ($(BUILD_PATCHED),yes)
181 mv debian/mutt-patched/usr/bin/mutt-patched debian/mutt-patched/usr/bin/mutt
185 dh_compress --exclude usr/share/doc/mutt/README.Patches
186 dh_fixperms --exclude usr/bin/mutt_dotlock
193 build-indep binary-indep:
194 @echo "Nothing to do."
197 ###################### clean ######################
206 rm -rf $(objdir) $(objdir)-patched
208 # remove autotool-generated files so they don't show up in the diff.gz
209 rm -f configure config.h.in
210 rm -f Makefile.in contrib/Makefile.in imap/Makefile.in doc/Makefile.in m4/Makefile.in
214 .PHONY: configure build build-arch build-indep clean install binary binary-arch binary-indep patch