diff options
Diffstat (limited to 'debian/rules')
-rwxr-xr-x | debian/rules | 1424 |
1 files changed, 1093 insertions, 331 deletions
diff --git a/debian/rules b/debian/rules index 06dd8ea..4beba56 100755 --- a/debian/rules +++ b/debian/rules @@ -1,421 +1,1172 @@ #!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. +#------------------------------------------------------------------------------ +# vim: syntax=make # -# This file is also based upon prior sendmail makefiles +# $Sendmail: rules,v 8.12.3 2003-09-17 15:19:44 cowboy Exp $ # -# This file will make sendmail on either slink or potato, the only thing -# to watch for is to make sure the changelog correctly reflects the -# appropriate distribution! +# Copyright (c) 1998-2003 Richard Nelson. All Rights Reserved. # -# Richard Nelson <cowboy@debian.org> +# ./rules. Generated from rules.in by configure. +# +# Rules file for Sendmail 8.12.3-6.5(527363) +# on Debian 3.0 +# via Debhelper V4 +# +# Note: the .in file supports Sendmail 8.7.6 - 8.12.7 +# on Debian slink, potato, woody, testing, sid, ... +# but the generated file is customized to the version noted above. +# +# The only thing to watch for is to make sure the changelog correctly +# reflects the appropriate version and distribution! +# +# To support private builds: +# 1) use the environment variables (defaults shown first): +# CC=gcc|gcc-3.0..........-- choose compiler +# CFLAGS='-O2 -Wall [-g]'.-- choose compile options +# DEFINES=''..............-- additional -Dxxx +# SM_CONF_OPT=''..........-- additional configure options +# SM_BUILD_OPT=''.........-- additional build options +# 2) Build the package using your normal setup: +# A) [fakeroot] debian/rules binary +# B) debuild -rfakeroot +# C) dpkg-buildpackage -rfakeroot -uc -us +# +# DEB_BUILD_OPTIONS (global Debian package build options) +# Debian specific, and common across package options +# noopt - Do *NOT* compile with optimization (force -O0) +# nostrip - Do *NOT* strip binaries (for debugging) +# +# +# SM_CONF_OPT +# Additional configure options and/or overrides may be specified thusly: +# 1) export SM_CONF_OPT='--enable-shm=no' +# dpkg-buildpackage -rfakeroot -uc -us +# 2) SM_CONF_OPT='--enable-shm=no' dpkg-buildpackage +# 3) debuild -e SM_CONF_OPT='--enable-shm=no' +# etc... +# +# SM_BUILD_OPT +# 1) export SM_BUILD_OPT='notls' +# dpkg-buildpackage -rfakeroot -uc -us +# 2) SM_BUILD_OPT='notls' dpkg-buildpackage -rfakeroot -uc -us +# 3) debuild -e SM_BUILD_OPT='notls' -e CLFAGS='-O3 Wall' +# etc... +# +# Supported options values for SM_BUILD_OPT: +# notls Disable STARTTLS (OpenSSL) support +# noauth Disable SMTP AUTH (sasl) support +# nodev Disable generation of libmilter-dev package +# nodoc Disable generation of sendmail-doc package +# +# This make file uses scripts from the DBS (0.8) package! +# +# Richard Nelson <cowboy@debian.org> 2003-09-17 15:19:44 (+0000) +#------------------------------------------------------------------------------ +#SHELL := /bin/sh -x # Uncomment this to turn on verbose mode. -export DH_VERBOSE= +#export DH_VERBOSE=1 + +# This is the debhelper compatibility version to use. (we'll set it later) +#export DH_COMPAT=4 # This has to be exported to make some magic below work. export DH_OPTIONS -package=sendmail -version=$(shell expr `pwd` : '.*-\([0-9.].*\)') -version_main=$(shell expr `pwd` : '.*-\([0-9]*.[0-9.]*\)') - -# Many things depend upon which release (slink, potato, etc.) -ifeq ("$(shell dh_testversion 2.0.40 && echo potato)", "potato") - DH_COMPAT = 2 - TEMP_DIR = $(shell echo "debian/tmp debian/$(package)" | \ - cut -d " " -f $(DH_COMPAT)) - DOC_PFX = usr/share/doc - MAN_PFX = usr/share/man +# Support separate debian directory +ifeq (yes, $(shell test -d debian && echo 'yes')) + debian_dir := debian + pwd_dir := ${PWD} +else + debian_dir := . + pwd_dir := ${PWD}/.. + endif + +# Determine build,host architectures (via dpkg-architecture) +ifeq (, ${DEB_BUILD_ARCH}) + ifeq (yes, $(shell test -x /usr/bin/dpkg-architecture && echo 'yes')) + include ${debian_dir}/scripts/dpkg-arch.mk + endif + endif + +# Check for cross-compilation +ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) + ifneq (, $(DEB_BUILD_GNU_TYPE)) + endif + endif + +# will want path info for some things... Like patches/changelogs... +pwd_string := $(shell expr "${pwd_dir}" : '.*-\([0-9.].*\)') +ifeq (, $(findstring +,${pwd_string})) + pwd_version := ${pwd_string} else - DH_COMPAT = 1 - TEMP_DIR = debian/tmp - DOC_PFX = usr/doc - MAN_PFX = usr/man + pwd_version := $(shell expr "${pwd_string}" : '.*+\([0-9.].*\)') endif +pwd_major := $(shell expr "${pwd_version}" : '\([0-9]*\.[0-9]*\)') +# get package/version information from the changelog +package := $(shell (cd ${debian_dir}/.. && \ + dpkg-parsechangelog 2>/dev/null) | awk '/^Source:/ {print $$2}') +version_string := $(shell (cd ${debian_dir}/.. && \ + dpkg-parsechangelog 2>/dev/null) | awk '/^Version:/ {print $$2}') +version_full := $(shell expr "${version_string}" : '\([^-]*\)') +version_debian := $(shell expr "${version_string}" : '[^-]*\(-.*\)') +version := ${version_full} +version_major := $(shell expr "${version_full}" : '\([0-9]*\.[0-9]*\)') +version_minor := $(shell expr "${version_full}" : '[0-9]*\.[0-9]*\.\(.*\)') +ifneq (, $(findstring +,${version_minor})) + beta_version := $(shell expr "${version_full}" : '.*+\([0-9.].*\)') + beta_major := $(shell expr "${beta_version}" : '\([0-9]*\.[0-9]*\)') + beta_minor := $(shell expr "${beta_version}" : '[0-9]*\.[0-9]*\.\(.*\)') + ifneq (, $(beta_version)) + version := ${beta_version} + version_major := ${beta_major} + version_minor := ${beta_minor} + endif + endif + +# Many things depend upon which release (slink, potato, woody, etc.) +PKG_DIR := ${debian_dir}/${package} +DATA_DIR := /usr/share +ifeq (v4, $(shell (cd ${debian_dir}/.. && dh_testversion 4.0.0 2>/dev/null && echo 'v4'))) + DH_COMPAT := 4 +else + ifeq (v3, $(shell (cd ${debian_dir}/.. && dh_testversion 3.0.0 2>/dev/null && echo 'v3'))) + DH_COMPAT := 3 + else + ifeq (v2, $(shell (cd ${debian_dir}/.. && dh_testversion 2.0.40 2>/dev/null && echo 'v2'))) + DH_COMPAT := 2 + else + DH_COMPAT := 1 + PKG_DIR := ${debian_dir}/tmp + DATA_DIR := /usr + endif + endif + endif export DH_COMPAT -MAN_DIR="$(TEMP_DIR)/$(MAN_PFX)" -DOC_DIR="$(TEMP_DIR)/$(DOC_PFX)" +# the dbs rules +TAR_DIR := ${package}-${version} +# Handle the case where the changelog is newer that what we're building +ifneq (yes, $(shell test -e ${debian_dir}/../${TAR_DIR}.tar.gz && echo 'yes')) + TAR_DIR := ${package}-${pwd_version} + endif +SOURCE_DIR := build-tree +BUILD_TREE := ${SOURCE_DIR}/${TAR_DIR} +PATCH_DIR := ${debian_dir}/patches/${version_major}/${version} +SCRIPT_DIR := ${debian_dir}/scripts +STAMP_DIR := ${debian_dir}/build/stampdir + +# Include Debian Autoconf settings +ifeq (yes, $(shell test -e ${debian_dir}/build/autoconf.mk && echo 'yes')) + include ${debian_dir}/build/autoconf.mk +else + include ${debian_dir}/build/autoconf.mk.in + endif + +# these are strictly for my own consuption +PKG_DOC := ${debian_dir}/${package}-doc${docdir}/${package}-doc +MAKE_SUBDIRS := examples local sensible_mda +PACKAGES := sendmail sendmail-doc libmilter-dev +SM_SUBDIRS := editmap libmilter mail.local mailstats \ + makemap praliases rmail sendmail smrsh vacation +# +# We want delayed interpretation of the options ! +ifeq (yes, $(shell test -x /usr/bin/debuild && echo 'yes')) + DEB_BUILD = \ + SM_CONF_OPT="${SM_CONF_OPT}" \ + SM_BUILD_OPT="${SM_BUILD_OPT}" \ + DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS}" \ + debuild -e SM_CONF_OPT -e SM_BUILD_OPT +else + DEB_BUILD = \ + SM_CONF_OPT="${SM_CONF_OPT}" \ + SM_BUILD_OPT="${SM_BUILD_OPT}" \ + DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS}" \ + dpkg-buildpackage + endif + +# Process build-time options: +# 1) options from SM_BUILD_OPT (Prior to configure) +# 2) defaults (Prior to configure) +ENABLE_INDEP := yes +ENABLE_ARCH := yes +ENABLE_LIB := no +ENABLE_BIN := yes +ifneq (, $(findstring notls,${SM_BUILD_OPT})) + ENABLE_TLS := no +else + ENABLE_TLS := yes + endif +ifneq (, $(findstring noauth,${SM_BUILD_OPT})) + ENABLE_AUTH := no +else + ENABLE_AUTH := yes + endif +ifneq (, $(findstring nodev,${SM_BUILD_OPT})) + ENABLE_DEV := no +else + ENABLE_DEV := yes + endif +ifneq (, $(findstring nodoc,${SM_BUILD_OPT})) + ENABLE_DOC := no +else + ENABLE_DOC := yes + endif +# +# Summarize above options into -INDEP and -ARCH for this Makefile +ENABLE_INDEP := ${ENABLE_DOC} +ifeq (no, ${ENABLE_BIN}) + ifeq (no, ${ENABLE_LIB}) + ifeq (no, ${ENABLE_DEV}) + ENABLE_ARCH := no + endif + endif + endif + +all: + @echo 'Please specify a real target in the future...'; + $(MAKE) -f ${debian_dir}/rules \ + version_string=${pwd_string} \ + SM_CONF_OPT="${SM_CONF_OPT}" SM_BUILD_OPT="${SM_BUILD_OPT}" \ + DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS}" \ + binary; + +#------------------------------------------------------------------------------ +# Rules to maintain the external Debian directory +#------------------------------------------------------------------------------ +#------------- +refresh-dbs: + @echo 'updating debian/scripts directory...'; + cp -af /usr/share/dbs/* ${SCRIPT_DIR}/; + chmod a-w ${SCRIPT_DIR}/*; + +#------------- +refresh-debian: + @dh_testdir; + @echo 'updating debian directory ...'; + sudo $(RM) -r debian; + cp -a ../debian ./; + sudo $(RM) -r ${SOURCE_DIR} ${STAMP_DIR}; + rm -f ${debian_dir}/config.status; + touch ${debian_dir}/rules; + $(MAKE) -f ${debian_dir}/rules \ + version_string=${pwd_string} \ + SM_CONF_OPT="${SM_CONF_OPT}" SM_BUILD_OPT="${SM_BUILD_OPT}" \ + DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS}" \ + debian-setup; + +debian-setup: + # Force a configure here, using $${PWD} so the changelog, etc. + # wind up with the right version numbers + rm -f ${debian_dir}/configure ${debian_dir}/config.status; + rm -f ${debian_dir}/build/autoconf.mk; + $(MAKE) -f ${debian_dir}/rules \ + version_string=${pwd_string} \ + SM_CONF_OPT="${SM_CONF_OPT}" SM_BUILD_OPT="${SM_BUILD_OPT}" \ + DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS}" \ + configure; + $(MAKE) -f ${debian_dir}/rules clean-debian; + + # Remove pieces not needed for further building + find ${debian_dir}/patches -type d -a ! -name 'patches' \ + -a ! -name 'contrib' \ + -a ! -name "${pwd_major}" \ + -a ! -name "${pwd_version}" \ + | xargs -r $(RM) -r; + $(RM) -r ${debian_dir}/bugs ${debian_dir}/private ${debian_dir}/watch; + $(RM) ${debian_dir}/build/acinclude.m4 \ + ${debian_dir}/build/aclocal.m4 \ + ${debian_dir}/build/sendmail.m4 \ + ${debian_dir}/build/ndbm.m4 \ + ${debian_dir}/config.log ${debian_dir}/config.cache \ + ${debian_dir}/config.status \ + ${debian_dir}/build/config.guess ${debian_dir}/build/config.sub; + $(RM) -r ${debian_dir}/autom4te.cache; + # Fakeout Make to look like current + $(RM) ${debian_dir}/configure.ac; + echo `date` > ${debian_dir}/configure.ac; + touch ${debian_dir}/configure; + touch ${debian_dir}/rules; + + +#------------- +clean-debian: + @echo 'cleaning debian directory...'; + find ${debian_dir} -name '*~' -o -name '\.*\.swp' \ + | xargs -r rm; + $(RM) ${debian_dir}/*.sav; + $(RM) ${debian_dir}/config.log ${debian_dir}/config.cache \ + ${debian_dir}/config.status \ + ${debian_dir}/build/config.guess.sav \ + ${debian_dir}/build/config.sub.sav; + $(RM) -r ${debian_dir}/autom4te.cache; + # can't touch control/changelog/configure -- needed by debuild, etc + for file in $$(find ${debian_dir} -type f -name '*\.in' \ + -a ! -name 'configure.in'); do \ + $(RM) $$(echo "$$file" | sed -e 's/\.in$$//'); \ + done; + $(RM) ${STAMP_DIR}/autotools ${STAMP_DIR}/configure; + +#------------- +refresh-faq: + @echo 'Refreshing FAQ' + @chmod u+w ${debian_dir}/faq.txt; + (cd ${debian_dir} && wget --passive-ftp --timestamping \ + --cache=off http://www.sendmail.org/faq/faq.txt;); + @chmod a-w ${debian_dir}/faq.txt; + @echo 'Refreshing Misc' + @chmod u+w ${debian_dir}/cf/feature/rhsbl.m4; + (cd ${debian_dir}/cf/feature && wget --passive-ftp --timestamping \ + --cache=off http://www.rfc-ignorant.org/rhsbl.m4;); + @chmod u-w ${debian_dir}/cf/feature/rhsbl.m4; + + +#------------- +world: + # Debian build daemons don't (for the nonce) support build-indep, + # so this rule allows *me* to build both arch and indep portions + # of sendmail in one go (so I don't forget). + @dh_testdir; + $(MAKE) -f ${debian_dir}/rules info; + time ${DEB_BUILD} -rfakeroot + +test: + @dh_testdir; + $(MAKE) -f ${debian_dir}/rules clean-debian; + fakeroot $(MAKE) -f ${debian_dir}/rules clean; + $(MAKE) -f ${debian_dir}/rules \ + ENABLE_TLS=yes ENABLE_DEV=no ENABLE_DOC=no \ + CFLAGS='-O2 -Wall' DEB_BUILD_OPTIONS='nostrip' configure; + #time ${DEB_BUILD} -rfakeroot -d -us -uc; + time $(MAKE) -f ${debian_dir}/rules build-arch; + +print: + @dh_testdir; + -(cd ${BUILD_TREE}/.. && \ + for file in `find . -name 'README'`; do \ + lpr $$file; \ + done; ); + -(cd ${BUILD_TREE}/.. && \ + lpr */KNOWNBUGS; \ + lpr */RELEASE_NOTES; \ + lpr */sendmail/SECURITY; \ + lpr */sendmail/TUNING; \ + lpr */sendmail/TRACEFLAGS; \ + lpr */doc/op/op.ps; \ + lpr */cf/feature/nullclient.m4; \ + lpr */cf/feature/msp.m4; \ + ); + -(cd ${debian_dir} && \ + lpr ../../${debian_dir}/configure.ac; \ + lpr ../../${debian_dir}/build/rules.in; \ + lpr build/site.config.m4.in; \ + lpr cf/hack/msp_nullclient.m4; \ + ); + + +#------------------------------------------------------------------------------ +# Misc rules +#------------------------------------------------------------------------------ +#------------- +${STAMP_DIR}: + mkdir -p ${STAMP_DIR}; + + +#------------------------------------------------------------------------------ +# Autoconf rules +#------------------------------------------------------------------------------ +#------------- +${debian_dir}/rules: ${debian_dir}/build/rules.in ${debian_dir}/config.status + # *** *** *** configure changed ?!? *** *** *** + if [ -e ${debian_dir}/config.status ]; then \ + chmod ug+x ${debian_dir}/config.status; \ + (cd ${debian_dir} && ./config.status;); \ + fi; + +#------------- +${debian_dir}/config.status: ${debian_dir}/configure + # *** *** *** configure changed ?!? *** *** *** + if [ -e ${debian_dir}/config.status ]; then \ + chmod ug+x ${debian_dir}/config.status; \ + (cd ${debian_dir} && ./config.status --recheck;) \ + fi; + +#------------- +${debian_dir}/configure: ${debian_dir}/configure.ac + # *** *** *** configure.ac changed ?!? *** *** *** + cp -af ${debian_dir}/configure.ac \ + ${debian_dir}/configure.in; + (cd ${debian_dir} && autoconf;); + $(RM) ${debian_dir}/configure.in; + chmod ug+x ${debian_dir}/configure; + +#------------- +autotools: ${STAMP_DIR} ${STAMP_DIR}/autotools +${STAMP_DIR}/autotools: + + #Add here commands to setup the autotools environment + + # Make sure we have the latest available config.{guess,sub} + # Allow the package to override either by faking the date... + if [ -e /usr/share/misc/config.guess -a \ + -e ${debian_dir}/build/config.guess ]; then \ + OLDDATEGUESS=`${debian_dir}/build/config.guess -t | tr -d - `; \ + NEWDATEGUESS=`/usr/share/misc/config.guess -t | tr -d - `; \ + if [ "$$OLDDATEGUESS" -lt "$$NEWDATEGUESS" ]; then \ + if [ ! -e ${debian_dir}/build/config.guess.sav ]; then \ + cp -pf ${debian_dir}/build/config.guess \ + ${debian_dir}/build/config.guess.sav;\ + fi; \ + if [ -e ${debian_dir}/build/config.guess.sav ]; then \ + cp -pf /usr/share/misc/config.guess \ + ${debian_dir}/build/config.guess; \ + fi; \ + fi; \ + fi; + if [ -e /usr/share/misc/config.sub -a \ + -e ${debian_dir}/build/config.sub ]; then \ + OLDDATESUB=`${debian_dir}/build/config.sub -t | tr -d - `; \ + NEWDATESUB=`/usr/share/misc/config.sub -t | tr -d - `; \ + if [ "$$OLDDATESUB" -lt "$$NEWDATESUB" ]; then \ + if [ ! -e ${debian_dir}/build/config.sub.sav ]; then \ + cp -pf ${debian_dir}/build/config.sub \ + ${debian_dir}/build/config.sub.sav; \ + fi; \ + if [ -e ${debian_dir}/build/config.sub.sav ]; then \ + cp -pf /usr/share/misc/config.sub \ + ${debian_dir}/build/config.sub; \ + fi; \ + fi; \ + fi; + + touch ${STAMP_DIR}/autotools; + + + +#------------------------------------------------------------------------------ +# Build/Package check rules +#------------------------------------------------------------------------------ #------------- info: #-------------------------------------------------------------------- # The following information will be used for this run: - # Package = $(package) - # version = $(version) - # DH_VERBOSE = $(DH_VERBOSE) - # DH_OPTIONS = $(DH_OPTIONS) - # DH_COMPAT = $(DH_COMPAT) - # TEMP_DIR = $(TEMP_DIR) - # MAN_PFX = $(MAN_PFX) - # DOC_PFX = $(DOC_PFX) + # Source = ${package} ${pwd_string} + # Package = ${package} ${version_string} + # Version = ${version_major}.${version_minor}${version_debian} + # Arch = ${DEB_BUILD_ARCH} on ${DEB_HOST_ARCH} + # Options + # config opt = ${SM_CONF_OPT} + # build opt = ${SM_BUILD_OPT} + # ENABLE_TLS = ${ENABLE_TLS} + # ENABLUE_AUTH= ${ENABLE_AUTH} + # 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} #-------------------------------------------------------------------- - #------------- -setup: setup-stamp -setup-stamp: info - - # Mark some files executable, dpkg-source -x undoes me here... - chmod a+x \ - debian/rules \ - debian/local/configure \ - debian/local/sendmailconfig \ - debian/local/updatedb \ - debian/local/parsemc +buildinfo: + @echo ''; + @dpkg -l \ + debhelper \ + dpkg-dev \ + gcc \ + 'libc6*' \ + binutils \ + ldso \ + make \ + m4 \ + libdb3 libdb3-dev \ + libdb2 libdb2-dev \ + libwrap0 libwrap0-dev \ + libldap2 libldap2-dev \ + libopenldap1 libopenldap-dev \ + umich-libldap umich-libldap-dev \ + libsasl7 libsasl-dev \ + openssl libssl-dev 'libssl0*' \ + ${BUILD_INFO} \ + 2> /dev/null \ + | awk '$$1 == "ii" { printf("%s-%s\n", $$2, $$3) }' \ + | tee ${debian_dir}/${package}.buildinfo.Debian; + @echo ''; + @chmod 644 ${debian_dir}/${package}.buildinfo.Debian; - # Create proper debian/$(package).dirs file - # This way, we can build for either slink or potato - sed "s?MAN_PFX?$(MAN_PFX)?g" \ - debian/$(package).dirs.template \ - | sed "s?\DOC_PFX?$(DOC_PFX)?g" \ - > debian/$(package).dirs +#------------- +pristine: + @dh_testdir; + #$(MAKE) -f ${debian_dir}/rules info; + # + # Fail if there are any modifications to the original + # tarball, other than the debian directory + if [ -f ../${package}_${version_string}.diff.gz ]; then \ + zgrep -e "^\+\+\+ " ../${package}_${version_string}.diff.gz \ + | sed -e "/^\+\+\+ ${package}-${version}\/debian\/.*$$/d" - \ + | sed -e "/^+\+\+ ${package}-${version}\/upstream\/patches\/.*$$/d" - \ + | [ ! -z - ]; \ + fi; - # Use autoconf for some Slink/Potato differences - #cd debian/local && autoconf - cd debian/local && ./configure + # Check for presence of TLS (crypto) enablement and bitch if found + @if (grep -qEe '^#TLS:[[:space:]]*yes' \ + ${debian_dir}/build/site.config.m4); then \ + echo '** ** --------------------------------------------------- ** **';\ + echo '** ** This package contains crypto support ! Be careful ! ** **';\ + echo '** ** --------------------------------------------------- ** **';\ + fi; - touch setup-stamp +#------------- +verify: + @dh_testdir; + # Verifying the md5 summs and signed files + @for file in $$(find . -maxdepth 1 -name '*.md5'); do \ + echo "Checking MD5 source: $$file."; \ + cat $$file; \ + md5sum -c $$file; \ + done; + @for file in $$(find . -maxdepth 1 -name '*.sig'); do \ + echo "Checking signature file $$file."; \ + part=$$(echo "$$file" | sed -e 's/\.sig$$//'); \ + if [ -f $$part ]; then \ + gpg --verify $$part.sig $$part || true; \ + elif [ -f $$part.gz ]; then \ + gunzip -c $$part.gz > $$part; \ + gpg --verify $$part.sig $$part || true; \ + rm $$part; \ + fi; \ + done; +#------------------------------------------------------------------------------ +# User callable rules +#------------------------------------------------------------------------------ #------------- clean: - dh_testdir - dh_testroot - rm -f setup-stamp build-stamp install-stamp + dh_testdir; + dh_testroot; # Add here commands to clean up after the build process. - #-$(MAKE) clean - #-$(MAKE) distclean - - # First, remove any patches - if [ -f patch-stamp ]; then $(MAKE) -f debian/rules unpatch; fi + #-$(MAKE) clean; + #-$(MAKE) distclean; - # Finally, clean the whole enchilada - #-$(MAKE) clean -S + # First, remove any patches, and source directories + #$(MAKE) -f ${debian_dir}/sys-build.mk source.clean; # Debian stuff - rm -f debian/check.tar debian/local/sensible-mda - rm -f debian/local/site.config.m4 - rm -f debian/local/config.* - rm -rf debian/tmp debian/$(package) + $(RM) -r ${SOURCE_DIR} ${STAMP_DIR}; + $(RM) ${debian_dir}/*.buildinfo.Debian; + for file in tmp ${PACKAGES};do \ + $(RM) -r ${debian_dir}/$$file; \ + done; - # Local approximation of distclean - for file in \ - mail.local mailstats makemap praliases rmail smrsh src; do \ - rm -rf $$(find . -name "obj*" -type d); \ - done; + # Local stuff + for subdir in ${MAKE_SUBDIRS}; do \ + (cd ${debian_dir}/$$subdir && $(MAKE) -f Makefile.in clean;); \ + done; + +ifeq (3, $(shell test ${DH_COMPAT} -ge 3 && echo '3')) + # Debhelper V3 conffile handling - prevent duplicates + for file in $$(find ${debian_dir} -maxdepth 1 -type f \ + -name '*\.conffiles\.sav'); do \ + mv $$file $$(echo "$$file" | sed -e 's?\.sav$$??'); \ + done; +endif + + # can't touch control/changelog/configure -- needed by debuild, etc + $(RM) ${debian_dir}/config.log ${debian_dir}/config.cache \ + ${debian_dir}/config.status; + $(RM) -r ${debian_dir}/autom4te.cache + for file in $$(find ${debian_dir} -type f -name '*\.in' \ + -a ! -name 'configure.in'); do \ + $(RM) $$(echo "$$file" | sed -e 's/\.in$$//'); \ + done; + + # Restore pre-existing config.{guess,sub} + -if [ -e ${debian_dir}/buil/config.sub.sav ]; then \ + cp -pf ${debian_dir}/build/config.sub.sav \ + ${debian_dir}/build/config.sub \ + && $(RM) ${debian_dir}/build/config.sub.sav; \ + fi; + -if [ -e ${debian_dir}/build/config.guess.sav ]; then \ + cp -pf ${debian_dir}/build/config.guess.sav \ + ${debian_dir}/build/config.guess \ + && $(RM) ${debian_dir}/build/config.guess.sav; \ + fi; # Cleanup after build (for pristine source, smaller diffs) - #find .. -name $(package)*.asc -size 0 -maxdepth 1 -exec rm {} ";" + #find .. -name ${package}*.asc -size 0 -maxdepth 1 -exec rm {} ';'; + dh_clean; - dh_clean #------------- -build: build-stamp -build-stamp: setup-stamp - dh_testdir +setup: ${STAMP_DIR}/setup +${STAMP_DIR}/setup: + +# Support separate debian directory +ifeq (yes, $(shell test -d debian && echo 'yes')) + dh_testdir; + + # unpack and patch source + $(MAKE) -f ${SCRIPT_DIR}/dbs-build.mk \ + BUILD_TREE="${BUILD_TREE}" TAR_DIR="${TAR_DIR}" \ + STAMP_DIR="${STAMP_DIR}" PATCH_DIR="${PATCH_DIR}" \ + SCRIPT_DIR="${SCRIPT_DIR}" \ + ${STAMP_DIR}/unpack ${STAMP_DIR}/patch; + + touch ${STAMP_DIR}/setup; +endif + + +#------------- +configure: ${STAMP_DIR}/configure +${STAMP_DIR}/configure: ${STAMP_DIR}/setup ${STAMP_DIR}/autotools + + $(MAKE) -f ${debian_dir}/rules info; + + #Add here commands to configure the package. + #./configure --prefix=/usr + + # Use autoconf to handle varying degrees of library support + # NOTE: options values are Yes/No/Auto, but auto isn't always + # used herein, as it can cause problems to be ignored + # so it is only used on items of lesser importance + chmod ug+x ${debian_dir}/configure; + (cd ${debian_dir} && \ + ./configure \ + --build=${DEB_BUILD_GNU_TYPE} \ + --host=${DEB_HOST_GNU_TYPE} \ + --prefix=/usr \ + --libexecdir=/usr/lib/sm.bin \ + --datadir=${DATA_DIR} \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --infodir=${DATA_DIR}/info \ + --mandir=${DATA_DIR}/man \ + --srcdir=${pwd_dir}/debian \ + --with-buildtree=${BUILD_TREE} \ + --with-docdir=${DATA_DIR}/doc \ + --with-revision=${version_debian} \ + --enable-regex=auto \ + --enable-ndbm=no \ + --enable-newdb=yes \ + --enable-nis=auto \ + --enable-nisplus=auto \ + --enable-ldap=yes \ + --enable-hesiod=no \ + --enable-tcpd=auto \ + --enable-bind=no \ + --enable-ipv6=auto \ + --enable-maillock=yes \ + --enable-auth=${ENABLE_AUTH} \ + --enable-tls=${ENABLE_TLS} \ + --enable-shm=auto \ + --enable-doc=${ENABLE_DOC} \ + --enable-dev=${ENABLE_DEV} \ + ${SM_CONF_OPT} \ + ;); + # CC="${CC}" CFLAGS="${CFLAGS} + +ifeq (3, $(shell test ${DH_COMPAT} -ge 3 && echo '3')) + # Debhelper V3 conffile handling - prevent duplicates + for file in $$(find ${debian_dir} -maxdepth 1 -type f \ + -name '*.conffiles'); do \ + mv $$file $$file.sav; \ + done; +endif + + touch ${STAMP_DIR}/configure; + + +#------------- +build-indep: ${STAMP_DIR}/build-indep +${STAMP_DIR}/build-indep: ${STAMP_DIR}/configure + +# Skip work if nothing to do... +ifeq (yes, ${ENABLE_INDEP}) + dh_testdir; + + # Document what we're building against + $(MAKE) -f ${debian_dir}/rules buildinfo; + + # Add here commands to build/compile the documentation/package. + #$(MAKE) doc; + + # Only valid on newer (8.11+) Sendmails + #(cd ${BUILD_TREE}/doc/op/ && make op.txt); + # So we'll do it by hand... + $(RM) ${BUILD_TREE}/doc/op/op.txt; + pic -C ${BUILD_TREE}/doc/op/op.me | eqn -C -Tascii \ + | GROFF_NO_SGR=1 groff -Tascii -me | ul -t dumb > ${BUILD_TREE}/doc/op/op.txt; + + # Debian stuff + for subdir in ${MAKE_SUBDIRS}; do \ + (cd ${debian_dir}/$$subdir && $(MAKE) build-indep;); \ + done; +endif + + touch ${STAMP_DIR}/build-indep; + + +#------------- +build-arch: ${STAMP_DIR}/build-arch +${STAMP_DIR}/build-arch: ${STAMP_DIR}/configure + +# Skip work if nothing to do... +ifeq (yes, ${ENABLE_ARCH}) + dh_testdir; + + # Document what we're building against + $(MAKE) -f ${debian_dir}/rules buildinfo; # Add here commands to compile the package. - #$(MAKE) - - # First, install any patches - if [ ! -f patch-stamp ]; then $(MAKE) -f debian/rules patch; fi - - # Finally, build the whole enchilada - cd mail.local && ./Build -f ../debian/local/site.config.m4 \ - LIBS="" - cd mailstats && ./Build -f ../debian/local/site.config.m4 \ - LIBS="" - cd makemap && ./Build -f ../debian/local/site.config.m4 \ - LIBS="-ldb" - cd praliases && ./Build -f ../debian/local/site.config.m4 \ - LIBS="-ldb" - cd rmail && ./Build -f ../debian/local/site.config.m4 \ - LIBS="" - cd smrsh && ./Build -f ../debian/local/site.config.m4 \ - LIBS="" - cd src && ./Build -f ../debian/local/site.config.m4 \ - LIBS="-ldb -lwrap -lnsl -lresolv" - # LIBS="-ldb2 -lwrap -lnsl -lresolv -lldap -llber-openldap" - # MAPDEF="-DNEWDB -DMAP_REGEX -DLDAPMAP $(DNIS_DEF)" + #$(MAKE); + + # Place our m4 configuration files for the sendmail build to use + if [ -d ${BUILD_TREE}/devtools/Site ]; then \ + cp -f ${debian_dir}/build/site.config.m4 ${BUILD_TREE}/devtools/Site/; \ + fi; + + # Correct some paths in upstream man pages + sed -e "s?/usr/adm/sm.bin?${sysconfdir}/mail/smrsh?g" \ + -e "s?sm.bin?${sysconfdir}/mail/smrsh?g" \ + ${BUILD_TREE}/smrsh/smrsh.8 \ + > ${BUILD_TREE}/smrsh/smrsh.8.new; + mv ${BUILD_TREE}/smrsh/smrsh.8.new ${BUILD_TREE}/smrsh/smrsh.8; + sed -e "s?/etc/mail/statistics?${localstatedir}/lib/sendmail/sendmail.st?g"\ + ${BUILD_TREE}/sendmail/sendmail.8 \ + > ${BUILD_TREE}/sendmail/sendmail.8.new; + mv ${BUILD_TREE}/sendmail/sendmail.8.new \ + ${BUILD_TREE}/sendmail/sendmail.8; + + # Finally, build the whole enchilada (we'll let sendmail figure + # which, if any of the dependant libraries each component needs) + for subdir in ${SM_SUBDIRS}; do \ + if [ -d ${BUILD_TREE}/$${subdir} ]; then \ + (cd ${BUILD_TREE}/$${subdir} && ./Build -S;); \ + fi; \ + done; + + # Remove our config m4 files + $(RM) ${BUILD_TREE}/devtools/Site/site.config.m4; # Debian stuff - cd debian/local && gcc -O2 -o sensible-mda sensible-mda.c + for subdir in ${MAKE_SUBDIRS}; do \ + (cd ${debian_dir}/$$subdir && $(MAKE) build-arch;); \ + done; +endif - # Cleanup after build (for pristine source, smaller diffs) - # None - Must leave patches to prevent rebuilds + touch ${STAMP_DIR}/build-arch; - touch build-stamp #------------- -install: DH_OPTIONS= -install: build - dh_testdir - dh_testroot - #dh_clean -k - dh_clean +install-indep: ${STAMP_DIR}/install-indep +${STAMP_DIR}/install-indep: DH_OPTIONS=-i +${STAMP_DIR}/install-indep: ${STAMP_DIR}/build-indep - dh_installdirs +# Skip work if nothing to do... +ifeq (yes, ${ENABLE_INDEP}) + dh_testdir; + dh_testroot; + dh_clean -k; + dh_installdirs; + if [ -x /usr/bin/dh_link ]; then dh_link; fi; - # Add here commands to install the package into $(TEMP_DIR). - #$(MAKE) prefix=`pwd`/$(TEMP_DIR)/usr install + # Add here commands to install the documentation/package. + #$(MAKE) prefix=`pwd`/${PKG_DIR}/usr install; - # sendmail install proper... with a little help ;-} - #$(MAKE) install DESTDIR="$$(pwd)/$(TEMP_DIR)" - cd mail.local/obj* && $(MAKE) force-install \ - DESTDIR="../../$(TEMP_DIR)" - cd mailstats/obj* && $(MAKE) install \ - DESTDIR="../../$(TEMP_DIR)" - cd makemap/obj* && $(MAKE) install \ - DESTDIR="../../$(TEMP_DIR)" - cd praliases/obj* && $(MAKE) install \ - DESTDIR="../../$(TEMP_DIR)" - cd rmail/obj* && $(MAKE) force-install \ - DESTDIR="../../$(TEMP_DIR)" - cd smrsh/obj* && $(MAKE) install \ - DESTDIR="../../$(TEMP_DIR)" - cd src/obj* && $(MAKE) install \ - DESTDIR="../../$(TEMP_DIR)" - - # correct what the m4 build process did... - mv $(TEMP_DIR)/usr/bin/rmail $(TEMP_DIR)/usr/sbin/rmail - #ln -sf ../sbin/rmail $(TEMP_DIR)/usr/bin/rmail - rm -f $(TEMP_DIR)/var/lib/sendmail/sendmail.st - chown root.mail $(TEMP_DIR)/usr/share/sendmail/sendmail.hf - # NOTE: whilst smptd is a valid alias for sendmail, we don't create - # one so that we can co-exists with smtpd (a firewall frontend) - # NOTE: newscache package also contains /usr/sbin/hoststat - cd $(TEMP_DIR)/usr/bin && \ - rm -f hoststat mailq newaliases purgestat smtpd - for file in \ - $(TEMP_DIR)/usr/bin/mailq \ - $(TEMP_DIR)/usr/lib/sendmail; do \ - ln -sf ../sbin/sendmail $$file; \ + # sendmail operations guide and other documentation + $(INSTALL_DATA) ${BUILD_TREE}/doc/op/op.ps ${PKG_DOC}/op; + $(INSTALL_DATA) ${BUILD_TREE}/doc/op/op.txt ${PKG_DOC}/op; + $(INSTALL_DATA) ${BUILD_TREE}/README ${PKG_DOC}/; + $(INSTALL_DATA) ${BUILD_TREE}/KNOWNBUGS ${PKG_DOC}/; + $(INSTALL_DATA) ${BUILD_TREE}/cf/README ${PKG_DOC}/cf.README; + $(INSTALL_DATA) debian/README.Debian.sendmail \ + ${PKG_DOC}/sendmail/README.Debian; + $(INSTALL_DATA) ${BUILD_TREE}/sendmail/README \ + ${PKG_DOC}/sendmail/; + if [ -f ${BUILD_TREE}/sendmail/SECURITY ]; then \ + $(INSTALL_DATA) ${BUILD_TREE}/sendmail/SECURITY \ + ${PKG_DOC}/sendmail/SECURITY; \ + fi; + $(INSTALL_DATA) ${BUILD_TREE}/sendmail/TRACEFLAGS \ + ${PKG_DOC}/sendmail/TRACEFLAGS; + if [ -f ${BUILD_TREE}/sendmail/TUNING ]; then \ + $(INSTALL_DATA) ${BUILD_TREE}/sendmail/TUNING \ + ${PKG_DOC}/sendmail/TUNING; \ + fi; + sed -e "s?/usr/libexec?${libexecdir}?g" \ + -e "s?/usr/ucb/vacation?${libexecdir}/vacation.sendmail?g" \ + -e "s?/usr/adm/sm.bin?/etc/mail/smrsh?g" \ + ${BUILD_TREE}/smrsh/README \ + > ${PKG_DOC}/smrsh.README; + $(INSTALL_DATA) debian/faq.txt ${PKG_DOC}/; + + # libmilter-dev package + if [ -d ${BUILD_TREE}/libmilter ]; then \ + $(INSTALL_DATA) debian/README.Debian.libmilter-dev \ + ${PKG_DOC}/libmilter/README.Debian; \ + $(INSTALL_DATA) ${BUILD_TREE}/libmilter/README \ + ${PKG_DOC}/libmilter/README; \ + if [ -d ${BUILD_TREE}/libmilter/docs ]; then \ + cp -a ${BUILD_TREE}/libmilter/docs/* \ + ${PKG_DOC}/libmilter/html; \ + fi; \ + fi; + + # Debian stuff + for subdir in ${MAKE_SUBDIRS}; do \ + (cd ${debian_dir}/$$subdir && \ + $(MAKE) install-indep \ + DESTDIR="../../${PKG_DOC}";); \ done; - # newalias, purgestat, etc. aren't for the general user... - # yeah, yeah, I know... these can be done with -bxxx as well! - cd $(TEMP_DIR)/usr/sbin && for file in \ - newaliases purgestat \ - ; do \ - ln -sf sendmail $$file; \ + + # Multiple package fixup + #dh_movefiles -i --sourcedir debian/${package}; + + # Actions from binary-common + # + dh_fixperms; + # + # Cleanup misc permissions, etc... (fakeroot, dh_fixperms, etc.) +endif + + touch ${STAMP_DIR}/install-indep; + + +#------------- +install-arch: ${STAMP_DIR}/install-arch +${STAMP_DIR}/install-arch: DH_OPTIONS=-a +${STAMP_DIR}/install-arch: ${STAMP_DIR}/build-arch + +# Skip work if nothing to do... +ifeq (yes, ${ENABLE_ARCH}) + dh_testdir; + dh_testroot; + dh_clean -k; + dh_installdirs; + if [ -x /usr/bin/dh_link ]; then dh_link; fi; + + # Add here commands to install the package into ${PKG_DIR}. + #$(MAKE) prefix=`pwd`/${PKG_DIR}/usr install; + + # sendmail install proper... with a little help ;-} + #$(MAKE) install DESTDIR="$${pwd}/${PKG_DIR}"; + + # Finally, install the whole enchilada + for subdir in ${SM_SUBDIRS}; do \ + if [ -d ${BUILD_TREE}/$${subdir} ]; then \ + if [ "$${subdir}" = 'libmilter' ]; then \ + :; \ + elif [ "$${subdir}" = 'mail.local' -o \ + "$${subdir}" = 'rmail' ]; then \ + (cd ${BUILD_TREE}/obj*/$${subdir} && \ + $(MAKE) force-install \ + DESTDIR="../../../../${PKG_DIR}";); \ + else \ + (cd ${BUILD_TREE}/obj*/$${subdir} && \ + $(MAKE) install \ + DESTDIR="../../../../${PKG_DIR}";); \ + fi; \ + fi; \ done; + # Support older Sendmail (below 8.10.0) + if [ -f ${PKG_DIR}${sysconfdir}/mail/sendmail.hf ]; then \ + mv -f ${PKG_DIR}${sysconfdir}/mail/sendmail.hf \ + ${PKG_DIR}${sysconfdir}/mail/helpfile; \ + $(RM) ${PKG_DIR}${localstatedir}/lib/sendmail/sendmail.st; \ + fi; - # create some usefull defaults in /usr/lib/sm.bin (for smrsh) - cd $(TEMP_DIR)/usr/lib/sm.bin && \ - ln -sf ../../bin/procmail procmail && \ - ln -sf ../../bin/deliver deliver && \ - ln -sf ../../bin/vacation vacation - - # sendmail documentation - install -pm 0444 doc/*/*.ps $(DOC_DIR)/$(package)/ - cd doc && { \ - for doc in \ - changes/changes intro/intro op/op usenix/usenix; do\ - base=$$(basename $$doc.txt); \ - test -f $$doc.txt || \ - nroff -me $$doc.me | \ - cat -s > ../$(DOC_DIR)/$(package)/$$base; \ - done; \ - } + # FHS says that rmail belongs in ${sbindir} + mv ${PKG_DIR}${bindir}/rmail ${PKG_DIR}${sbindir}/rmail; + # Sendmail alias handling... + # NOTE: whilst smptd is a valid alias for sendmail, we don't create + # one so that we can co-exists with smtpd (a firewall frontend) + # NOTE: newscache package also contains ${sbindir}/hoststat + # NOTE: newalias, purgestat, etc. aren't for the general user.. + # yeah, yeah, I know... these can be done with -b<flag>! + (cd ${PKG_DIR}${bindir} && \ + $(RM) hoststat mailq newaliases purgestat smtpd;) + ln -sf ../sbin/sendmail ${PKG_DIR}${libdir}/sendmail; + (cd ${PKG_DIR}${sbindir} && for file in \ + newaliases hoststat purgestat \ + ; do \ + ln -sf sendmail $$file; \ + done;); + # Handle man pages for these aliases + (cd ${PKG_DIR}${mandir}/man8 && for file in \ + hoststat.8.gz purgestat.8.gz \ + ; do \ + ln -sf sendmail.8.gz $$file; \ + done;); + # Place those removed aliases in ${libexecdir} (mostly for me) + (cd ${PKG_DIR}${libexecdir} && for file in \ + hoststat mailq newaliases purgestat smtpd; do \ + ln -sf ../../sbin/sendmail $$file; \ + done;); + # NOTE: with the MSP/MTA split, we'll provide our own mailstats (keep orig) + mv ${PKG_DIR}${sbindir}/mailstats \ + ${PKG_DIR}${libexecdir}/mailstats; + # Special handling of vacation - Debian has a seperate package + # with a different version (sigh) keep our copy just in case... + if [ -d ${BUILD_TREE}/vacation ]; then \ + mv ${PKG_DIR}${bindir}/vacation \ + ${PKG_DIR}${libexecdir}/vacation.sendmail; \ + mv ${PKG_DIR}${mandir}/man1/vacation.1 \ + ${PKG_DIR}${mandir}/man1/vacation.sendmail.1; \ + fi; # m4 configuration directories - install -pm 0444 cf/README \ - $(DOC_DIR)/$(package)/cf.README - cp -a cf/* $(TEMP_DIR)/usr/share/$(package)/sendmail.cf - rm -f $(TEMP_DIR)/usr/share/$(package)/sendmail.cf/README + cp -a ${BUILD_TREE}/cf/* ${PKG_DIR}${datadir}/sendmail/cf; + $(RM) ${PKG_DIR}${datadir}/sendmail/cf/README; + $(RM) ${PKG_DIR}${datadir}/sendmail/cf/sendmail.schema; + $(RM) ${PKG_DIR}${datadir}/sendmail/cf/cf/Build; + $(RM) ${PKG_DIR}${datadir}/sendmail/cf/cf/Makefile; + $(RM) ${PKG_DIR}${datadir}/sendmail/cf/cf/*.cf; # contributed stuff - scripts - sed "s?/usr/local/bin/perl?/usr/bin/perl?g" contrib/etrn.pl \ - | sed "s?/etc/sendmail.cf?/etc/mail/sendmail.cf?g" \ - > $(TEMP_DIR)/usr/sbin/etrn - chmod 0755 $(TEMP_DIR)/usr/sbin/etrn - sed "s?/usr/local/bin/perl?/usr/bin/perl?g" contrib/expn.pl \ - > $(TEMP_DIR)/usr/bin/expn - chmod 0755 $(TEMP_DIR)/usr/bin/expn - sed "s?/etc/sendmail.cf?/etc/mail/sendmail.cf?g" \ + sed -e 's?/usr/local/bin/perl?/usr/bin/perl?g' \ + -e "s?/etc/sendmail.cf?${sysconfdir}/mail/sendmail.cf?g" \ + ${BUILD_TREE}/contrib/etrn.pl \ + > ${PKG_DIR}${sbindir}/etrn; + chmod 0755 ${PKG_DIR}${sbindir}/etrn; + if [ -f ${BUILD_TREE}/contrib/etrn.0 ]; then \ + sed 's?/usr/local/bin/perl?/usr/bin/perl?g' \ + ${BUILD_TREE}/contrib/etrn.0 \ + > ${PKG_DIR}${mandir}/man8/etrn.8; \ + else \ + sed 's?/usr/local/bin/perl?/usr/bin/perl?g' \ + ${BUILD_TREE}/contrib/etrn.pl \ + > ${PKG_DIR}${mandir}/man8/etrn.8; \ + fi; + sed -e 's?/usr/local/bin/perl?/usr/bin/perl?g' \ + ${BUILD_TREE}/contrib/expn.pl \ + > ${PKG_DIR}${bindir}/expn; + chmod 0755 ${PKG_DIR}${bindir}/expn; + sed 's?/usr/local/bin/perl?/usr/bin/perl?g' \ + ${BUILD_TREE}/contrib/expn.pl \ + > ${PKG_DIR}${mandir}/man8/expn.8; + sed -e "s?/etc/sendmail.cf?${sysconfdir}/mail/sendmail.cf?g" \ debian/checksendmail/checksendmail.perl \ - > $(TEMP_DIR)/usr/sbin/checksendmail - chmod 0755 $(TEMP_DIR)/usr/sbin/checksendmail - # contributed stuff - man - sed "s?/usr/local/bin/perl?/usr/bin/perl?g" contrib/etrn.pl \ - > $(MAN_DIR)/man8/etrn.8 - sed "s?/usr/local/bin/perl?/usr/bin/perl?g" contrib/expn.pl \ - > $(MAN_DIR)/man8/expn.8 - install -p debian/checksendmail/checksendmail.8 \ - $(MAN_DIR)/man8/ - # contributed stuff - examples - sed "s?/bin/perl?/usr/bin/perl?g" contrib/passwd-to-alias.pl \ - > $(DOC_DIR)/$(package)/examples/passwd-to-alias - chmod 0755 $(DOC_DIR)/$(package)/examples/passwd-to-alias - - # Debian stuff - binaries - install -pm 0755 debian/local/sendmailconfig $(TEMP_DIR)/usr/sbin - install -pm 0755 debian/local/runq $(TEMP_DIR)/usr/sbin - install -pm 0755 debian/local/sensible-mda $(TEMP_DIR)/usr/lib/sm.bin - # Debian stuff - scripts - install -pm 0755 debian/local/parsemc $(TEMP_DIR)/usr/share/sendmail - install -pm 0755 debian/local/updatedb $(TEMP_DIR)/usr/share/sendmail - install -pm 0755 debian/local/ip-up.d \ - $(TEMP_DIR)/etc/ppp/ip-up.d/sendmail - install -pm 0755 debian/local/ip-down.d \ - $(TEMP_DIR)/etc/ppp/ip-down.d/sendmail - # Debian stuff - config files - install -pm 0660 -g mail debian/local/service.switch* \ - $(TEMP_DIR)/etc/mail/ - # Debian stuff - m4 - cp -a debian/cf/* $(TEMP_DIR)/usr/share/$(package)/sendmail.cf - install -pm 0660 -g mail debian/local/provider \ - $(TEMP_DIR)/etc/mail/peers/provider - - #$(MAKE) -f debian/rules hacks - - # Not quite debhelper v2 compliant yet - #dh_movefiles + > ${PKG_DIR}${sbindir}/checksendmail; + chmod 0755 ${PKG_DIR}${sbindir}/checksendmail; + $(INSTALL_DATA) debian/checksendmail/checksendmail.8 \ + ${PKG_DIR}${mandir}/man8/; + sed -e 's?/usr/local/bin/perl?/usr/bin/perl?g' \ + -e 's?/usr/sbin/sendmail -q30m -bd?/etc/init.d/sendmail start?g' \ + ${BUILD_TREE}/contrib/smcontrol.pl \ + > ${PKG_DIR}${datadir}/sendmail/smcontrol.pl; + chmod 0755 ${PKG_DIR}${datadir}/sendmail/smcontrol.pl; + $(INSTALL_SCRIPT) ${BUILD_TREE}/contrib/doublebounce.pl \ + ${PKG_DIR}${datadir}/sendmail; + if [ -f ${BUILD_TREE}/contrib/qtool.pl ]; then \ + sed -e 's?/usr/bin/env perl?/usr/bin/perl?g' \ + ${BUILD_TREE}/contrib/qtool.pl \ + > ${PKG_DIR}${datadir}/sendmail/qtool.pl; \ + chmod 0755 ${PKG_DIR}${datadir}/sendmail/qtool.pl; \ + $(INSTALL_DATA) ${BUILD_TREE}/contrib/qtool.8 \ + ${PKG_DIR}${mandir}/man8/; \ + fi; + if [ -f ${BUILD_TREE}/contrib/buildvirtuser ]; then \ + $(INSTALL_SCRIPT) ${BUILD_TREE}/contrib/buildvirtuser \ + ${PKG_DIR}${datadir}/sendmail/; \ + fi; - # Cleanup after build (for pristine source, smaller diffs) - $(MAKE) -f debian/rules unpatch + # contributed stuff - examples + sed 's?/bin/perl?/usr/bin/perl?g' \ + ${BUILD_TREE}/contrib/passwd-to-alias.pl \ + > ${PKG_DIR}${datadir}/sendmail/examples/passwd-to-alias; + chmod 0755 ${PKG_DIR}${datadir}/sendmail/examples/passwd-to-alias; + + # contributed stuff - m4 scripts + if [ -f ${BUILD_TREE}/contrib/domainmap.m4 ]; then \ + $(INSTALL_DATA) ${BUILD_TREE}/contrib/domainmap.m4 \ + ${PKG_DIR}${datadir}/sendmail/cf/feature; \ + fi; + if [ -f ${BUILD_TREE}/contrib/dnsblaccess.m4 ]; then \ + $(INSTALL_DATA) ${BUILD_TREE}/contrib/dnsblaccess.m4 \ + ${PKG_DIR}${datadir}/sendmail/cf/hack; \ + fi; + + # Debian stuff + for subdir in ${MAKE_SUBDIRS}; do \ + (cd ${debian_dir}/$$subdir && \ + $(MAKE) install-arch \ + DESTDIR="../../${PKG_DIR}";); \ + done; + # Debian stuff - m4 scripts + (cd debian && \ + for file in $$(find cf -type f -name '*.m4' -o -name '*.mc'); do \ + $(INSTALL_DATA) $$file \ + ../${PKG_DIR}${datadir}/sendmail/$$file; \ + done;); + # Debian stuff - examples + $(INSTALL_DATA) debian/checksendmail/address.resolve \ + ${PKG_DIR}${datadir}/sendmail/examples/; + + # libmilter-dev package +ifeq (yes, ${ENABLE_DEV}) + if [ -d ${BUILD_TREE}/libmilter ]; then \ + (cd ${BUILD_TREE}/obj*/libmilter && \ + $(MAKE) install \ + DESTDIR="../../../../debian/libmilter-dev";); \ + $(INSTALL_PROGRAM) ${BUILD_TREE}/obj.*/libmilter/libmilter.a \ + debian/libmilter-dev${libdir}/libmilter/; \ + $(INSTALL_DATA) ${BUILD_TREE}/include/libmilter/mfapi.h \ + debian/libmilter-dev${includedir}/libmilter/; \ + if [ -f ${BUILD_TREE}/include/libmilter/mfdef.h ]; then \ + $(INSTALL_DATA) ${BUILD_TREE}/include/libmilter/mfdef.h \ + debian/libmilter-dev${includedir}/libmilter/; \ + fi; \ + $(INSTALL_PROGRAM) ${BUILD_TREE}/obj.*/libsmutil/libsmutil.a \ + debian/libmilter-dev${libdir}/libmilter/; \ + if [ -d ${BUILD_TREE}/libsm ]; then \ + $(INSTALL_PROGRAM) ${BUILD_TREE}/obj.*/libsm/libsm.a \ + debian/libmilter-dev${libdir}/libmilter/; \ + fi; \ + fi; +endif + + # Multiple package fixup + #dh_movefiles -a --sourcedir debian/${package}; + + # Actions from binary-common + #dh_installcron; + $(INSTALL_SCRIPT) debian/${package}.cron.daily \ + ${PKG_DIR}${sysconfdir}/cron.daily/sendmail; + #dh_installlogrotate; + #$(INSTALL_DATA) debian/${package}.logrotate \ + # ${PKG_DIR}${sysconfdir}/logrotate.d/sendmail; + # + dh_fixperms; + # + # Cleanup misc permissions, etc... (fakeroot, dh_fixperms, etc.) + chmod a+x ${PKG_DIR}${datadir}/sendmail/cf/sh/makeinfo.sh; + chown root:root ${PKG_DIR}${sysconfdir}/mail/helpfile; + chown root:root ${PKG_DIR}${sysconfdir}/mail/peers/provider; + chown root:root ${PKG_DIR}${sysconfdir}/mail/service.switch*; + # + # You may want to make some executables suid here. + chown root:mail ${PKG_DIR}${sbindir}/sendmail; + chmod 04755 ${PKG_DIR}${sbindir}/sendmail; + chown root:mail ${PKG_DIR}${libexecdir}/mailstats; + chmod 02755 ${PKG_DIR}${libexecdir}/mailstats; + chown root:mail ${PKG_DIR}${libexecdir}/mail.local; + chmod 0755 ${PKG_DIR}${libexecdir}/mail.local; + chown root:mail ${PKG_DIR}${libexecdir}/smrsh; + chmod 0755 ${PKG_DIR}${libexecdir}/smrsh; + chown root:mail ${PKG_DIR}${libexecdir}/sensible-mda; + chmod 0755 ${PKG_DIR}${libexecdir}/sensible-mda; + + # Special case Perl for Debian Slink (2.1), debhelper v1 + if [ ! -x /usr/bin/dh_perl ]; then \ + echo 'perl:Depends=perl5|perl' >> debian/substvars; fi; + + # Install Lintian overrides + $(INSTALL_DATA) -d -g root -m 755 ${PKG_DIR}${datadir}/lintian/overrides + $(INSTALL_DATA) -g root -m 644 debian/${package}.lintian-overrides \ + ${PKG_DIR}${datadir}/lintian/overrides/${package} +endif + + touch ${STAMP_DIR}/install-arch; - touch install-stamp #------------- # This single target is used to build all the packages, all at once, or # one at a time. So keep in mind: any options passed to commands here will # affect _all_ packages. Anything you want to only affect one package # should be put in another target, such as the install target. +# +# Must not depend on anything. This is to be called by +# binary-arch/binary-indep in another 'make' thread. binary-common: # Need this version of debhelper for DH_OPTIONS to work. - dh_testversion 1.1.17 - dh_testdir - dh_testroot - dh_installchangelogs -k RELEASE_NOTES - dh_installcron - if [ -x /usr/bin/dh_installdebconf ]; then dh_installdebconf; fi - dh_installdocs debian/Debian-specific - dh_installemacsen - dh_installexamples - chmod 0755 $(DOC_DIR)/$(package)/examples/passwd-to-alias - chmod 0755 $(DOC_DIR)/$(package)/examples/ip-up.d - chmod 0755 $(DOC_DIR)/$(package)/examples/ip-down.d - if [ -x /usr/bin/dh_installinfo ]; then dh_installinfo; fi - dh_installinit - # install $(TEMP_DIR).init.d $(TEMP_DIR)/etc/init.d/sendmail - dh_installmanpages - cd $(MAN_DIR)/man8 && \ - ln -sf sendmail.8.gz ./purgestat.8.gz - # ln -sf sendmail.8.gz ./hoststat.8.gz - # ln -sf sendmail.8.gz ./sendmail.real.8.gz - sed "s?/usr/adm/sm.bin?/usr/lib/sm.bin?g" smrsh/smrsh.8 \ - > $(MAN_DIR)/man8/smrsh.8 - dh_undocumented - dh_installmenu - if [ -x /usr/bin/dh_installpam ]; then dh_installpam; fi - # - $(MAKE) -s -f debian/rules buildinfo - # - if [ -x /usr/bin/dh_link ]; then dh_link; fi - dh_strip - dh_compress - dh_fixperms + dh_testversion 1.1.17; + dh_testdir; + dh_testroot; + # Done in install-xxx, but still need to get rid of *.debhelper !!! + #dh_clean -k; + $(RM) debian/*.debhelper; + + dh_installchangelogs -k ${BUILD_TREE}/RELEASE_NOTES; + #-------- needs script name ala installinit ---- + # Done in install-xxx + #dh_installcron; + if [ -x /usr/bin/dh_installdebconf ]; then dh_installdebconf; fi; + dh_installdocs; + #dh_installemacsen; + #dh_installexamples; + #if [ -x /usr/bin/dh_installinfo ]; then dh_installinfo; fi; + dh_installinit --init-script=sendmail; + #-------- needs script name ala installinit ---- + # Done in install-xxx + #if [ -x /usr/bin/dh_installlogrotate ]; then dh_installlogrotate; fi; + if [ -x /usr/bin/dh_installman ]; then dh_installman; fi; + #dh_installmenu; + #dh_installmime; + #dh_undocumented; + if [ -x /usr/bin/dh_installpam ]; then dh_installpam; fi; + # Done in install-xxx + #if [ -x /usr/bin/dh_link ]; then dh_link; fi; +ifeq (, $(findstring nostrip,${DEB_BUILD_OPTIONS})) + dh_strip; +else + #dh_strip; +endif + dh_compress; + # Done in install-xxx + #dh_fixperms; + # Need to special case this now that we're using dynamic uid/gid + #if [ -x /usr/sbin/suidregister -a -s /etc/suid.conf ]; then + # dh_suidregister; fi; # - # Cleanup misc permissions, etc... (fakeroot, etc.) - chmod a+x $(TEMP_DIR)/usr/share/sendmail/sendmail.cf/sh/* + # Cleanup misc permissions, etc... (fakeroot, dh_fixperms, etc.) + # Done in install-xxx # # You may want to make some executables suid here. - chmod 04755 $(TEMP_DIR)/usr/sbin/sendmail - chown 0.8 $(TEMP_DIR)/usr/sbin/sendmail - chmod 0755 $(TEMP_DIR)/usr/sbin/mailstats - chown 0.8 $(TEMP_DIR)/usr/sbin/mailstats - chmod 04755 $(TEMP_DIR)/usr/lib/sm.bin/mail.local - chown 0.8 $(TEMP_DIR)/usr/lib/sm.bin/mail.local - chmod 0755 $(TEMP_DIR)/usr/lib/sm.bin/smrsh - chown 0.8 $(TEMP_DIR)/usr/lib/sm.bin/smrsh - chmod 0755 $(TEMP_DIR)/usr/lib/sm.bin/sensible-mda - chown 0.8 $(TEMP_DIR)/usr/lib/sm.bin/sensible-mda + # Done in install-xxx # - dh_suidregister - dh_makeshlibs - dh_installdeb - # - # Can now clean up debian/*.debhelper scripts - rm -f debian/*.debhelper - dh_shlibdeps - # Handle perl specially, to support building under slink - if [ -x /usr/bin/dh_perl ]; then \ - dh_perl; \ - else \ - echo "perl:Depends=perl5" >> debian/substvars; \ - fi - dh_gencontrol - dh_md5sums -x - dh_builddeb + #dh_makeshlibs; + dh_installdeb; + dh_shlibdeps; + if [ -x /usr/bin/dh_perl ]; then dh_perl; fi + dh_gencontrol; + dh_md5sums; + dh_builddeb; + + $(MAKE) -f ${debian_dir}/rules pristine; + #------------- # Build architecture independant packages using the common target. # (Uncomment this next line if you have such packages.) -#binary-indep: build install -# $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common +binary-indep: ${STAMP_DIR}/build-indep ${STAMP_DIR}/install-indep -#------------- -# Build architecture dependant packages using the common target. -binary-arch: build install - $(MAKE) -f debian/rules DH_OPTIONS=-a binary-common +# Skip work if nothing to do... +ifeq (yes, ${ENABLE_INDEP}) + $(MAKE) -f ${debian_dir}/rules DH_OPTIONS=-i binary-common; +endif -#------------- -# Any other binary targets build just one binary package at a time. -binary-%: build install - make -f debian/rules binary-common DH_OPTIONS=-p$* #------------- -l33ch: - dh_testdir - #@echo >&2 'l33ch is obsolete'; false - cd debian && \ - wget --passive-ftp --timestamping \ - http://www.sendmail.org/faq/faq.txt - #ftp://rtfm.mit.edu/pub/usenet/comp.mail.sendmail/sendmail_FAQ - -#------------- -patch: patch-stamp -patch-stamp: - dh_testdir - - $(MAKE) -s -f debian/patches/Makefile patch - - touch patch-stamp - -unpatch: unpatch-stamp -unpatch-stamp: patch-stamp - dh_testdir +# Build architecture dependant packages using the common target. +binary-arch: ${STAMP_DIR}/build-arch ${STAMP_DIR}/install-arch - $(MAKE) -s -f debian/patches/Makefile unpatch +# Skip work if nothing to do... +ifeq (yes, ${ENABLE_ARCH}) + $(MAKE) -f ${debian_dir}/rules DH_OPTIONS=-a binary-common; +endif - rm -f patch-stamp #------------- -hacks: -# cd debian && uudecode check.tar.uue -# cd $(DOC_DIR)/$(package) && tar -xf ../../../../check.tar -# cd $(DOC_DIR)/$(package)/hack; \ -# for file in *; do \ -# sed "s/dbm /hash /g" < $$file \ -# > ../../../share/sendmail.cf/hack/$$file; \ -# done -# sed "s/dbm /hash /g" $(DOC_DIR)/$(package)/README.check \ -# > $(DOC_DIR)/$(package)/README.Spam -# rm $(DOC_DIR)/$(package)/README.check -# rm -r $(DOC_DIR)/$(package)/hack/ +# Any other binary targets build just one binary package at a time. +binary-%: + $(MAKE) -f ${debian_dir}/rules binary-common DH_OPTIONS=-p$*; -#------------- -buildinfo: - @echo; dpkg -l gcc "libc6*" binutils ldso make libdb2 libdb2.6 \ - libopenldap1 dpkg-dev $(BUILDINFO) \ - | awk '$$1 == "ii" { printf("%s-%s\n", $$2, $$3) }' \ - | tee $(DOC_DIR)/$(package)/buildinfo.Debian; echo - chmod 644 $(DOC_DIR)/$(package)/buildinfo.Debian #------------- # Below here is fairly generic really @@ -423,5 +1174,16 @@ buildinfo: source diff: @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false +# Due to buildd not (for the nonce) supporting build-arch, kluge next rule +build: build-arch +install: install-indep install-arch binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install +.PHONY: refresh-dbs refresh-debian update-debian refresh-faq +.PHONY: pristine +.PHONY: info buildinfo +.PHONY: setup autotools configure +.PHONY: clean build build-indep build-arch +.PHONY: install install-indep install-arch +.PHONY: binary binary-indep binary-arch +.SUFFIXES: +.PRECIOUS: ${debian_dir}/rules |