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