]> git.llucax.com Git - software/mutt-debian.git/blob - debian/rules
In order to evade a conflict with the sidebar patch, move the set_xterm_*
[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 ###
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         mv ChangeLog.old changelog.old && \
136         cp $(CURDIR)/UPDATING NEWS
137         
138         chmod +x debian/extra/lib/*
139         chmod +x debian/header.awk
140         debian/header.awk debian/patches/features/* \
141                 debian/patches/mutt-patched/* > debian/tmp/README.Patches
142         
143         ( sed -e '/## More settings/,$$d' $(objdir)/doc/Muttrc || exit 1 ; \
144           cat debian/extra/rc/Muttrc.foot ) > debian/tmp/Muttrc
145         
146         ( echo "# GnuPG configuration"; \
147           grep '^set' contrib/gpg.rc; \
148           echo ) > debian/tmp/gpg.rc
149         
150 ifeq ($(BUILD_PATCHED),yes)
151         # temporarily call the binary mutt-patched so dh_strip gets the debug file name right
152         install -D $(objdir)-patched/mutt debian/mutt-patched/usr/bin/mutt-patched
153 endif
154         
155         # reportbug driver
156         dh_installdirs
157         install -m644 debian/bug/control $(CURDIR)/debian/mutt/usr/share/bug/mutt
158         install       debian/bug/script  $(CURDIR)/debian/mutt/usr/share/bug/mutt
159
160 binary binary-arch: install
161         ###################### binary ######################
162         dh_install
163         dh_installman
164         dh_installmenu
165         dh_installmime
166         dh_installdocs
167         dh_installexamples
168         dh_installchangelogs ChangeLog
169         -dh_lintian
170         
171         dh_strip --dbg-package=mutt-dbg
172         rm -rf $(CURDIR)/debian/mutt-dbg/usr/share/doc/mutt-dbg \
173                 $(CURDIR)/debian/mutt-patched/usr/share/doc/mutt-patched
174 ifeq ($(BUILD_PATCHED),yes)
175         mv debian/mutt-patched/usr/bin/mutt-patched debian/mutt-patched/usr/bin/mutt
176 endif
177         
178         dh_link
179         dh_compress --exclude usr/share/doc/mutt/README.Patches
180         dh_fixperms --exclude usr/bin/mutt_dotlock
181         dh_installdeb
182         dh_shlibdeps
183         dh_gencontrol
184         dh_md5sums
185         dh_builddeb
186
187 build-indep binary-indep:
188         @echo "Nothing to do."
189
190 clean: unpatch
191         ###################### clean ######################
192         dh_testdir
193         dh_testroot
194         
195         # please dpkg-source
196         rm -f po/*.gmo
197         touch PATCHES
198         
199         # remove build trees
200         rm -rf $(objdir) $(objdir)-patched
201         
202         # remove autotool-generated files so they don't show up in the diff.gz
203         rm -f configure config.h.in
204         rm -f Makefile.in contrib/Makefile.in imap/Makefile.in doc/Makefile.in m4/Makefile.in
205         
206         # clean PATCHES hunks (blame quilt refresh)
207         for p in `grep -rl PATCHES debian/patches` ; do perl -wi debian/fix-PATCHES.pl $$p ; done
208         
209         dh_clean
210
211 .PHONY: configure build build-arch build-indep clean install binary binary-arch binary-indep patch