]> git.llucax.com Git - software/mutt-debian.git/blob - debian/rules
Update and enable NNTP patch
[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     ifeq ($(shell dpkg --print-architecture),hurd-i386)
42         hcache_db := --without-bdb --without-qdbm
43     endif
44 endif
45
46 confflags =     --prefix=/usr                   \
47                 --sysconfdir=/etc               \
48                 --mandir=/usr/share/man         \
49                 --with-sharedir=/usr/share/mutt \
50                 --with-docdir=/usr/share/doc    \
51                 --with-mailpath=/var/mail       \
52                                                 \
53                 --disable-dependency-tracking   \
54                                                 \
55                 --enable-compressed             \
56                 --enable-debug                  \
57                 --enable-fcntl                  \
58                 --enable-hcache                 \
59                 $(GPGME)                        \
60                 --enable-imap                   \
61                 --enable-smtp                   \
62                 --enable-inodesort              \
63                 --enable-pop                    \
64                                                 \
65                 --with-curses                   \
66                 --with-gnutls                   \
67                 --with-gss                      \
68                 --with-idn                      \
69                 --with-mixmaster                \
70                 --with-sasl                     \
71                                                 \
72                 $(hcache_db)
73
74 DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
75 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
76 confflags += --build $(DEB_BUILD_GNU_TYPE)
77 # Only specify --host when cross-compiling
78 ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
79     confflags += --host $(DEB_HOST_GNU_TYPE)
80 endif
81
82 # CFLAGS
83 CFLAGS   = -Wall -g
84 CPPFLAGS = -I/usr/include/qdbm
85 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
86         CFLAGS += -O0
87 else
88         CFLAGS += -O2
89 endif
90
91 # Directory to make the build on
92 objdir = $(CURDIR)/obj-$(DEB_HOST_GNU_TYPE)
93
94 ###################### main ######################
95
96 $(objdir)-patched/build-stamp: $(QUILT_STAMPFN)
97         dh_testdir
98         dh_clean
99         -mkdir $(objdir)-patched
100         
101 ifeq ($(BUILD_PATCHED),yes)
102         ###################### building mutt-patched ######################
103         $(QUILT) applied > PATCHES
104         autoreconf --install --include=m4
105         cd $(objdir)-patched && \
106         env CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
107         ../configure --enable-nntp $(confflags)
108         
109         echo '#include "config-debian.h"' >> $(objdir)-patched/config.h
110         
111         # we should just "make mutt" here, but that doesn't work yet
112         cd $(objdir)-patched && $(MAKE) CFLAGS="$(CFLAGS)"
113 endif
114         
115         touch $@
116
117 build build-arch: $(objdir)/build-stamp
118 $(objdir)/build-stamp: $(objdir)-patched/build-stamp
119         ###################### building mutt ######################
120         $(QUILT) pop mutt.org
121         $(QUILT) applied > PATCHES
122         
123         autoreconf --install --include=m4
124         -mkdir $(objdir)
125         cd $(objdir) && \
126         env CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
127         ../configure $(confflags)
128         
129         echo '#include "config-debian.h"' >>$(objdir)/config.h
130         
131         cd $(objdir) && $(MAKE) CFLAGS="$(CFLAGS)"
132         
133         touch $@
134
135 install: build
136         ###################### install ######################
137         dh_testdir
138         dh_testroot
139         dh_prep
140         cd $(objdir) && $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
141         
142         cd debian/tmp/usr/share/doc && \
143         rm -rf samples/iconv samples/ca-bundle.crt && \
144         mv NEWS NEWS.old && \
145         cp $(CURDIR)/UPDATING NEWS
146         
147         chmod +x debian/extra/lib/*
148         chmod +x debian/header.awk
149         debian/header.awk debian/patches/features/* \
150                 debian/patches/mutt-patched/* > debian/tmp/README.Patches
151         
152         ( sed -e '/## More settings/,$$d' $(objdir)/doc/Muttrc || exit 1 ; \
153           cat debian/extra/rc/Muttrc.foot ) > debian/tmp/Muttrc
154         
155         ( echo "# GnuPG configuration"; \
156           grep '^set' contrib/gpg.rc; \
157           echo ) > debian/tmp/gpg.rc
158         
159         dh_install
160         
161         # prepare files for update-alternatives
162         mv debian/mutt/usr/bin/mutt debian/mutt/usr/bin/mutt-org
163 ifeq ($(BUILD_PATCHED),yes)
164         install -D $(objdir)-patched/mutt debian/mutt-patched/usr/bin/mutt-patched
165 endif
166         
167         # reportbug driver
168         dh_installdirs
169         install -m644 debian/bug/control $(CURDIR)/debian/mutt/usr/share/bug/mutt
170         install       debian/bug/script  $(CURDIR)/debian/mutt/usr/share/bug/mutt
171
172 binary binary-arch: install
173         ###################### binary ######################
174         dh_installman
175         dh_installmenu
176         dh_installmime
177         dh_installdocs
178         dh_installexamples
179         dh_installchangelogs ChangeLog
180         -dh_lintian
181         
182         dh_strip --dbg-package=mutt-dbg
183         rm -rf $(CURDIR)/debian/mutt-dbg/usr/share/doc/mutt-dbg \
184                 $(CURDIR)/debian/mutt-patched/usr/share/doc/mutt-patched
185         
186         dh_link
187         dh_compress --exclude usr/share/doc/mutt/README.Patches
188         dh_fixperms --exclude usr/bin/mutt_dotlock
189         dh_installdeb
190         dh_shlibdeps
191         dh_gencontrol
192         dh_md5sums
193         dh_builddeb
194
195 build-indep binary-indep:
196         @echo "Nothing to do."
197
198 clean: unpatch
199         ###################### clean ######################
200         dh_testdir
201         dh_testroot
202         
203         # please dpkg-source
204         rm -f po/*.gmo
205         echo -n > PATCHES
206         
207         # remove build trees
208         rm -rf $(objdir) $(objdir)-patched
209         
210         # remove autotool-generated files so they don't show up in the diff.gz
211         rm -f configure config.h.in
212         rm -f Makefile.in contrib/Makefile.in imap/Makefile.in doc/Makefile.in m4/Makefile.in
213         
214         dh_clean
215
216 .PHONY: configure build build-arch build-indep clean install binary binary-arch binary-indep patch