#!/usr/bin/make -f # debian/rules for exim4 # This file is public domain software, originally written by Joey Hess. # # Uncomment this to turn on verbose mode. # export DH_VERBOSE=1 buildname=$${build:-`$(SHELL) scripts/os-type`-`$(SHELL) scripts/arch-type`} BUILDDIR=$(shell pwd)/build-tree DEBIAN:=$(shell pwd)/debian CFLAGS := -g -Wall $(shell getconf LFS_CFLAGS) -D_LARGEFILE_SOURCE -fno-strict-aliasing ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 else CFLAGS += -O2 endif export CFLAGS LC_ALL=C export LC_ALL # Which packages should we build? ifndef buildbasepackages buildbasepackages=yes endif ifndef extradaemonpackages extradaemonpackages=exim4-daemon-heavy endif # If you want to build a daemon with a configuration tailored to YOUR special # needs, call "fakeroot debian/rules unpack-configs", copy EDITME.exim4-light # to EDITME.exim4-custom and modify it. Please note that you _need_ to # modify EDITME.exim4-custom or your build will fail due to #386188. # # If you want to create multiple custom packages with different names, use # the script debian/create-custom-package [suffix]. # # Afterwards EITHER change the definition of extradaemonpackages above OR # simply set extradaemonpackages to the desired value via the environment. # If you want your changes to survive a debian/rules clean, call # "fakeroot debian/rules pack-configs" after customizing EDITME.exim4-custom # If you remove exim4-daemon-light from basedaemonpackages to prevent # exim4-daemon-light from being built, you need to modify the build # process to pull the helper binaries from the daemon package that you # actually build. If you simply remove exim4-daemon-light here, you will # end up with exim4-base sans binaries, which is most probably not what # you intend to have. # # combined[ai]dbgpackage has a list of packages whose debug information # goes into the combined debug package exim4-dbg, separated as arch # independent and arch dependent list. # extraadbgpackage has a list of packages whose debug information # goes into one debug package foo-dbg per package. This is currently # only implemented and needed for arch dependent packages. ifeq ($(buildbasepackages),yes) basedaemonpackages=exim4-daemon-light combinedadbgpackage=exim4-base eximon4 combinedidbgpackage=exim4-config exim4 exim4dbg=exim4-dbg dhstripparm=--dbg-package=$(exim4dbg) exim4dev=exim4-dev extraadbgpackage=$(basedaemonpackages) $(extradaemonpackages) else basedaemonpackages= combinedadbgpackage= combinedidbgpackage= exim4dbg= dhstripparm= exim4dev= extraadbgpackage=$(extradaemonpackages) endif #DEBUGOUT:=$(shell echo >&2 buildbasepackages $(buildbasepackages)) #DEBUGOUT:=$(shell echo >&2 extradaemonpackages $(extradaemonpackages)) # If you want to build with OpenSSL instead of GnuTLS, uncomment this # OPENSSL:=1 # Please note that building exim4-daemon-heavy with OpenSSL is a GPL # violation. # list of all arch dependent packages to be built buildpackages=$(combinedadbgpackage) $(extraadbgpackage) $(addsuffix -dbg,$(extraadbgpackage)) $(exim4dbg) $(exim4dev) # generate -pexim4-base -peximon4 ... commandline for debhelper dhbuildpackages=$(addprefix -p,$(buildpackages)) dhcombinedadbgpackage=$(addprefix -p,$(combinedadbgpackage)) dhcombinedidbgpackage=$(addprefix -p,$(combinedidbgpackage)) # exim4-daemon-light --> build-exim4-daemon-light/exim daemonbinaries=$(addprefix build-,$(addsuffix /exim,$(extradaemonpackages))) debiandaemonbinaries=$(addprefix $(DEBIAN)/,$(addsuffix /usr/sbin/exim4,$(extradaemonpackages))) # get upstream-version from debian/changelog, i.e. anything until the first - UPSTREAMVERSION := $(shell dpkg-parsechangelog | sed -n '/^Version: /{s/^Version: \(.\+\)-[^-]\+/\1/;p;}') MTACONFLICTS := $(shell cat $(DEBIAN)/mtalist) $(BUILDDIR)/Makefile: mkdir -p build-tree find . -mindepth 1 -maxdepth 1 \ -name debian -prune -o \ -name build-tree -o -print0 | \ xargs --no-run-if-empty --null \ cp -a --target-directory=build-tree unpack-configs: unpack-configs-stamp unpack-configs-stamp: $(BUILDDIR)/Makefile patch -o EDITME.eximon $(BUILDDIR)/exim_monitor/EDITME $(DEBIAN)/EDITME.eximon.diff patch -o EDITME.exim4-light $(BUILDDIR)/src/EDITME $(DEBIAN)/EDITME.exim4-light.diff ifdef OPENSSL patch EDITME.exim4-light $(DEBIAN)/EDITME.openssl.exim4-light.diff endif -for editme in $(DEBIAN)/EDITME.exim4-*.diff; do \ if [ "$$editme" != "$(DEBIAN)/EDITME.exim4-light.diff" ]; then \ TARGETNAME=`basename $$editme .diff`; \ echo patch -o $$TARGETNAME EDITME.exim4-light $$editme; \ patch -o $$TARGETNAME EDITME.exim4-light $$editme; \ fi; \ done touch unpack-configs-stamp pack-configs: $(BUILDDIR)/Makefile -diff -u $(BUILDDIR)/src/EDITME EDITME.exim4-light > $(DEBIAN)/EDITME.exim4-light.diff -for editme in EDITME.exim4-*; do \ if [ "$$editme" != "EDITME.exim4-light" ]; then \ echo diff -u EDITME.exim4-light $$editme; \ diff -u EDITME.exim4-light $$editme > $(DEBIAN)/$${editme}.diff; \ fi; \ done -diff -u $(BUILDDIR)/exim_monitor/EDITME EDITME.eximon > $(DEBIAN)/EDITME.eximon.diff # only called manually by maintainer before upload. update-mtaconflicts: which grep-available > /dev/null && \ grep-available --show-field=Package --field=Provides \ mail-transport-agent --no-field-names \ /var/lib/apt/lists/*Packages | grep -v exim | sort -u | \ tr '\n' ',' | sed -e 's/,/, /g;s/, $$//' > $(DEBIAN)/mtalist # Generate README.Debian as text/html ... debian/README.Debian.html: debian/README.Debian.xml xsltproc --nonet --stringparam section.autolabel 1 \ -o $@ \ /usr/share/xml/docbook/stylesheet/nwalsh/html/docbook.xsl \ $< # ... and text/plain debian/README.Debian: debian/README.Debian.html chmod 755 $(DEBIAN)/lynx-dump-postprocess lynx -force_html -dump $< | $(DEBIAN)/lynx-dump-postprocess > $@.tmp mv $@.tmp $@ configure: configure-stamp # the patches might change src/EDITME. configure-stamp: $(BUILDDIR)/Makefile unpack-configs-stamp dh_testdir # Add here commands to configure the package. # We currently do not want to build depend on debhelper 7.2.3 just to # keep it from installing the wrong upstream changelog. 490937 rm -fv CHANGES touch configure-stamp # Build binaries for the base package, the eximon4 package, and the # exim4-daemon-light package. build-exim4-daemon-light/exim: configure-stamp echo build-exim4-daemon-light dh_testdir rm -rf $(BUILDDIR)/build-$(buildname) # Add here command to compile/build the package. mkdir -p $(BUILDDIR)/Local cp EDITME.exim4-light $(BUILDDIR)/Local/Makefile cp EDITME.eximon $(BUILDDIR)/Local/eximon.conf cd $(BUILDDIR) && $(MAKE) cd $(BUILDDIR) && mv build-$(buildname) build-exim4-daemon-light build-exim4-daemon-custom/exim: configure-stamp echo build-exim4-daemon-custom dh_testdir rm -rf $(BUILDDIR)/build-$(buildname) # Add here command to compile/build the package. mkdir -p $(BUILDDIR)/Local cp EDITME.exim4-custom $(BUILDDIR)/Local/Makefile cd $(BUILDDIR) && $(MAKE) Local/Makefile configure # This is a kludge. The upstream Makefile should be fixed, really. cd $(BUILDDIR) && $(MAKE) -C build-$(buildname) checklocalmake Makefile os.h os.c config.h buildlookups buildpdkim buildrouters buildtransports buildauths exim cd $(BUILDDIR) && mv build-$(buildname) build-exim4-daemon-custom build-exim4-daemon-heavy/exim: configure-stamp echo build-exim4-daemon-heavy dh_testdir rm -rf $(BUILDDIR)/build-$(buildname) # Add here command to compile/build the package. mkdir -p $(BUILDDIR)/Local cp EDITME.exim4-heavy $(BUILDDIR)/Local/Makefile cd $(BUILDDIR) && $(MAKE) Local/Makefile configure # This is a kludge. The upstream Makefile should be fixed, really. cd $(BUILDDIR) && $(MAKE) -C build-$(buildname) checklocalmake Makefile os.h os.c config.h buildlookups buildpdkim buildrouters buildtransports buildauths exim cd $(BUILDDIR) && mv build-$(buildname) build-exim4-daemon-heavy build-indep: build-indep-stamp build-indep-stamp: dh_testdir # Add here command to compile/build the arch indep package. # It's ok not to do anything here, if you don't need to build # anything for this package. #/usr/bin/docbook-to-man $(DEBIAN)/exim.sgml > exim.1 touch build-indep-stamp build-arch: build-arch-stamp ifeq ($(buildbasepackages),yes) build-arch-stamp: build-exim4-daemon-light/exim $(daemonbinaries) else build-arch-stamp: $(daemonbinaries) endif dh_testdir touch build-arch-stamp build: build-arch build-indep clean: cleanfiles cleanfiles: dh_testdir dh_testroot debconf-updatepo rm -f build-stamp configure-stamp installbase-stamp # Add here commands to clean up after the build process. [ ! -f Makefile ] || $(MAKE) distclean -rm -rf build-* doc/tmp -rm -f EDITME.* unpack-configs-stamp -rm -f $(DEBIAN)/debconf/exim4.conf.template $(DEBIAN)/files -rm -f $(DEBIAN)/README.Debian $(DEBIAN)/README.Debian.html #these are identical for all daemon-* and therefore symlinked @cd $(DEBIAN) && find . -maxdepth 1 \ -regex '^\./exim4-daemon-.*\.\(postinst\|prerm\)$$' \ -and -not -name 'exim4-daemon-light.*' -print0 \ | xargs -0r rm -v #pwd chmod 755 $(DEBIAN)/exim-gencert $(DEBIAN)/timeout.pl \ $(DEBIAN)/exim4_refresh_gnutls-params \ $(DEBIAN)/lynx-dump-postprocess $(DEBIAN)/script \ $(DEBIAN)/exim-adduser dh_clean rm -rf $(BUILDDIR) # fix broken (0600) permissions in original tarball #find OS doc scripts exim_monitor src util -perm -044 -or -print0 |\ # xargs -0r chmod -c og+r installbase-stamp: build-exim4-daemon-light/exim debian/README.Debian debian/README.Debian.html dh_testdir dh_testroot dh_prep dh_installdirs cd $(BUILDDIR) && rm -rf build-$(buildname) && \ ln -s build-exim4-daemon-light build-$(buildname) && \ $(MAKE) install \ INSTALL_ARG=-no_symlink \ inst_conf=$(DEBIAN)/exim4-base/usr/share/doc/exim4-base/examples/example.conf \ inst_aliases=$(DEBIAN)/exim4-base/usr/share/doc/exim4-base/examples/aliases \ inst_dest=$(DEBIAN)/exim4-base/usr/sbin if [ -e "$(DEBIAN)/example.conf.md5" ] && [ "$$(< $(DEBIAN)/exim4-base/usr/share/doc/exim4-base/examples/example.conf md5sum)" != "$$(cat $(DEBIAN)/example.conf.md5)" ] ; then \ echo "upstream example configuration has changed, new md5sum:"; \ < $(DEBIAN)/exim4-base/usr/share/doc/exim4-base/examples/example.conf md5sum; \ echo "aborting build."; \ exit 1; \ fi < $(DEBIAN)/exim4-base/usr/share/doc/exim4-base/examples/example.conf md5sum > $(DEBIAN)/example.conf.md5 sed -e 's,/[a-zA-Z/0-9.-]*exim4-base/examples/,/etc/,' \ < $(DEBIAN)/exim4-base/usr/share/doc/exim4-base/examples/example.conf \ > $(DEBIAN)/exim4-base/usr/share/doc/exim4-base/examples/example.conf.tmp mv $(DEBIAN)/exim4-base/usr/share/doc/exim4-base/examples/example.conf.tmp \ $(DEBIAN)/exim4-base/usr/share/doc/exim4-base/examples/example.conf sed -e 's,PERL_COMMAND,/usr/bin/perl,' < $(BUILDDIR)/src/convert4r4.src \ > $(DEBIAN)/exim4-base/usr/sbin/exim_convert4r4 chmod 755 $(DEBIAN)/exim4-base/usr/sbin/exim_convert4r4 cd $(BUILDDIR) && \ install -m755 \ build-$(buildname)/transport-filter.pl \ $(DEBIAN)/exim4-base/usr/share/doc/exim4-base/examples install -m755 \ $(BUILDDIR)/util/ratelimit.pl \ $(DEBIAN)/exim4-base/usr/share/doc/exim4-base/examples mv $(DEBIAN)/exim4-base/usr/sbin/exim \ $(DEBIAN)/exim4-daemon-light/usr/sbin/exim4 # fix permissions of /usr/sbin/exim4 if running with restrictive umask, # dh_fixperms sanitizes anything else chmod 4755 $(DEBIAN)/exim4-daemon-light/usr/sbin/exim4 mv $(DEBIAN)/exim4-base/usr/sbin/eximon \ $(DEBIAN)/eximon4/usr/sbin mv $(DEBIAN)/exim4-base/usr/sbin/eximon.bin \ $(DEBIAN)/eximon4/usr/lib/exim4 pod2man --center=EXIM4 --section=8 \ $(DEBIAN)/exim4-base/usr/sbin/exipick \ $(DEBIAN)/exim4-base/usr/share/man/man8/exipick.8 pod2man --center=EXIM4 --section=8 \ $(DEBIAN)/exim4-base/usr/sbin/eximstats \ $(DEBIAN)/exim4-base/usr/share/man/man8/eximstats.8 install -m755 $(DEBIAN)/syslog2eximlog $(DEBIAN)/exim4-base/usr/sbin/ pod2man --center=EXIM4 --section=8 \ $(DEBIAN)/syslog2eximlog \ $(DEBIAN)/exim4-base/usr/share/man/man8/syslog2eximlog.8 # if you change anything here, you will have to change # config-custom/debian/rules as well sed -e \ "s/^UPEX4C_version=\"\"/UPEX4C_version=\"`dpkg-parsechangelog | sed -n '/^Version: /s/^Version: //p'`\"/" \ < $(DEBIAN)/debconf/update-exim4.conf \ > $(DEBIAN)/exim4-config/usr/sbin/update-exim4.conf chmod 755 $(DEBIAN)/exim4-config/usr/sbin/update-exim4.conf install -m 755 $(DEBIAN)/update-exim4defaults $(DEBIAN)/exim4-config/usr/sbin cd $(DEBIAN)/debconf/conf.d && \ tar cf - `find \( -path '*/.svn/*' -prune \) -or \( -type f -print \)` | \ { cd $(DEBIAN)/exim4-config/etc/exim4/conf.d/ && \ tar xf - ; } # ship a copy in examples # install -m644 $(DEBIAN)/debconf/exim4.conf.template $(DEBIAN)/exim4-config/usr/share/doc/exim4-config/examples/exim4.conf.template.debconf install -m644 $(DEBIAN)/email-addresses $(DEBIAN)/exim4-config/etc/ install -m640 -oroot -groot $(DEBIAN)/passwd.client $(DEBIAN)/exim4-config/etc/exim4/ chmod 755 $(DEBIAN)/debconf/update-exim4.conf.template CONFDIR=$(DEBIAN)/debconf $(DEBIAN)/debconf/update-exim4.conf.template --nobackup --run # dh_movefiles touch installbase-stamp # This dependency expands to # debian/exim4-daemon-heavy/usr/sbin/exim4: $(BUILDDIR)/build-exim4-daemon-heavy/exim $(debiandaemonbinaries): $(DEBIAN)/%/usr/sbin/exim4: $(BUILDDIR)/build-%/exim dh_testdir dh_testroot dh_installdirs install -m4755 -oroot -groot $< $@ # Build architecture-independent files here. # this is just exim4-config and exim4. binary-indep: build $(install) ifeq ($(buildbasepackages),yes) dh_testdir -i dh_testroot -i # upstream changelog is only in exim4-base dh_link -i dh_installchangelogs -i -XCHANGES dh_installdocs -i dh_installexamples -i #dh_installmenu -i dh_installdebconf -i dh_installlogrotate -i # dh_installemacsen -i #dh_installpam -i #dh_installmime -i # dh_installinit -i dh_installcron -i # dh_installinfo -i # dh_undocumented -i dh_installppp -i --name=exim4 dh_installman -i dh_install -i dh_lintian -i dh_strip $(dhcombinedidbgpackage) $(dhstripparm) #for pkg in $(extraidbgpackage); do \ # dh_strip -p$$pkg --dbg-package=$${pkg}-dbg; \ #done dh_compress -i dh_fixperms -i -X/etc/exim4/passwd.client # dh_makeshlibs -i dh_installdeb -i # dh_perl -i dh_shlibdeps -i dh_gencontrol -i -- -VUpstream-Version=$(UPSTREAMVERSION) -VMTA-Conflicts="$(MTACONFLICTS)" dh_md5sums -i dh_builddeb -i endif # Build architecture-dependent files here. ifeq ($(buildbasepackages),yes) install=installbase-stamp $(debiandaemonbinaries) else install=$(debiandaemonbinaries) endif binary-arch: build $(install) dh_testdir $(dhbuildpackages) dh_testroot $(dhbuildpackages) # symlink identical maintainerscripts @for i in $(extradaemonpackages) ; do \ ln -sfv exim4-daemon-light.prerm \ "$(DEBIAN)/$$i.prerm" ; \ ln -sfv exim4-daemon-light.postinst \ "$(DEBIAN)/$$i.postinst" ; \ done # upstream changelog is only in exim4-base, the other packages include # a symlink dh_installchangelogs -pexim4-base $(BUILDDIR)/doc/ChangeLog # remove "-pexim4-base" from "-pexim4-base -pexim4-daemon-light ..." dh_installchangelogs $(subst -pexim4-base ,,$(dhbuildpackages)) -XCHANGES dh_installdocs $(dhbuildpackages) dh_installexamples $(dhbuildpackages) dh_installmenu $(dhbuildpackages) dh_installdebconf $(dhbuildpackages) dh_installlogrotate $(dhbuildpackages) dh_installlogrotate $(dhbuildpackages) --name=exim4-paniclog # dh_installemacsen $(dhbuildpackages) dh_installpam $(dhbuildpackages) dh_installmime $(dhbuildpackages) #dh_installinit $(dhbuildpackages) --noscripts --name=exim4 # work around #347577 (fixed in debhelper 5.0.15) dh_installinit $(dhbuildpackages) -n --name=exim4 dh_installcron $(dhbuildpackages) # dh_installinfo $(dhbuildpackages) # dh_undocumented $(dhbuildpackages) dh_installman $(dhbuildpackages) dh_install $(dhbuildpackages) # install config.h from daemon package, but not from exim4-daemon-light dh_install -p exim4-dev $(shell ls -1 build-tree/build-exim4-daemon-*/config.h | grep -v build-tree/build-exim4-daemon-light/config.h) usr/include/exim4 dh_lintian $(dhbuildpackages) dh_strip $(dhcombinedadbgpackage) $(dhstripparm) for pkg in $(extraadbgpackage); do \ dh_strip -p$$pkg --dbg-package=$${pkg}-dbg; \ done dh_link $(dhbuildpackages) dh_compress $(dhbuildpackages) dh_fixperms $(dhbuildpackages) -Xusr/sbin/exim4 # dh_makeshlibs $(dhbuildpackages) dh_installdeb $(dhbuildpackages) # dh_perl $(dhbuildpackages) dh_shlibdeps $(dhbuildpackages) dh_gencontrol $(dhbuildpackages) -- -VUpstream-Version=$(UPSTREAMVERSION) -VMTA-Conflicts="$(MTACONFLICTS)" dh_md5sums $(dhbuildpackages) dh_builddeb $(dhbuildpackages) binary: binary-arch binary-indep .PHONY: build clean binary-indep binary-arch binary install