]> git.llucax.com Git - software/mutt-debian.git/blob - debian/rules
Recommends: libsasl2-modules. Technically, we depend on libsasl2-2 which already...
[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 -- disabled until there is a sidebar patch for 1.5.19
10 ###
11 # header cache backend
12 # HCACHE_DB := bdb
13 HCACHE_DB := gdbm
14 # HCACHE_DB := qdbm
15 ###
16 # GPGME backend
17 # GPGME := --enable-gpgme
18 ###
19
20 ###################### variables ######################
21
22 ifneq ($(BUILD_PATCHED),yes)
23 export DH_OPTIONS := -Nmutt-patched
24 endif
25
26 # Configure arguments
27
28 ifeq ($(HCACHE_DB),bdb)
29     hcache_db := --without-gdbm --without-qdbm
30 endif
31 ifeq ($(HCACHE_DB),gdbm)
32     hcache_db := --without-qdbm --without-bdb
33 endif
34 ifeq ($(HCACHE_DB),qdbm)
35     hcache_db := --without-gdbm --without-bdb
36 endif
37
38 confflags =     --prefix=/usr                   \
39                 --sysconfdir=/etc               \
40                 --mandir=/usr/share/man         \
41                 --with-sharedir=/usr/share/mutt \
42                 --with-docdir=/usr/share/doc    \
43                 --with-mailpath=/var/mail       \
44                                                 \
45                 --disable-dependency-tracking   \
46                                                 \
47                 --enable-compressed             \
48                 --enable-debug                  \
49                 --enable-fcntl                  \
50                 --enable-hcache                 \
51                 $(GPGME)                        \
52                 --enable-imap                   \
53                 --enable-smtp                   \
54                 --enable-inodesort              \
55                 --enable-pop                    \
56                                                 \
57                 --with-curses                   \
58                 --with-gnutls                   \
59                 --with-gss                      \
60                 --with-idn                      \
61                 --with-mixmaster                \
62                 --with-sasl                     \
63                                                 \
64                 $(hcache_db)
65
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)
72 endif
73
74 # CFLAGS
75 CFLAGS   = -Wall -g
76 CPPFLAGS = -I/usr/include/qdbm
77 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
78         CFLAGS += -O0
79 else
80         CFLAGS += -O2
81 endif
82
83 # Directory to make the build on
84 objdir = $(CURDIR)/obj-$(DEB_HOST_GNU_TYPE)
85
86 ###################### main ######################
87
88 $(objdir)-patched/build-stamp: $(QUILT_STAMPFN)
89         dh_testdir
90         dh_clean
91         -mkdir $(objdir)-patched
92         
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)
99         
100         echo '#include "config-debian.h"' >> $(objdir)-patched/config.h
101         
102         # we should just "make mutt" here, but that doesn't work yet
103         cd $(objdir)-patched && $(MAKE) CFLAGS="$(CFLAGS)"
104 endif
105         
106         touch $@
107
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
112         
113         autoreconf --install --include=m4
114         -mkdir $(objdir)
115         cd $(objdir) && \
116         env CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
117         ../configure $(confflags)
118         
119         echo '#include "config-debian.h"' >>$(objdir)/config.h
120         
121         cd $(objdir) && $(MAKE) CFLAGS="$(CFLAGS)"
122         
123         touch $@
124
125 install: build
126         ###################### install ######################
127         dh_testdir
128         dh_testroot
129         dh_clean -k
130         cd $(objdir) && $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
131         
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
136         
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
141         
142         ( sed -e '/## More settings/,$$d' $(objdir)/doc/Muttrc || exit 1 ; \
143           cat debian/extra/rc/Muttrc.foot ) > debian/tmp/Muttrc
144         
145         ( echo "# GnuPG configuration"; \
146           grep '^set' contrib/gpg.rc; \
147           echo ) > debian/tmp/gpg.rc
148         
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
152 endif
153         
154         # reportbug driver
155         dh_installdirs
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
158
159 binary binary-arch: install
160         ###################### binary ######################
161         dh_install
162         dh_installman
163         dh_installmenu
164         dh_installmime
165         dh_installdocs
166         dh_installexamples
167         dh_installchangelogs ChangeLog
168         -dh_lintian
169         
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
175 endif
176         
177         dh_link
178         dh_compress --exclude usr/share/doc/mutt/README.Patches
179         dh_fixperms --exclude usr/bin/mutt_dotlock
180         dh_installdeb
181         dh_shlibdeps
182         dh_gencontrol
183         dh_md5sums
184         dh_builddeb
185
186 build-indep binary-indep:
187         @echo "Nothing to do."
188
189 clean: unpatch
190         ###################### clean ######################
191         dh_testdir
192         dh_testroot
193         
194         # please dpkg-source
195         rm -f po/*.gmo
196         touch PATCHES
197         
198         # remove build trees
199         rm -rf $(objdir) $(objdir)-patched
200         
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
204         
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
207         
208         dh_clean
209
210 .PHONY: configure build build-arch build-indep clean install binary binary-arch binary-indep patch