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 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
|
#!/usr/bin/make -f
# -*- makefile -*-
# Debianrules for building a Debian package
# Version 1.5
#
# These rules have been specifically designed NOT to require root to
# run them. At any time root privileges are required, the command to be
# executed will be made obvious and root's password will be prompted for.
# Of course, root may still run this and no password will be required.
#
# Robert Leslie <rob@mars.org>
# modified for Postfix by LaMont Jones <lamont@debian.org>
PACKAGE=postfix
include /usr/share/dpatch/dpatch.make
package=postfix
base=debian/$(package)
docpkg=${package}-doc
docdir=${base}-doc/usr/share/doc/$(package)
chlogdir=${base}/usr/share/doc/$(package)
sharedir=${base}/usr/share/postfix
libdir=${base}/usr/lib
plibdir=usr/lib/postfix
sbindir=usr/sbin
bindir=${base}/usr/bin
confdir=${base}/etc/postfix
#ifeq ($(DEB_BUILD_ARCH),sparc)
# OFLAGS = -O1
#else
# OFLAGS = -O1
#endif
OFLAGS = -O2
SHELL=/bin/bash
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
DEBUG = -g
endif
ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
STRIP=y
endif
CCARGS=-DDEBIAN -DMAX_DYNAMIC_MAPS -DHAS_PCRE -DHAS_LDAP \
-DHAS_CDB \
-DHAS_MYSQL -I/usr/include/mysql \
-DHAS_PGSQL -I`pg_config --includedir` \
-DHAS_SSL -I/usr/include/openssl \
-DUSE_SASL_AUTH -I/usr/include/sasl \
-DUSE_CYRUS_SASL \
-DUSE_TLS
AUXLIBS =-lssl -lcrypto -lsasl2
DOCFILES=README_FILES/*_README COMPATIBILITY TODO PORTING
TLSDOCFILES=${TLSSRC}/TLS_TODO ${TLSSRC}/TLS_ACKNOWLEDGEMENTS
.PHONY: install install-doc binary binary-arch binary-indep clean
.PHONY: checkroot
build: patch
$(checkdir)
${MAKE} makefiles CCARGS="${CCARGS}" DEBUG=${DEBUG} \
AUXLIBS="${AUXLIBS} -L$$(pwd)/debian" OPT="$(OFLAGS)"
cd lib && for i in dns global master tls util ; do \
ln -sf lib$${i}.a libpostfix-$${i}.so.1.0.1; \
ln -sf libpostfix-$${i}.so.1.0.1 libpostfix-$${i}.so.1; \
done
${MAKE} LD_LIBRARY_PATH=$$(pwd)/lib:$${LD_LIBRARY_PATH}
${MAKE} manpages
DISTRO=$$(lsb_release -is 2>/dev/null || echo Debian); \
if [ $$DISTRO = Debian ]; then DISTRO=Debian/GNU; fi; \
sed "s:@@DISTRO@@:$$DISTRO:g" < debian/main.cf.in > conf/main.cf.debian
DISTRO=$$(lsb_release -is 2>/dev/null || echo Debian); \
if [ $$DISTRO = Debian ]; then DISTRO=Debian/GNU; fi; \
sed "s:@@DISTRO@@:$$DISTRO:g" < conf/main.cf > conf/main.cf.dist
touch $@
install-doc: build
dh_clean -k
dh_installdirs -i
install -m 0444 html/* $(docdir)/html; rm $(docdir)/html/Makefile.in
dh_installexamples -p ${docpkg} examples/{qmail-local,smtpd-policy}
dh_installexamples -p ${docpkg} -Xmain.cf -Xmaster.cf -Xfiles conf/[a-z]*
dh_installexamples -p ${docpkg} conf/main.cf.default
install -m 0444 RELEASE_NOTES $(docdir)/RELEASE_NOTES
install -m 0444 AAAREADME $(docdir)/README
for file in */README; do \
install -m 0444 $${file} $(docdir)/README.$${file%/README}; \
done
rm -f $(docdir)/README.mantools
for file in ${DOCFILES}; do \
install -m 0444 $${file} $(docdir)/$${file##*/}; \
done
rm -f $(docdir)/ULTRIX_README $(docdir)/MACOSX_README
install -m 0444 include/[!CRS]* ${base}-dev/usr/include/postfix
cd lib; for i in libpostfix-*; do \
ln -sf $$i ../${base}-dev/usr/lib/$${i%so.*}so; \
done
install: build
dh_clean -k
dh_installdirs -a
install lib/*.1.0.1 $(libdir)
install debian/postfix_groups.pl $(libdir)
for i in $(libdir)/*.1.0.1; do ln -sf $${i##*/} $${i%.*.*}; done
install lib/dict_ldap.so ${base}-ldap/${plibdir}
install lib/dict_pcre.so ${base}-pcre/${plibdir}
install lib/dict_mysql.so ${base}-mysql/${plibdir}
install lib/dict_pgsql.so ${base}-pgsql/${plibdir}
install lib/dict_tcp.so ${base}/${plibdir}
install lib/dict_cdb.so ${base}-cdb/${plibdir}
install libexec/[a-z]* ${base}/${plibdir}
install bin/[a-z]* ${base}/${sbindir}
install auxiliary/qshape/qshape.pl ${base}/${sbindir}/qshape
install -m 0444 HISTORY $(chlogdir)/changelog
ln -s ../sbin/rmail $(bindir)/rmail
ln -s ../sbin/sendmail $(bindir)/newaliases
ln -s ../sbin/sendmail $(bindir)/mailq
ln -s ../sbin/sendmail ${base}/usr/lib/sendmail
ln -s smtp ${base}/${plibdir}/lmtp
install -m 0755 conf/postfix-script conf/post-install $(confdir)
install -m 0644 conf/postfix-files $(confdir)
install -m 0644 debian/functions $(sharedir)/postinst.functions
install -m 0644 conf/master.cf $(sharedir)/master.cf.dist
install -m 0644 conf/main.cf.dist $(sharedir)/main.cf.dist
install -m 0644 conf/main.cf.debian $(sharedir)/main.cf.debian
install -m 0644 conf/main.cf.tls $(sharedir)/main.cf.tls
install man/man1/*.1 ${base}/usr/share/man/man1
install man/man5/*.5 ${base}/usr/share/man/man5
for f in man/man8/*.8; do \
sed '/^\.TH/s/ 8 / 8postfix /' $${f}>${base}/usr/share/$${f}postfix; \
chmod 644 ${base}/usr/share/$${f}postfix; \
chown root:root ${base}/usr/share/$${f}postfix; \
done
install rmail/rmail.8 ${base}/usr/share/man/man8
gzip -9 ${base}/usr/share/man/man8/*.8postfix
ln -sf bounce.8postfix.gz ${base}/usr/share/man/man8/trace.8postfix.gz
ln -sf bounce.8postfix.gz ${base}/usr/share/man/man8/defer.8postfix.gz
install debian/init.d ${base}/etc/init.d/postfix
install debian/ip-up.d ${base}/etc/ppp/ip-up.d/postfix
install debian/ip-down.d ${base}/etc/ppp/ip-down.d/postfix
install debian/ip-up.d ${base}/etc/network/if-up.d/postfix
install debian/ip-down.d ${base}/etc/network/if-down.d/postfix
install debian/update-libc.d ${base}/etc/resolvconf/update-libc.d/postfix
install -m 0444 debian/lintian-override ${base}/usr/share/lintian/overrides/${package}
debian/vars:
cp debian/vars.in $@
# This assumes non-native, and at least one hyphen in the version number.
echo Upstream=$$(sed 's/^.*(\(.*\)-[^-]*).*/\1/; q' debian/changelog) >> $@
binary-indep: checkroot install-doc debian/vars
dh_installdocs -i
## dh_installexamples -i
## dh_installmenu -i
## dh_installcron -i
dh_installchangelogs -i
dh_installdebconf -i
dh_compress -i
dh_fixperms -i
dh_installdeb -i
for i in $$(sed -n '/^Package:/s/^.* //p' debian/control); do cat debian/vars >> debian/$$i.substvars; done
cat debian/vars.in >> debian/substvars
dh_gencontrol -i
## dh_makeshlibs -i
dh_md5sums -i
dh_builddeb -i
binary-arch: checkroot build install debian/vars
dh_installdocs -a
## dh_installexamples -a
## dh_installmenu -a
## dh_installcron -a
dh_installchangelogs -a
dh_installdebconf -a
## dh_movefiles -a
[ -n "$(STRIP)" ] || dh_strip -a
dh_compress -a
dh_fixperms -a
dh_makeshlibs -a
dh_installdeb -a
LD_LIBRARY_PATH=$$(pwd)/lib:$${LD_LIBRARY_PATH} dh_shlibdeps -a
for i in $$(sed -n '/^Package:/s/^.* //p' debian/control); do cat debian/vars >> debian/$$i.substvars; done
cat debian/vars.in >> debian/substvars
dh_gencontrol -a
## dh_makeshlibs -a
dh_md5sums -a
dh_builddeb -a
clean-preunpatch:
$(checkdir)
dh_clean build
test ! -d ${base} || rm -rf ${base}
$(MAKE) tidy
clean: clean-preunpatch unpatch
rm -rf debian/{files*,vars,*substvars,*.debhelper}
find .. -maxdepth 1 -name $(package)*.asc -size 0 -exec rm {} ";"
rm -f debian/stamp-* conf/main.cf.debian conf/main.cf.dist
buildinfo:
@echo; dpkg -l gcc "libc6*" binutils ldso make dpkg-dev $(BUILDINFO) \
| awk '$$1 == "ii" { printf("%s-%s\n", $$2, $$3) }' \
| tee $(docdir)/buildinfo.Debian; echo
chmod 644 $(docdir)/buildinfo.Debian
define checkdir
test -f debian/rules
endef
# Below here is fairly generic really
binary: binary-arch binary-indep
newtemplate:
debconf-updatepo
msgstats:
cd debian/po && for i in *.po; do x=$$(msgfmt --statistics $$i 2>&1); echo $$i $$x; done; rm -f messages.mo *.po~
checkroot:
$(checkdir)
test "`id -u`" -eq 0
|