1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
#!/usr/bin/make -f
# -*- sh -*-
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
#export WITH_GC="--with-gc"
export WITH_SIEVE=--with-sieve
export WITH_SQLITE=--with-sqlite
export WITH_MYSQL=--with-mysql
export WITH_PGSQL=--with-pgsql
export WITH_LDAP=--with-auth-ldap
export SHARED=--enable-shared=yes
export SHARED=--enable-static=no
CFLAGS = -Wall -O1
LDFLAGS = -lcrypt
# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
ifneq (,$(findstring devel,$(DEB_BUILD_OPTIONS)))
export WITH_CHECK=--with-check
export WITH_MYSQL=
export WITH_PGSQL=
export WITH_SQLITE=
export WITH_LDAP=
export WITH_SIEVE=
export SHARED=--enable-shared=no
export STATIC=--enable-static=yes
CFLAGS += -g
endif
ifneq (,$(findstring mysql,$(DEB_BUILD_OPTIONS)))
export WITH_MYSQL=--with-mysql
endif
ifneq (,$(findstring pgsql,$(DEB_BUILD_OPTIONS)))
export WITH_PGSQL=--with-pgsql
endif
ifneq (,$(findstring sqlite,$(DEB_BUILD_OPTIONS)))
export WITH_SQLITE=--with-sqlite
endif
ifneq (,$(findstring ldap,$(DEB_BUILD_OPTIONS)))
export WITH_LDAP=--with-auth-ldap
endif
ifneq (,$(findstring sieve,$(DEB_BUILD_OPTIONS)))
export WITH_SIEVE=--with-sieve
endif
# dpatch
export PACKAGE=dbmail
export PACKAGES=dbmail
CONFFLAGS=--prefix=/usr --mandir=\$${prefix}/share/man --sysconfdir=/etc/dbmail \
--localstatedir=/var/run/dbmail --with-logdir=/var/log/dbmail --infodir=\$${prefix}/share/info \
$(WITH_GC) $(WITH_CHECK) $(SHARED) $(STATIC) $(WITH_SIEVE) $(WITH_LDAP) $(WITH_MYSQL) $(WITH_PGSQL) $(WITH_SQLITE)
build: stamps/build
stamps/build: stamps patch configure $(PACKAGES)
touch $@
stamps:
mkdir stamps
configure:
autoreconf -i
dbmail: stamps/dbmail
stamps/dbmail:
env CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ./configure $(CONFFLAGS)
$(MAKE)
$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
touch $@
clean: clean1 unpatch
clean1:
# run clean
dh_testroot
dh_testdir
[ ! -f Makefile ] || $(MAKE) distclean
dh_clean
debconf-updatepo
rm -rf stamps autom4te.cache || true
# maintainer target
mrproper:
[ ! -f Makefile ] || $(MAKE) distclean
rm -f `find . -name ".#*"`
rm -f `find . -name "*.la"`
rm -f `find . -name "*.lo"`
rm -f `find . -name "*.o"`
rm -f `find . -name "*.pyc"`
rm -f `find man -name "*.xml"`
rm -f `find man -name "*.[1-8]"`
# Add here commands to clean up after the build process.
for file in config.in aclocal.m4 acconfig.h configure `find . -name Makefile.in`; do \
rm -rf $$file || true; \
done
for file in Makefile config.h config.status libtool stamp-h .deps .libs; do \
rm -rf `find . -name $$file`; \
done
rm -rf buildtools
# Build architecture-dependent files here.
binary-common: build
dh_testroot
dh_testdir
dh_installdirs
## reduce RPATH to minimum (libdbmail.so in /usr/lib/dbmail/)
for file in $(CURDIR)/debian/tmp/usr/lib/dbmail/*.so ; do \
chrpath -d $$file; \
done
for file in $(CURDIR)/debian/tmp/usr/sbin/* ; do \
chrpath -r /usr/lib/dbmail $$file; \
done
dh_install -a --sourcedir=debian/tmp
dh_installinit -a --name=dbmail -- defaults 25
dh_installcron -a --name=dbmail
dh_installlogrotate -a --name=dbmail
dh_installdebconf -a
dh_installman -a
dh_installdocs -a
dh_installchangelogs -a
## update examples
(cd $(CURDIR) && find sql/sqlite/ -type f && cat debian/dbmail.examples) | \
sort|uniq>stamps/tmpfile && cat stamps/tmpfile > $(CURDIR)/debian/dbmail.examples
(cd $(CURDIR) && find sql/mysql/ -type f && cat debian/dbmail-mysql.examples) | \
sort|uniq>stamps/tmpfile && cat stamps/tmpfile > $(CURDIR)/debian/dbmail-mysql.examples
(cd $(CURDIR) && find sql/postgresql/ -type f && cat debian/dbmail-pgsql.examples) | \
sort|uniq>stamps/tmpfile && cat stamps/tmpfile > $(CURDIR)/debian/dbmail-pgsql.examples
rm -f stamps/tmpfile
dh_installexamples -a
dh_installdirs etc/dbmail var/log/dbmail usr/share/dbmail
install -m 644 $(CURDIR)/debian/default.dbmail $(CURDIR)/debian/dbmail/usr/share/dbmail/default.dbmail
dh_strip -a
dh_link -a
dh_compress -a
dh_fixperms -a
dh_makeshlibs -a --exclude=usr/lib/dbmail
dh_shlibdeps -a
dh_installdeb -a
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a
binary-indep: build install
binary-arch: build install
$(MAKE) -f debian/rules DH_OPTIONS=-a binary-common
binary-%: build install
make -f debian/rules binary-common $* DH_OPTIONS=-p$*
binary: binary-indep binary-arch
.PHONY: build clean clean1 mrproper patch binary binary-common binary-indep binary-arch unpatch install
|