]> git.llucax.com Git - software/mutt-debian.git/blob - debian/rules
Update: features/compressed-folders: Remove redundant comment in /etc/Muttrc. (Closes...
[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-patched package?
10 BUILD_PATCHED := yes
11 ###
12 # header cache backend
13 # HCACHE_DB := bdb
14 # HCACHE_DB := gdbm
15 # HCACHE_DB := qdbm
16 HCACHE_DB := tokyocabinet
17 ###
18 # GPGME backend
19 GPGME := --enable-gpgme
20 ###
21
22 ###################### variables ######################
23
24 ifneq ($(BUILD_PATCHED),yes)
25 export DH_OPTIONS := -Nmutt-patched
26 endif
27
28 # Configure arguments
29
30 ifeq ($(HCACHE_DB),bdb)
31     hcache_db := --without-gdbm --without-qdbm --without-tokyocabinet
32 endif
33 ifeq ($(HCACHE_DB),gdbm)
34     hcache_db := --without-qdbm --without-bdb --without-tokyocabinet
35 endif
36 ifeq ($(HCACHE_DB),qdbm)
37     hcache_db := --without-gdbm --without-bdb --without-tokyocabinet
38 endif
39 ifeq ($(HCACHE_DB),tokyocabinet)
40     hcache_db := --without-gdbm --without-bdb --without-qdbm
41 endif
42
43 confflags =     --prefix=/usr                   \
44                 --sysconfdir=/etc               \
45                 --mandir=/usr/share/man         \
46                 --with-sharedir=/usr/share/mutt \
47                 --with-docdir=/usr/share/doc    \
48                 --with-mailpath=/var/mail       \
49                                                 \
50                 --disable-dependency-tracking   \
51                                                 \
52                 --enable-compressed             \
53                 --enable-debug                  \
54                 --enable-fcntl                  \
55                 --enable-hcache                 \
56                 $(GPGME)                        \
57                 --enable-imap                   \
58                 --enable-smtp                   \
59                 --enable-inodesort              \
60                 --enable-pop                    \
61                                                 \
62                 --with-curses                   \
63                 --with-gnutls                   \
64                 --with-gss                      \
65                 --with-idn                      \
66                 --with-mixmaster                \
67                 --with-sasl                     \
68                                                 \
69                 $(hcache_db)
70
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)
77 endif
78
79 # CFLAGS
80 CFLAGS   = -Wall -g
81 CPPFLAGS = -I/usr/include/qdbm
82 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
83         CFLAGS += -O0
84 else
85         CFLAGS += -O2
86 endif
87
88 # Directory to make the build on
89 objdir = $(CURDIR)/obj-$(DEB_HOST_GNU_TYPE)
90
91 ###################### main ######################
92
93 $(objdir)-patched/build-stamp: $(QUILT_STAMPFN)
94         dh_testdir
95         dh_clean
96         -mkdir $(objdir)-patched
97         
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)
105         
106         echo '#include "config-debian.h"' >> $(objdir)-patched/config.h
107         
108         # we should just "make mutt" here, but that doesn't work yet
109         cd $(objdir)-patched && $(MAKE) CFLAGS="$(CFLAGS)"
110 endif
111         
112         touch $@
113
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
119         
120         autoreconf --install --include=m4
121         -mkdir $(objdir)
122         cd $(objdir) && \
123         env CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
124         ../configure $(confflags)
125         
126         echo '#include "config-debian.h"' >>$(objdir)/config.h
127         
128         cd $(objdir) && $(MAKE) CFLAGS="$(CFLAGS)"
129         
130         touch $@
131
132 install: build
133         ###################### install ######################
134         dh_testdir
135         dh_testroot
136         dh_prep
137         cd $(objdir) && $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
138         
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
143         
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
148         
149         ( sed -e '/## More settings/,$$d' $(objdir)/doc/Muttrc || exit 1 ; \
150           cat debian/extra/rc/Muttrc.foot ) > debian/tmp/Muttrc
151         
152         ( echo "# GnuPG configuration"; \
153           grep '^set' contrib/gpg.rc; \
154           echo ) > debian/tmp/gpg.rc
155         
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
159 endif
160         
161         # reportbug driver
162         dh_installdirs
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
165
166 binary binary-arch: install
167         ###################### binary ######################
168         dh_install
169         dh_installman
170         dh_installmenu
171         dh_installmime
172         dh_installdocs
173         dh_installexamples
174         dh_installchangelogs ChangeLog
175         -dh_lintian
176         
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
182 endif
183         
184         dh_link
185         dh_compress --exclude usr/share/doc/mutt/README.Patches
186         dh_fixperms --exclude usr/bin/mutt_dotlock
187         dh_installdeb
188         dh_shlibdeps
189         dh_gencontrol
190         dh_md5sums
191         dh_builddeb
192
193 build-indep binary-indep:
194         @echo "Nothing to do."
195
196 clean: unpatch
197         ###################### clean ######################
198         dh_testdir
199         dh_testroot
200         
201         # please dpkg-source
202         rm -f po/*.gmo
203         echo -n > PATCHES
204         
205         # remove build trees
206         rm -rf $(objdir) $(objdir)-patched
207         
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
211         
212         dh_clean
213
214 .PHONY: configure build build-arch build-indep clean install binary binary-arch binary-indep patch