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