]> git.llucax.com Git - software/mutt-debian.git/blob - debian/rules
868b2ab7e4749995c40aa053f68f0dd815038a1c
[software/mutt-debian.git] / debian / rules
1 #!/usr/bin/make -f
2
3 include /usr/share/quilt/quilt.make
4
5 ###
6 # header cache backend
7 # HCACHE_DB := bdb
8 HCACHE_DB := gdbm
9 # HCACHE_DB := qdbm
10 ###
11 # GPGME backend
12 # GPGME := --enable-gpgme
13 ###
14
15 # Configure arguments
16
17 ifeq ($(HCACHE_DB),bdb)
18     hcache_db := --without-gdbm --without-qdbm
19 endif
20 ifeq ($(HCACHE_DB),gdbm)
21     hcache_db := --without-qdbm --without-bdb
22 endif
23 ifeq ($(HCACHE_DB),qdbm)
24     hcache_db := --without-gdbm --without-bdb
25 endif
26
27 confflags =     --prefix=/usr                   \
28                 --sysconfdir=/etc               \
29                 --mandir=/usr/share/man         \
30                 --with-sharedir=/usr/share/mutt \
31                 --with-docdir=/usr/share/doc    \
32                 --with-mailpath=/var/mail       \
33                                                 \
34                 --disable-dependency-tracking   \
35                                                 \
36                 --enable-compressed             \
37                 --enable-debug                  \
38                 --enable-fcntl                  \
39                 --enable-hcache                 \
40                 $(GPGME)                        \
41                 --enable-imap                   \
42                 --enable-smtp                   \
43                 --enable-inodesort              \
44                 --enable-pop                    \
45                                                 \
46                 --with-curses                   \
47                 --with-gnutls                   \
48                 --with-idn                      \
49                 --with-mixmaster                \
50                 --with-sasl                     \
51                                                 \
52                 $(hcache_db)
53
54 DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
55 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
56 confflags += --build $(DEB_BUILD_GNU_TYPE)
57 # Only specify --host when cross-compiling
58 ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
59     confflags += --host $(DEB_HOST_GNU_TYPE)
60 endif
61
62 # CFLAGS
63 CFLAGS   = -Wall -g
64 CPPFLAGS = -I/usr/include/qdbm
65 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
66         CFLAGS += -O0
67 else
68         CFLAGS += -O2
69 endif
70
71 # Directory to make the build on
72 objdir = $(CURDIR)/obj-$(DEB_HOST_GNU_TYPE)
73
74 $(objdir)-patched/build-stamp: $(QUILT_STAMPFN)
75         dh_testdir
76         dh_clean
77         
78         ###################### building mutt-patched ######################
79         autoreconf --install --include=m4
80         -mkdir $(objdir)-patched
81         cd $(objdir)-patched && \
82         env CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
83         ../configure $(confflags)
84         
85         echo '#include "config-debian.h"' >> $(objdir)-patched/config.h
86         
87         # we should just "make mutt" here, but that doesn't work yet
88         cd $(objdir)-patched && $(MAKE) CFLAGS="$(CFLAGS)"
89         
90         touch $@
91
92 build build-arch: $(objdir)/build-stamp
93 $(objdir)/build-stamp: $(objdir)-patched/build-stamp
94         ###################### building mutt ######################
95         QUILT_PATCHES=$(QUILT_PATCH_DIR) quilt --quiltrc /dev/null pop mutt.org
96         
97         autoreconf --install --include=m4
98         -mkdir $(objdir)
99         cd $(objdir) && \
100         env CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
101         ../configure $(confflags)
102         
103         echo '#include "config-debian.h"' >>$(objdir)/config.h
104         
105         cd $(objdir) && $(MAKE) CFLAGS="$(CFLAGS)"
106         
107         touch $@
108
109 install: build
110         ###################### install ######################
111         dh_testdir
112         dh_testroot
113         dh_clean -k
114         cd $(objdir) && $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
115         
116         cd debian/tmp/usr/share/doc && \
117         rm -rf samples/iconv samples/ca-bundle.crt && \
118         mv NEWS NEWS.old && \
119         mv ChangeLog.old changelog.old && \
120         cp $(CURDIR)/UPDATING NEWS
121         
122         chmod +x debian/extra/lib/*
123         chmod +x debian/header.awk
124         debian/header.awk debian/patches/features/* \
125                 debian/patches/mutt-patched/* > debian/tmp/README.Patches
126         
127         ( sed -e '/## More settings/,$$d' $(objdir)/doc/Muttrc || exit 1 ; \
128           cat debian/extra/rc/Muttrc.foot ) > debian/tmp/Muttrc
129         
130         ( echo "# GnuPG configuration"; \
131           grep '^set' contrib/gpg.rc; \
132           echo ) > debian/tmp/gpg.rc
133         
134         # temporarily call the binary mutt-patched so dh_strip gets the debug file name right
135         install -D $(objdir)-patched/mutt debian/mutt-patched/usr/bin/mutt-patched
136         
137         # reportbug driver
138         dh_installdirs
139         install -m644 debian/bug/control $(CURDIR)/debian/mutt/usr/share/bug/mutt
140         install       debian/bug/script  $(CURDIR)/debian/mutt/usr/share/bug/mutt
141
142 binary binary-arch: install
143         ###################### binary ######################
144         dh_install
145         dh_installman
146         dh_installmenu
147         dh_installmime
148         dh_installdocs
149         dh_installexamples
150         dh_installchangelogs ChangeLog
151         -dh_lintian
152         
153         dh_strip --dbg-package=mutt-dbg
154         rm -rf $(CURDIR)/debian/mutt-dbg/usr/share/doc/mutt-dbg \
155                 $(CURDIR)/debian/mutt-patched/usr/share/doc/mutt-patched
156         mv debian/mutt-patched/usr/bin/mutt-patched debian/mutt-patched/usr/bin/mutt
157         
158         dh_link
159         dh_compress --exclude usr/share/doc/mutt/README.Patches
160         dh_fixperms --exclude usr/bin/mutt_dotlock
161         dh_installdeb
162         dh_shlibdeps
163         dh_gencontrol
164         dh_md5sums
165         dh_builddeb
166
167 build-indep binary-indep:
168         @echo "Nothing to do."
169
170 clean: unpatch
171         ###################### clean ######################
172         dh_testdir
173         dh_testroot
174         
175         # please dpkg-source
176         rm -f po/*.gmo
177         touch PATCHES
178         
179         # remove build trees
180         rm -rf $(objdir) $(objdir)-patched
181         
182         # remove autotool-generated files so they don't show up in the diff.gz
183         rm -f configure config.h.in
184         rm -f Makefile.in contrib/Makefile.in imap/Makefile.in doc/Makefile.in m4/Makefile.in
185         
186         # clean PATCHES hunks (blame quilt refresh)
187         for p in `grep -rl PATCHES debian/patches` ; do perl -wi debian/fix-PATCHES.pl $$p ; done
188         
189         dh_clean
190
191 .PHONY: configure build build-arch build-indep clean install binary binary-arch binary-indep patch