#!/usr/bin/make -f #------------------------------------------------------------------------------ # vim: syntax=make # # $Sendmail: rules,v 8.12.10 2003-07-13 21:46:03 cowboy Exp $ # # Copyright (c) 1998-2003 Richard Nelson. All Rights Reserved. # # ./rules. Generated from rules.in by configure. # # Rules file for Sendmail 8.12.10-6(527370) # on Debian testing/unstable # via Debhelper V4.1 # # Note: the .in file supports Sendmail 8.7.6 - 8.12.10 # 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=''..............-- Site local customization # 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 # A quick means to customize the Debian Sendmail package according # to your sites guidelines ! # 1) Choose a configuration name (ie FooBar) # 2) cp debian/configure.options debian/FooBar.options # 3) $(EDIT) debian/FooBar.options to taste # 4) mkdir debian/FooBar.patches # 5) add any local patches in that directory - following # the style in debian/patches style (ie, 8.13/8.13.3 subdirectory) # 6) cp debian/changelog debian/FooBar.changelog # 7) $(EDIT) debian/FooBar.changelog, delete everything after the # 1st null line (but leave that null!!!) # 8) Update debian/FooBar.changelog to show your updates # 9) SM_CONF="FooBar" debian/rules configure ** IMPORTANT *** # 10) build the package (SM_CONF="FooBar" dpkg-buildpackage or debuild) # # # 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='nodoc' # dpkg-buildpackage -rfakeroot -uc -us # 2) SM_BUILD_OPT='nodoc' dpkg-buildpackage -rfakeroot -uc -us # 3) debuild -e SM_BUILD_OPT='nodoc' -e CLFAGS='-O3 Wall' # etc... # # Supported options values for SM_BUILD_OPT: # 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 2004-11-16 16:17:00 (-0800) #------------------------------------------------------------------------------ #SHELL := /bin/sh -x # Uncomment this to turn on verbose mode. #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 # Support separate debian directory ifeq (yes, $(shell test -d debian && echo 'yes')) debian_dir := ./debian pwd_dir := $(shell pwd) else debian_dir := . pwd_dir := $(shell pwd)/.. SM_CONF_OPT += --enable-maintainer-mode 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}" : '.*-\([X?0-9.].*\)') ifeq (, $(findstring +,${pwd_string})) pwd_version := ${pwd_string} else pwd_version := $(shell expr "${pwd_string}" : '.*+\([0-9.].*\)') endif ifneq (, $(findstring Final,${pwd_version})) pwd_version := $(shell expr "${pwd_version}" : '\(.*\)\.Final') endif pwd_major := $(shell expr "${pwd_version}" : '\([0-9]*\.[0-9]*\)') # get package/version information from the changelog package := $(shell (cd ${debian_dir}/.. >/dev/null && \ dpkg-parsechangelog 2>/dev/null) | awk '/^Source:/ {print $$2}') version_string := $(shell (cd ${debian_dir}/.. >/dev/null && \ dpkg-parsechangelog 2>/dev/null) | awk '/^Version:/ {print $$2}') # Remove local site name from version string ifneq (, ${SM_CONF}) ifneq (, $(findstring ${SM_CONF}.,${version_string})) version_string := $(shell expr "${version_string}" : "${SM_CONF}.\(.*\)") endif endif 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}-bin DATA_DIR := /usr/share ifeq (v4, $(shell (cd ${debian_dir}/.. >/dev/null && dh_testversion 4.0.0 2>/dev/null && echo 'v4'))) DH_COMPAT := 4 else ifeq (v3, $(shell (cd ${debian_dir}/.. >/dev/null && dh_testversion 3.0.0 2>/dev/null && echo 'v3'))) DH_COMPAT := 3 else ifeq (v2, $(shell (cd ${debian_dir}/.. >/dev/null && 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 # 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 PACKAGES := sendmail sendmail-base sendmail-cf sendmail-doc \ libmilter-dev rmail sensible-mda 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_BUILD_OPT="${SM_BUILD_OPT}" \ SM_CONF="${SM_CONF}" \ SM_CONF_OPT="${SM_CONF_OPT}" \ DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS}" \ debuild -e SM_CONF -e SM_CONF_OPT -e SM_BUILD_OPT else DEB_BUILD = \ SM_BUILD_OPT="${SM_BUILD_OPT}" \ SM_CONF="${SM_CONF}" \ SM_CONF_OPT="${SM_CONF_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 := yes ENABLE_BIN := yes 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 # Now that all that is out of the way, read the desired configuration # settings ifeq (, ${SM_CONF}) CONF_NAME = ${debian_dir}/configure.options else ifneq (y, $(shell test -e debian/${SM_CONF}.options && echo 'y')) CONF_NAME := $(error Create ${SM_CONF}.options from configure.options) endif ifneq (y, $(shell test -e debian/${SM_CONF}.changelog && echo 'y')) CONF_NAME := $(error Create ${SM_CONF}.changelog from changelog) endif CONF_NAME = ${debian_dir}/${SM_CONF}.options SM_CONF_OPT += --with-custom=${SM_CONF} endif $(eval CONFIG_OPTS := $(shell grep -v "^\#" ${CONF_NAME})) all: @echo 'Please specify a real target in the future...'; $(MAKE) -f ${debian_dir}/rules \ version_string=${pwd_string} \ SM_BUILD_OPT="${SM_BUILD_OPT}" \ SM_CONF="${SM_CONF}" \ SM_CONF_OPT="${SM_CONF_OPT}" \ DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS}" \ binary-all; #------------------------------------------------------------------------------ # Rules to maintain the external Debian directory #------------------------------------------------------------------------------ #------------- .PHONY: refresh-dbs refresh-dbs: @echo 'updating debian/scripts directory...'; cp -af /usr/share/dbs/* ${SCRIPT_DIR}/; chmod a-w ${SCRIPT_DIR}/*; #------------- .PHONY: refresh-debian refresh-debian: @dh_testdir; @echo 'updating debian directory ...'; sudo $(RM) -r debian; sudo cp -a ../debian ./; sudo $(RM) -rf ${SOURCE_DIR} ${STAMP_DIR}; # Remove some local configuration $(RM) -r debian/CaveIn.changelog \ debian/CaveIn.options \ debian/CaveIn.patches; # Make sure directories are writeable by the owner (mine aren't) chmod -R ug+w debian; -(cd ${debian_dir} && aclocal); -(cd ${debian_dir} && autoconf); -(cd ${debian_dir} && automake); # Force a configure here, using $${PWD} so the changelog, etc. # wind up with the right version numbers $(MAKE) -f ${debian_dir}/rules \ version_string="${pwd_string}" \ SM_BUILD_OPT="${SM_BUILD_OPT}" \ SM_CONF="" \ SM_CONF_OPT="${SM_CONF_OPT}" \ DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS}" \ configure; -(cd ${debian_dir} && $(MAKE) distclean;) $(RM) -r ${debian_dir}/autom4te.cache; # 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; find ${debian_dir} -type f -name '*.am' | xargs -r $(RM); $(RM) \ ${debian_dir}/aclocal.m4 \ ${debian_dir}/build/*.m4; $(MAKE) -f ${debian_dir}/rules clean-debian; #------------- .PHONY: clean-debian clean-debian: @echo 'cleaning debian directory...'; #-(cd ${debian_dir} && $(MAKE) -f Makefile maintainer-clean;) #-(cd ${debian_dir} && $(MAKE) -f Makefile distclean;) find ${debian_dir} -name '*~' -o -name '\.*\.swp' \ | xargs -r rm; $(RM) ${debian_dir}/*.sav ${debian_dir}/build/*.sav; $(RM) ${STAMP_DIR}/autotools ${STAMP_DIR}/configure; #------------- .PHONY: refresh-faq 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.megacity.org/software_downloads/rhsbl.m4;); @chmod u-w ${debian_dir}/cf/feature/rhsbl.m4; #------------- .PHONY: world 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; #time $(MAKE) -f ${debian_dir}/rules parts; time ${DEB_BUILD}; .PHONY: parts parts: $(MAKE) -f ${debian_dir}/rules info; fakeroot $(MAKE) -f ${debian_dir}/rules clean; $(MAKE) -f ${debian_dir}/rules configure; fakeroot $(MAKE) -f ${debian_dir}/rules binary-all; .PHONY: test test: @dh_testdir; $(MAKE) -f ${debian_dir}/rules clean-debian; fakeroot $(MAKE) -f ${debian_dir}/rules clean; $(MAKE) -f ${debian_dir}/rules \ 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; .PHONY: print 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}/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; #------------- .PHONY: autotools 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 ] \ && [ -e ${debian_dir}/build/config.guess ]; then \ chmod ug+x ${debian_dir}/build/config.guess; \ 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 ] \ && [ -e ${debian_dir}/build/config.sub ]; then \ chmod ug+x ${debian_dir}/build/config.sub; \ 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; # Make sure that some autotools stuff is executable. chmod ug+x \ ${debian_dir}/build/config.guess \ ${debian_dir}/build/config.sub \ ${debian_dir}/build/depcomp \ ${debian_dir}/build/install-sh \ ${debian_dir}/build/missing \ ${debian_dir}/build/mkinstalldirs \ ; touch ${STAMP_DIR}/autotools; #------------------------------------------------------------------------------ # Build/Package check rules #------------------------------------------------------------------------------ #------------- .PHONY: info info: #-------------------------------------------------------------------- # The following information will be used for this run: # SM_CONF = ${SM_CONF} # Source = ${package} ${pwd_string} # Package = ${package} ${version_string} # Version = ${version_major}.${version_minor}${version_debian} # BuildTree = ${BUILD_TREE} # PatchDir = ${PATCH_DIR} # Arch = ${DEB_BUILD_ARCH} on ${DEB_HOST_ARCH} # Options # configure = ${CONFIG_OPTS} # config opt = ${SM_CONF_OPT} # build opt = ${SM_BUILD_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} #-------------------------------------------------------------------- #------------- .PHONY: buildinfo buildinfo: @echo ''; @dpkg -l \ debhelper \ dpkg-dev \ gcc \ 'libc6*' \ binutils \ ldso \ make \ m4 \ libdb4 libdb4-dev \ libdb3 libdb3-dev \ libdb2 libdb2-dev \ libwrap0 libwrap0-dev \ libldap2 libldap2-dev \ libopenldap1 libopenldap-dev \ umich-libldap umich-libldap-dev \ libsasl2 libsasl2-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}/buildinfo; @echo ''; @chmod 644 ${debian_dir}/buildinfo; #------------- .PHONY: pristine 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" - \ | [ ! -z - ]; \ fi; # 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; #------------- .PHONY: verify 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 #------------------------------------------------------------------------------ #------------- .PHONY: clean clean: @dh_testdir; @dh_testroot; # Add here commands to clean up after the build process. #-$(MAKE) clean; #-$(MAKE) distclean; # First, remove any patches, and source directories #$(MAKE) -f ${debian_dir}/sys-build.mk source.clean; # Local stuff -if [ -f ${debian_dir}/Makefile ]; then \ (cd ${debian_dir} && $(MAKE) -f Makefile clean;) \ fi; # Debian stuff $(RM) -r ${SOURCE_DIR} ${STAMP_DIR}; $(RM) \ ${debian_dir}/config.log \ ${debian_dir}/config.status \ ${debian_dir}/*.buildinfo.Debian \ ${debian_dir}/*.debhelper \ ${debian_dir}/build/debian/changelog.in \ ${debian_dir}/build/debian/control \ ; for file in tmp ${PACKAGES};do \ $(RM) -r ${debian_dir}/$$file; \ 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 # Restore pre-existing config.{guess,sub} -if [ -e ${debian_dir}/build/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 {} ';'; dh_clean; #------------- .PHONY: setup setup: ${STAMP_DIR}/setup ${STAMP_DIR}/setup: ${STAMP_DIR}/patch $(MAKE) -f ${debian_dir}/rules info # Support separate debian directory ifeq (yes, $(shell test -d debian && echo 'yes')) touch ${STAMP_DIR}/setup; endif .PHONY: patch patch: ${STAMP_DIR}/patch ${STAMP_DIR}/patch: unpack # patch source ifeq (yes, $(shell test -d debian && echo 'yes')) @dh_testdir; ifeq (yes, $(shell test -d debian/${SM_CONF}.patches && echo 'yes')) cp -af debian/${SM_CONF}.patches/* debian/patches/; endif $(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}/patch; #touch ${STAMP_DIR}/patch; endif .PHONY: unpack unpack: ${STAMP_DIR}/unpack ${STAMP_DIR}/unpack: $(MAKE) -f ${debian_dir}/rules info; # unpack source ifeq (yes, $(shell test -d debian && echo 'yes')) @dh_testdir; $(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; #touch ${STAMP_DIR}/unpack; endif #------------- .PHONY: configure 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 \ ${CONFIG_OPTS} \ ${SM_CONF_OPT} \ ;); # CC="${CC}" CFLAGS="${CFLAGS} # Force a re-read of the rules file (to pull configure settings) ifeq (yes, $(shell test -d debian && echo 'yes')) touch debian/rules; endif 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 ifeq (smX, ${package}) (cd ${BUILD_TREE} && \ CFLAGS="-DSM_USE_TLS -DSM_USE_SASL ${CFLAGS}" \ ./configure \ --libexecdir=/usr/lib/sm.bin \ --datarootdir= \ --datadir=${DATA_DIR} \ --sysconfdir=/etc \ --localstatedir=/var \ --infodir=${DATA_DIR}/info \ --mandir=${DATA_DIR}/man \ --enable-TLS \ --enable-SASL \ --enable-pmilter \ ) endif touch ${STAMP_DIR}/configure; #------------- .PHONY: build-indep 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; ifeq (smX,${package}) else # 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 (cd ${debian_dir} && $(MAKE) -f Makefile build-indep;) endif endif touch ${STAMP_DIR}/build-indep; #------------- .PHONY: build-arch 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; # Add here commands to compile the package. # $(MAKE); # ifeq (smX,${package}) (cd ${BUILD_TREE} && make) #(cd ${BUILD_TREE} && make -i check >check.log 2>&1) else # 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; # 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; \ if [ -d ${BUILD_TREE}/libmilter ]; then \ (cd ${BUILD_TREE}/obj*/libmilter && \ gcc -shared -pthread -o libmilter.so.0 \ -Wl,-soname,libmilter.so.0 \ main.o engine.o listener.o handler.o comm.o \ smfi.o signal.o sm_gethost.o errstring.o strl.o;); \ fi; \ done; # Debian stuff (cd ${debian_dir} && $(MAKE) -f Makefile build-arch;) # Remove our config m4 files $(RM) ${BUILD_TREE}/devtools/Site/site.config.m4; endif endif touch ${STAMP_DIR}/build-arch; #------------- .PHONY: check-arch check-arch: ${STAMP_DIR}/check-arch ${STAMP_DIR}/check-arch: ${STAMP_DIR}/build-arch # Skip work if nothing to do... ifeq (yes, ${ENABLE_ARCH}) @dh_testdir; # Add here commands to compile the package. # $(MAKE); # ifeq (smX,${package}) (cd ${BUILD_TREE} && make -i check >check.log 2>&1) else endif endif touch ${STAMP_DIR}/check-arch; #------------- .PHONY: install-indep install-indep: ${STAMP_DIR}/install-indep ${STAMP_DIR}/install-indep: DH_OPTIONS=-i ${STAMP_DIR}/install-indep: ${STAMP_DIR}/build-indep # 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; ifeq (smX,${package}) else # Add here commands to install the documentation/package. #$(MAKE) prefix=`pwd`/${PKG_DIR}/usr install; # 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}/; ifeq (yes, ${ENABLE_DEV}) # 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; endif # Debian stuff (cd ${debian_dir}/cf && \ $(MAKE) -f Makefile install-indep \ DESTDIR="${top_srcdir}/sendmail-cf";); (cd ${debian_dir}/examples && \ $(MAKE) -f Makefile install-indep \ DESTDIR="${top_srcdir}/sendmail-base";); (cd ${debian_dir}/local && \ $(MAKE) -f Makefile install-indep \ DESTDIR="${top_srcdir}/sendmail-base";); # Multiple package fixup #dh_movefiles -i --sourcedir debian/${package}; # Actions from binary-common # dh_fixperms; # # Cleanup misc permissions, etc... (fakeroot, dh_fixperms, etc.) # Install Lintian overrides $(INSTALL_DATA) -g root -m 644 \ debian/build/debian/sendmail-base.lintian-overrides \ debian/sendmail-base/usr/share/lintian/overrides/sendmail-base; endif endif touch ${STAMP_DIR}/install-indep; #------------- .PHONY: install-arch 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 ifeq (smX,${package}) else for subdir in ${SM_SUBDIRS}; do \ if [ -d ${BUILD_TREE}/$${subdir} ]; then \ if [ "$${subdir}" = 'libmilter' ]; then \ (cd ${BUILD_TREE}/obj*/$${subdir} && \ $(INSTALL) libmilter.so.0 \ ../../../../debian/libmilter0/usr/lib/; \ ); \ elif [ "$${subdir}" = 'mail.local' ] \ || [ "$${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; # FHS says that rmail belongs in ${sbindir} - and we now put # it there, but in the rmail package ! mv ${PKG_DIR}${libexecdir}/rmail ${debian_dir}/rmail/${sbindir}/; mv ${PKG_DIR}${mandir}/man8/rmail.8 ${debian_dir}/rmail/${mandir}/man8/; # 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! (cd ${PKG_DIR}${bindir} && \ $(RM) hoststat mailq newaliases purgestat smtpd;) (cd ${PKG_DIR}${sbindir} && for file in \ newaliases hoststat purgestat \ ; do \ ln -sf sendmail-mta $$file; \ done;); # Handle man pages for these aliases mv ${PKG_DIR}${mandir}/man5/aliases.5 \ ${PKG_DIR}${mandir}/man5/aliases.sendmail.5; mv ${PKG_DIR}${mandir}/man1/mailq.1 \ ${PKG_DIR}${mandir}/man1/mailq.sendmail.1; mv ${PKG_DIR}${mandir}/man1/newaliases.1 \ ${PKG_DIR}${mandir}/man8/newaliases.sendmail.8; (cd ${PKG_DIR}${mandir}/man8 && for file in \ hoststat.8.gz purgestat.8.gz \ ; do \ ln -sf sendmail-mta.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 sendmail $$file; \ done;); # NOTE: with the MSP/MTA split, we'll provide our own mailstats (keep orig) ln -s ../share/sendmail/mailstats ${PKG_DIR}${sbindir}/mailstats; ln -s ../share/sendmail/mailq ${PKG_DIR}${bindir}/mailq; ln -s ../lib/sm.bin/editmap ${PKG_DIR}${sbindir}/editmap; ln -s ../lib/sm.bin/makemap ${PKG_DIR}${sbindir}/makemap; ln -s ../lib/sm.bin/praliases ${PKG_DIR}${sbindir}/praliases; # 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}${libexecdir}/vacation \ ${PKG_DIR}${libexecdir}/vacation.sendmail; \ mv ${PKG_DIR}${mandir}/man1/vacation.1 \ ${PKG_DIR}${mandir}/man1/vacation.sendmail.1; \ 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 \ ${PKG_DIR}${mandir}/man8/sendmail.sendmail.8; rm ${BUILD_TREE}/sendmail/sendmail.8; # Debian stuff (cd ${debian_dir}/sensible_mda && \ $(MAKE) -f Makefile install-arch \ DESTDIR="${top_srcdir}/sensible-mda";); # 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}; # dh_fixperms; # # Cleanup misc permissions, etc... (fakeroot, dh_fixperms, etc.) # # You may want to make some executables suid here. 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; # 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) -g root -m 644 \ debian/build/debian/libmilter0.lintian-overrides \ debian/libmilter0/usr/share/lintian/overrides/libmilter0; ifeq (yes, ${ENABLE_DEV}) $(INSTALL_DATA) -g root -m 644 \ debian/build/debian/libmilter-dev.lintian-overrides \ debian/libmilter-dev/usr/share/lintian/overrides/libmilter-dev; endif $(INSTALL_DATA) -g root -m 644 \ debian/build/debian/rmail.lintian-overrides \ debian/rmail/usr/share/lintian/overrides/rmail; $(INSTALL_DATA) -g root -m 644 \ debian/build/debian/sensible-mda.lintian-overrides \ debian/sensible-mda/usr/share/lintian/overrides/sensible-mda; $(INSTALL_DATA) -g root -m 644 \ debian/build/debian/sendmail-bin.lintian-overrides \ debian/sendmail-bin/usr/share/lintian/overrides/sendmail-bin; ifeq (, $(findstring nostrip,${DEB_BUILD_OPTIONS})) dh_strip --keep-debug; endif # Remove unneeded debugging information rm -rf debian/sendmail-bin/usr/lib/debug; rm -rf debian/sensible-mda/usr/lib/debug; rm -rf debian/rmail/usr/lib/debug; endif dh_makeshlibs; # -V "libmilter0 (>= ${version_major}.${version_minor})"; dh_shlibdeps; endif touch ${STAMP_DIR}/install-arch; #------------- # 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. .PHONY: binary-common binary-common: @dh_testdir; @dh_testroot; # Document what we're building against if [ -x /usr/bin/dh_buildinfo ]; then \ dh_buildinfo; \ dh_installdocs; \ else \ $(MAKE) -f ${debian_dir}/rules buildinfo; \ dh_installdocs -A ${debian_dir}/buildinfo; \ fi; # Done in install-xxx, but still need to get rid of *.debhelper !!! #dh_clean -k; dh_installchangelogs -k ${BUILD_TREE}/RELEASE_NOTES; dh_installcron --name=${package}; if [ -x /usr/bin/dh_installdebconf ]; then dh_installdebconf; fi; #dh_installemacsen; #dh_installexamples; #if [ -x /usr/bin/dh_installinfo ]; then dh_installinfo; fi; dh_installinit --name=${package} --update-rcd-params="defaults 21 19"; if [ -x /usr/bin/dh_installlogrotate ]; then \ dh_installlogrotate --name=${package}; 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; #dh_strip; #-- done in install-arch dh_compress; #dh_fixperms; #-- done in install-xxx # 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, dh_fixperms, etc.) # Done in install-xxx # # You may want to make some executables suid here. # Done in install-xxx # #dh_makeshlibs -V; #-- done in install-arch #dh_shlibdeps; #-- done in install-arch dh_installdeb; 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.) .PHONY: binary-indep binary-indep: ${STAMP_DIR}/build-indep ${STAMP_DIR}/install-indep # Skip work if nothing to do... ifeq (yes, ${ENABLE_INDEP}) $(MAKE) -f ${debian_dir}/rules DH_OPTIONS=-i binary-common; endif #------------- # Build architecture dependant packages using the common target. .PHONY: binary-arch binary-arch: ${STAMP_DIR}/build-arch ${STAMP_DIR}/install-arch # Skip work if nothing to do... ifeq (yes, ${ENABLE_ARCH}) $(MAKE) -f ${debian_dir}/rules DH_OPTIONS=-a binary-common; endif #------------- # Any other binary targets build just one binary package at a time. .PHONY: binary-% binary-%: $(MAKE) -f ${debian_dir}/rules binary-common DH_OPTIONS=-p$*; #------------- # Below here is fairly generic really .PHONY: FORCE FORCE: ; 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 rules # so that buildd ONLY build/install *-arch packages .PHONY: build build: build-arch .PHONY: build-all build-all: build-indep build-arch .PHONY: check check-all check: check-arch check-all: check-arch .PHONY: install install: install-arch .PHONY: binary binary: binary-all .PHONY: binary-all binary-all: binary-indep binary-arch .SUFFIXES: .PRECIOUS: ${debian_dir}/rule