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 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
|
#!/usr/bin/make -f
# see FEATURE AREAS in dpkg-buildflags(1)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = yes
include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/pkg-info.mk
DEB_SOURCE_PACKAGE ?= sendmail
DEB_SRCDIR ?= .
DEB_DESTDIR ?= $(CURDIR)/debian/tmp/
CFLAGS += -fPIC
CFLAGS += -std=gnu18
LDFLAGS += -Wl,-z,noexecstack -Wl,--warn-shared-textrel
version_debian ?= -$(lastword $(subst -, ,${DEB_VERSION}))
SRC_DIR := $(CURDIR)/debian
PKG_DIR := debian/${DEB_SOURCE_PACKAGE}-bin
PKG_DOC = debian/${DEB_SOURCE_PACKAGE}-doc${docdir}/${DEB_SOURCE_PACKAGE}-doc
SM_SUBDIRS := editmap libmilter mail.local mailstats \
makemap praliases rmail sendmail smrsh vacation
PKG_TMP = debian/tmp
# this is a "magic" value since it matches "obj${prefix}.${sfx}" if it exists
# and will be used by the sendmail Build script
SM_OBJDIR ?= obj.
# Now that all that is out of the way, read the desired configuration
# settings
CONF_NAME = debian/configure.options
$(eval CONFIG_OPTS := $(shell grep -v "^\#" ${CONF_NAME}))
CONFIG_OPTS += ${SM_CONF_OPT}
# Include Debian Autoconf settings
include $(firstword $(wildcard debian/build/autoconf.mk \
debian/build/autoconf.mk.in))
#-------------
# Maintainer only rule... convert upstream signature from .sig into .asc
%.asc: %.sig
gpg -o - --enarmor $< | sed 's/ARMORED FILE/SIGNATURE/; /^Comment:/d' > $@
#-------------
# Maintainer only rule... refresh upstream signing keys
debian/upstream/signing-key.asc: HOME=import-upstream-signing-keys
debian/upstream/signing-key.asc: PGPKEYS
mkdir import-upstream-signing-keys
gpg --import < $<
gpg --armor --export --export-options export-minimal,export-clean >$@
$(RM) -r import-upstream-signing-keys
#-------------
# Maintainer only rule... refresh debian/control
control-real:
# generate debian/configure
dh_autoreconf
# run twice in case debian/control gets updated
debian/rules configure || debian/rules configure
# cleanup
debian/rules clean
#-------------
# Maintainer only rule... must be run in external debian directory
.PHONY: refresh-faq
refresh-faq::
@echo 'Refreshing FAQ'
@chmod u+w faq.txt;
(wget --passive-ftp --timestamping \
--cache=off http://www.sendmail.org/faq/faq.txt;);
@chmod a-w faq.txt;
@echo 'Refreshing Misc'
@chmod u+w cf/feature/rhsbl.m4;
(cd cf/feature && wget --passive-ftp --timestamping \
--cache=off http://www.megacity.org/software_downloads/rhsbl.m4;);
@chmod u-w cf/feature/rhsbl.m4;
#------------------------------------------------------------------------------
# Build/Package check rules
#------------------------------------------------------------------------------
#-------------
.PHONY: info
info:
#--------------------------------------------------------------------
# The following information will be used for this run:
# Source = ${DEB_SOURCE_PACKAGE}
# Package = ${DEB_SOURCE_PACKAGE} ${DEB_VERSION}
# ${version_string}${sm_custom_s}${version_debian}
# BuildTree = ${DEB_SRCDIR}
# Arch = ${DEB_BUILD_ARCH} on ${DEB_HOST_ARCH}
# Options
# configure = ${CONFIG_OPTS}
# config opt = ${SM_CONF_OPT}
# ENABLE_INDEP= ${ENABLE_INDEP}
# ENABLE_ARCH = ${ENABLE_ARCH}
# ENABLE_DEV = ${ENABLE_DEV}
# ENABLE_DOC = ${ENABLE_DOC}
# compile opt = ${CC} ${CFLAGS} ${DEFINES}
# DEB_BUILD_OPTIONS = ${DEB_BUILD_OPTIONS}
# DH_VERBOSE = ${DH_VERBOSE}
# DH_OPTIONS = ${DH_OPTIONS}
# DH_COMPAT = ${DH_COMPAT}
#--------------------------------------------------------------------
#------------------------------------------------------------------------------
# User callable rules
#------------------------------------------------------------------------------
%:
dh $@
override_dh_auto_clean:
$(RM) ${DEB_SRCDIR}/doc/op/op.txt
dh_auto_clean -D debian
$(RM) -r $(SM_OBJDIR)
configure: override_dh_auto_configure ;
override_dh_auto_configure:
mkdir -p $(SM_OBJDIR)
dh_auto_configure -D debian -- $(CONFIG_OPTS)
override_dh_auto_build-indep:
#--------------------------------------------------------------------
# build-indep:
#
# sendmail operations guide
GROFF_NO_SGR=1 $(MAKE) -C ${DEB_SRCDIR}/doc/op/ op.txt
# Debian stuff
$(MAKE) -C debian -f Makefile build-indep
#--------------------------------------------------------------------
override_dh_auto_install-indep:
#--------------------------------------------------------------------
# install-indep
#
# sendmail operations guide and other documentation
${INSTALL} -d ${PKG_DOC}/op
$(INSTALL_DATA) ${DEB_SRCDIR}/doc/op/op.ps ${PKG_DOC}/op/
$(INSTALL_DATA) ${DEB_SRCDIR}/doc/op/op.txt ${PKG_DOC}/op/
$(INSTALL_DATA) ${DEB_SRCDIR}/README ${PKG_DOC}/
$(INSTALL_DATA) ${DEB_SRCDIR}/KNOWNBUGS ${PKG_DOC}/
$(INSTALL_DATA) ${DEB_SRCDIR}/cf/README ${PKG_DOC}/cf.README
${INSTALL} -d ${PKG_DOC}/sendmail
$(INSTALL_DATA) ${DEB_SRCDIR}/sendmail/README ${PKG_DOC}/sendmail/
$(INSTALL_DATA) ${DEB_SRCDIR}/sendmail/SECURITY ${PKG_DOC}/sendmail/
$(INSTALL_DATA) ${DEB_SRCDIR}/sendmail/TRACEFLAGS ${PKG_DOC}/sendmail/
$(INSTALL_DATA) ${DEB_SRCDIR}/sendmail/TUNING ${PKG_DOC}/sendmail/
$(INSTALL_DATA) ${DEB_SRCDIR}/smrsh/README ${PKG_DOC}/smrsh.README
$(INSTALL_DATA) debian/faq.txt ${PKG_DOC}/
${INSTALL} -d ${PKG_DOC}/libmilter/html
$(INSTALL_DATA) ${DEB_SRCDIR}/libmilter/README ${PKG_DOC}/libmilter/
cp -a ${DEB_SRCDIR}/libmilter/docs/* ${PKG_DOC}/libmilter/html/
# Debian stuff
$(MAKE) -C debian/cf -f Makefile install-indep DESTDIR="${SRC_DIR}/sendmail-cf"
$(MAKE) -C debian/examples -f Makefile install-indep DESTDIR="${SRC_DIR}/sendmail-base"
$(MAKE) -C debian/local -f Makefile install-indep DESTDIR="${SRC_DIR}/sendmail-base"
#--------------------------------------------------------------------
override_dh_auto_build-arch:
#--------------------------------------------------------------------
# build-arch
#
# Place our m4 configuration files for the sendmail build to use
cp -f debian/build/site.config.m4 ${DEB_SRCDIR}/devtools/Site/
# Finally, build the whole enchilada (we'll let sendmail figure
# which, if any of the dependant libraries each component needs)
set -e ; \
set -x ; \
for subdir in ${SM_SUBDIRS}; do \
if [ -d ${DEB_SRCDIR}/$${subdir} ]; then \
(cd ${DEB_SRCDIR}/$${subdir} && ./Build -S;); \
fi; \
done;
# Debian stuff
$(MAKE) -C debian -f Makefile build-arch
# Remove our config m4 files
$(RM) ${DEB_SRCDIR}/devtools/Site/site.config.m4
#--------------------------------------------------------------------
override_dh_auto_install-arch:
#--------------------------------------------------------------------
# install-arch
#
# sendmail install proper... with a little help ;-}
$(MAKE) -C ${DEB_SRCDIR} install DESTDIR="$(DEB_DESTDIR)"
$(MAKE) -C ${DEB_SRCDIR}/libmilter install DESTDIR="$(DEB_DESTDIR)"
$(MAKE) -C ${DEB_SRCDIR}/mail.local force-install DESTDIR="$(DEB_DESTDIR)"
# Debian stuff
$(MAKE) -C debian/sensible_mda install-arch DESTDIR="$(DEB_DESTDIR)"
# Handle man pages for the sendmail aliases
mv ${PKG_TMP}${mandir}/man5/aliases.5 \
${PKG_TMP}${mandir}/man5/aliases.sendmail.5
mv ${PKG_TMP}${mandir}/man1/mailq.1 \
${PKG_TMP}${mandir}/man1/mailq.sendmail.1
mv ${PKG_TMP}${mandir}/man1/newaliases.1 \
${PKG_TMP}${mandir}/man8/newaliases.sendmail.8
mv ${PKG_TMP}${mandir}/man8/sendmail.8 \
${PKG_TMP}${mandir}/man8/sendmail.sendmail.8
# Special handling of vacation - Debian has a seperate package
# with a different version (sigh) keep our copy just in case...
mv ${PKG_TMP}${libexecdir}/vacation \
${PKG_TMP}${libexecdir}/vacation.sendmail
mv ${PKG_TMP}${mandir}/man1/vacation.1 \
${PKG_TMP}${mandir}/man1/vacation.sendmail.1
${INSTALL} -d ${PKG_TMP}${libdir}/pkgconfig
$(INSTALL_DATA) ${SRC_DIR}/milter.pc ${PKG_TMP}${libdir}/pkgconfig/milter.pc
#--------------------------------------------------------------------
override_dh_installdocs-indep:
# Avoid recording the build path in the documentation
sed -i -e "s,prefix-map=$(CURDIR),prefix-map=BUILDPATH,g" debian/build/site.config.m4
dh_installdocs -p${DEB_SOURCE_PACKAGE}-doc --doc-main-package=${DEB_SOURCE_PACKAGE}-doc -A $(DEB_SRCDIR)/README
dh_installdocs -N${DEB_SOURCE_PACKAGE}-doc -A $(DEB_SRCDIR)/README
override_dh_installdocs-arch:
dh_installdocs -A $(DEB_SRCDIR)/README
override_dh_installchangelogs:
dh_installchangelogs $(DEB_SRCDIR)/RELEASE_NOTES
override_dh_installcron:
dh_installcron --name=$(DEB_SOURCE_PACKAGE)
override_dh_installinit:
dh_installinit --name=$(DEB_SOURCE_PACKAGE)
override_dh_installsystemd:
dh_installsystemd --name=$(DEB_SOURCE_PACKAGE)
override_dh_bugfiles:
dh_bugfiles -A
execute_after_dh_fixperms-arch:
chown root:mail ${PKG_DIR}${libexecdir}/sendmail;
chmod 02755 ${PKG_DIR}${libexecdir}/sendmail;
chown root:mail ${PKG_DIR}${libexecdir}/mailstats;
chmod 02755 ${PKG_DIR}${libexecdir}/mailstats;
chmod 04755 debian/sensible-mda/usr/sbin/sensible-mda;
|