3 include /usr/share/quilt/quilt.make
5 ###################### user serviceable parts ######################
8 # build a separate mutt-patched package?
11 # header cache backend
15 # HCACHE_DB := tokyocabinet
18 GPGME := --enable-gpgme
21 ###################### variables ######################
23 ifneq ($(BUILD_PATCHED),yes)
24 export DH_OPTIONS := -Nmutt-patched
29 ifeq ($(HCACHE_DB),bdb)
30 hcache_db := --without-gdbm --without-qdbm --without-tokyocabinet
32 ifeq ($(HCACHE_DB),gdbm)
33 hcache_db := --without-qdbm --without-bdb --without-tokyocabinet
35 ifeq ($(HCACHE_DB),qdbm)
36 hcache_db := --without-gdbm --without-bdb --without-tokyocabinet
38 ifeq ($(HCACHE_DB),tokyocabinet)
39 hcache_db := --without-gdbm --without-bdb --without-qdbm
42 confflags = --prefix=/usr \
44 --mandir=/usr/share/man \
45 --with-sharedir=/usr/share/mutt \
46 --with-docdir=/usr/share/doc \
47 --with-mailpath=/var/mail \
49 --disable-dependency-tracking \
70 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
71 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
72 confflags += --build $(DEB_BUILD_GNU_TYPE)
73 # Only specify --host when cross-compiling
74 ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
75 confflags += --host $(DEB_HOST_GNU_TYPE)
80 CPPFLAGS = -I/usr/include/qdbm
81 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
87 # Directory to make the build on
88 objdir = $(CURDIR)/obj-$(DEB_HOST_GNU_TYPE)
90 ###################### main ######################
92 $(objdir)-patched/build-stamp: $(QUILT_STAMPFN)
95 -mkdir $(objdir)-patched
97 ifeq ($(BUILD_PATCHED),yes)
98 ###################### building mutt-patched ######################
99 autoreconf --install --include=m4
100 cd $(objdir)-patched && \
101 env CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
102 ../configure $(confflags)
104 echo '#include "config-debian.h"' >> $(objdir)-patched/config.h
106 # we should just "make mutt" here, but that doesn't work yet
107 cd $(objdir)-patched && $(MAKE) CFLAGS="$(CFLAGS)"
112 build build-arch: $(objdir)/build-stamp
113 $(objdir)/build-stamp: $(objdir)-patched/build-stamp
114 ###################### building mutt ######################
115 QUILT_PATCHES=$(QUILT_PATCH_DIR) quilt --quiltrc /dev/null pop mutt.org
117 autoreconf --install --include=m4
120 env CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
121 ../configure $(confflags)
123 echo '#include "config-debian.h"' >>$(objdir)/config.h
125 cd $(objdir) && $(MAKE) CFLAGS="$(CFLAGS)"
130 ###################### install ######################
134 cd $(objdir) && $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
136 cd debian/tmp/usr/share/doc && \
137 rm -rf samples/iconv samples/ca-bundle.crt && \
138 mv NEWS NEWS.old && \
139 cp $(CURDIR)/UPDATING NEWS
141 chmod +x debian/extra/lib/*
142 chmod +x debian/header.awk
143 debian/header.awk debian/patches/features/* \
144 debian/patches/mutt-patched/* > debian/tmp/README.Patches
146 ( sed -e '/## More settings/,$$d' $(objdir)/doc/Muttrc || exit 1 ; \
147 cat debian/extra/rc/Muttrc.foot ) > debian/tmp/Muttrc
149 ( echo "# GnuPG configuration"; \
150 grep '^set' contrib/gpg.rc; \
151 echo ) > debian/tmp/gpg.rc
153 ifeq ($(BUILD_PATCHED),yes)
154 # temporarily call the binary mutt-patched so dh_strip gets the debug file name right
155 install -D $(objdir)-patched/mutt debian/mutt-patched/usr/bin/mutt-patched
160 install -m644 debian/bug/control $(CURDIR)/debian/mutt/usr/share/bug/mutt
161 install debian/bug/script $(CURDIR)/debian/mutt/usr/share/bug/mutt
163 binary binary-arch: install
164 ###################### binary ######################
171 dh_installchangelogs ChangeLog
174 dh_strip --dbg-package=mutt-dbg
175 rm -rf $(CURDIR)/debian/mutt-dbg/usr/share/doc/mutt-dbg \
176 $(CURDIR)/debian/mutt-patched/usr/share/doc/mutt-patched
177 ifeq ($(BUILD_PATCHED),yes)
178 mv debian/mutt-patched/usr/bin/mutt-patched debian/mutt-patched/usr/bin/mutt
182 dh_compress --exclude usr/share/doc/mutt/README.Patches
183 dh_fixperms --exclude usr/bin/mutt_dotlock
190 build-indep binary-indep:
191 @echo "Nothing to do."
194 ###################### clean ######################
203 rm -rf $(objdir) $(objdir)-patched
205 # remove autotool-generated files so they don't show up in the diff.gz
206 rm -f configure config.h.in
207 rm -f Makefile.in contrib/Makefile.in imap/Makefile.in doc/Makefile.in m4/Makefile.in
209 # clean PATCHES hunks (blame quilt refresh)
210 for p in `grep -rl PATCHES debian/patches` ; do perl -wi debian/fix-PATCHES.pl $$p ; done
214 .PHONY: configure build build-arch build-indep clean install binary binary-arch binary-indep patch