3 include /usr/share/quilt/quilt.make
5 ###################### user serviceable parts ######################
8 # build a separate mutt-patched package?
9 #BUILD_PATCHED := yes -- disabled until there is a sidebar patch for 1.5.19
11 # header cache backend
17 # GPGME := --enable-gpgme
20 ###################### variables ######################
22 ifneq ($(BUILD_PATCHED),yes)
23 export DH_OPTIONS := -Nmutt-patched
28 ifeq ($(HCACHE_DB),bdb)
29 hcache_db := --without-gdbm --without-qdbm
31 ifeq ($(HCACHE_DB),gdbm)
32 hcache_db := --without-qdbm --without-bdb
34 ifeq ($(HCACHE_DB),qdbm)
35 hcache_db := --without-gdbm --without-bdb
38 confflags = --prefix=/usr \
40 --mandir=/usr/share/man \
41 --with-sharedir=/usr/share/mutt \
42 --with-docdir=/usr/share/doc \
43 --with-mailpath=/var/mail \
45 --disable-dependency-tracking \
66 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
67 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
68 confflags += --build $(DEB_BUILD_GNU_TYPE)
69 # Only specify --host when cross-compiling
70 ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
71 confflags += --host $(DEB_HOST_GNU_TYPE)
76 CPPFLAGS = -I/usr/include/qdbm
77 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
83 # Directory to make the build on
84 objdir = $(CURDIR)/obj-$(DEB_HOST_GNU_TYPE)
86 ###################### main ######################
88 $(objdir)-patched/build-stamp: $(QUILT_STAMPFN)
91 -mkdir $(objdir)-patched
93 ifeq ($(BUILD_PATCHED),yes)
94 ###################### building mutt-patched ######################
95 autoreconf --install --include=m4
96 cd $(objdir)-patched && \
97 env CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
98 ../configure $(confflags)
100 echo '#include "config-debian.h"' >> $(objdir)-patched/config.h
102 # we should just "make mutt" here, but that doesn't work yet
103 cd $(objdir)-patched && $(MAKE) CFLAGS="$(CFLAGS)"
108 build build-arch: $(objdir)/build-stamp
109 $(objdir)/build-stamp: $(objdir)-patched/build-stamp
110 ###################### building mutt ######################
111 QUILT_PATCHES=$(QUILT_PATCH_DIR) quilt --quiltrc /dev/null pop mutt.org
113 autoreconf --install --include=m4
116 env CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
117 ../configure $(confflags)
119 echo '#include "config-debian.h"' >>$(objdir)/config.h
121 cd $(objdir) && $(MAKE) CFLAGS="$(CFLAGS)"
126 ###################### install ######################
130 cd $(objdir) && $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
132 cd debian/tmp/usr/share/doc && \
133 rm -rf samples/iconv samples/ca-bundle.crt && \
134 mv NEWS NEWS.old && \
135 cp $(CURDIR)/UPDATING NEWS
137 chmod +x debian/extra/lib/*
138 chmod +x debian/header.awk
139 debian/header.awk debian/patches/features/* \
140 debian/patches/mutt-patched/* > debian/tmp/README.Patches
142 ( sed -e '/## More settings/,$$d' $(objdir)/doc/Muttrc || exit 1 ; \
143 cat debian/extra/rc/Muttrc.foot ) > debian/tmp/Muttrc
145 ( echo "# GnuPG configuration"; \
146 grep '^set' contrib/gpg.rc; \
147 echo ) > debian/tmp/gpg.rc
149 ifeq ($(BUILD_PATCHED),yes)
150 # temporarily call the binary mutt-patched so dh_strip gets the debug file name right
151 install -D $(objdir)-patched/mutt debian/mutt-patched/usr/bin/mutt-patched
156 install -m644 debian/bug/control $(CURDIR)/debian/mutt/usr/share/bug/mutt
157 install debian/bug/script $(CURDIR)/debian/mutt/usr/share/bug/mutt
159 binary binary-arch: install
160 ###################### binary ######################
167 dh_installchangelogs ChangeLog
170 dh_strip --dbg-package=mutt-dbg
171 rm -rf $(CURDIR)/debian/mutt-dbg/usr/share/doc/mutt-dbg \
172 $(CURDIR)/debian/mutt-patched/usr/share/doc/mutt-patched
173 ifeq ($(BUILD_PATCHED),yes)
174 mv debian/mutt-patched/usr/bin/mutt-patched debian/mutt-patched/usr/bin/mutt
178 dh_compress --exclude usr/share/doc/mutt/README.Patches
179 dh_fixperms --exclude usr/bin/mutt_dotlock
186 build-indep binary-indep:
187 @echo "Nothing to do."
190 ###################### clean ######################
199 rm -rf $(objdir) $(objdir)-patched
201 # remove autotool-generated files so they don't show up in the diff.gz
202 rm -f configure config.h.in
203 rm -f Makefile.in contrib/Makefile.in imap/Makefile.in doc/Makefile.in m4/Makefile.in
205 # clean PATCHES hunks (blame quilt refresh)
206 for p in `grep -rl PATCHES debian/patches` ; do perl -wi debian/fix-PATCHES.pl $$p ; done
210 .PHONY: configure build build-arch build-indep clean install binary binary-arch binary-indep patch