summaryrefslogtreecommitdiff
path: root/debian/rules
diff options
context:
space:
mode:
Diffstat (limited to 'debian/rules')
-rwxr-xr-xdebian/rules258
1 files changed, 258 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..c5eecb3
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,258 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Debianrules for building a Debian package
+# Version 1.5
+#
+# These rules have been specifically designed NOT to require root to
+# run them. At any time root privileges are required, the command to be
+# executed will be made obvious and root's password will be prompted for.
+# Of course, root may still run this and no password will be required.
+#
+# Robert Leslie <rob@mars.org>
+
+package=sendmail
+version=$(shell expr `pwd` : '.*-\([0-9.].*\)')
+version_main=$(shell expr `pwd` : '.*-\([0-9]*.[0-9.]*\)')
+
+LIBS = -ldb -lresolv -lnsl -lwrap
+DBMDEF = -DNEWDB -DNIS
+ENVDEF = -DHASFLOCK=1 -DTCPWRAPPERS=1 -include $(shell pwd)/debian/el33t.h \
+ -I/usr/include/db
+
+CC=cc
+GCC = $(CC) $(HACK)
+OFLAGS = -O2
+SHELL=/bin/bash
+
+
+.SILENT: rmail/rmail
+
+rmail/rmail:
+ cd rmail && $(GCC) $(OFLAGS) rmail.c -o rmail
+
+
+
+.PHONY: man bin
+
+build:
+ $(checkdir)
+# -ln -sf /usr/include/gdbm-ndbm.h src/ndbm.h
+ cd src && ./makesendmail sendmail \
+ CC="$(GCC)" O="$(OFLAGS)" DBMDEF="$(DBMDEF)" \
+ ENVDEF="$(ENVDEF)" INCDIRS="$(INCDIRS)" \
+ LIBS="$(LIBS)" LIBDIRS=""
+ $(MAKE) -C mailstats -f Makefile.dist mailstats \
+ CC="$(GCC)" O="$(OFLAGS)" \
+ INCDIRS="-I../src" LIBDIRS=""
+ $(MAKE) -C makemap -f Makefile.dist makemap \
+ CC="$(GCC)" O="$(OFLAGS)" \
+ INCDIRS="-I../src -I/usr/include/db" \
+ LIBDIRS="" LIBS="$(LIBS)" DBMDEF="$(DBMDEF)"
+ $(MAKE) -C praliases -f Makefile.dist praliases \
+ CC="$(GCC)" O="$(OFLAGS)" \
+ INCDIRS="-I../src -I/usr/include/db" \
+ LIBDIRS="" LIBS="$(LIBS)"
+# -$(MAKE) -C mail.local -f Makefile.dist mail.local \
+# CC="$(GCC)" O="$(OFLAGS)" INCDIRS="-I../src" \
+# LIBDIRS="" LIBS="" ENVDEF="-DBSD4_4"
+ $(MAKE) -C smrsh -f Makefile.dist smrsh \
+ CC="$(GCC)" O="$(OFLAGS)" \
+ ENVDEF="-DCMDDIR=\\\"/usr/lib/sm.bin\\\" \
+ -DPATH=\\\"/usr/bin:/bin\\\"" \
+ INCDIRS="-I../src" LIBDIRS=""
+ $(MAKE) -f debian/rules rmail/rmail
+ cd doc && { \
+ for doc in changes/changes intro/intro op/op usenix/usenix; \
+ do test -f $$doc.txt || \
+ nroff -me $$doc.me | cat -s > $$doc.txt; done; \
+ }
+ test -f debian/part1 && test -f debian/part2
+ cd debian && gcc -o sensible-mda sensible-mda.c
+ touch build
+
+
+l33ch:
+ cd debian && \
+ wget ftp://rtfm.mit.edu/pub/usenet/news.answers/mail/sendmail-faq/part1
+ cd debian && \
+ wget ftp://rtfm.mit.edu/pub/usenet/news.answers/mail/sendmail-faq/part2
+
+
+man:
+ cp -p debian/runq.1 debian/tmp/usr/man/man1
+ cp -p debian/sendmailconfig.8 debian/tmp/usr/man/man8
+ cp -p debian/sensible-mda.8 debian/tmp/usr/man/man8
+ for file in src/*.[158] mailstats/*.8 makemap/*.8 \
+ praliases/*.8 smrsh/*.8 rmail/*.8; do \
+ base=$$(basename $$file); \
+ ext=$$(echo $$file | sed -e "s/.*\(.\)$$/\1/"); \
+ sed -e "s#/usr/adm/sm.bin#/usr/lib/sm.bin#g" \
+ -e "s#/etc/sendmail.hf#/usr/lib/sendmail.hf#g" \
+ -e "s#/bin:/usr/bin:/usr/ucb#/usr/bin:/bin#g" \
+ -e "s#/etc/rc#/etc/init.d/sendmail#g" $$file \
+ > debian/tmp/usr/man/man$$ext/$$base; \
+ done
+ install -m 644 contrib/etrn.pl debian/tmp/usr/man/man8/etrn.8
+ install -m 644 contrib/expn.pl debian/tmp/usr/man/man8/expn.8
+ cp -p checksendmail/address.resolve debian/tmp/usr/doc/$(package)
+ cp -p checksendmail/checksendmail.8 debian/tmp/usr/man/man8
+
+
+bin:
+ install rmail/rmail debian/tmp/usr/bin
+ cd src && ./makesendmail install-sendmail \
+ DESTDIR="$$(pwd)/../debian/tmp" BINGRP="root"
+ STDIR="$$(pwd)/../debian/tmp/var/log"
+# cd debian/tmp && mv etc/sendmail.hf usr/lib
+ rm -f debian/tmp/etc/sendmail.st
+ $(MAKE) -s -C mailstats -f Makefile.dist install-mailstats \
+ DESTDIR="../debian/tmp"
+ $(MAKE) -s -C makemap -f Makefile.dist install-makemap \
+ DESTDIR="../debian/tmp"
+ $(MAKE) -s -C praliases -f Makefile.dist install-praliases \
+ DESTDIR="../debian/tmp"
+ $(MAKE) -s -C smrsh -f Makefile.dist install-smrsh \
+ BINDIR="../debian/tmp/usr/sbin"
+# -$(MAKE) -s -C mail.local -f Makefile.dist install-mail.local \
+# BINDIR="../debian/tmp/usr/sbin"
+ strip --strip-debug debian/tmp/usr/{bin,sbin}/*
+ install debian/sendmailconfig debian/sensible-mda debian/tmp/usr/sbin
+ install debian/runq debian/tmp/usr/bin
+ sed "s?/usr/local/bin/perl?/usr/bin/perl?g" contrib/etrn.pl \
+ > debian/tmp/usr/sbin/etrn
+ sed "s?/usr/local/bin/perl?/usr/bin/perl?g" contrib/expn.pl \
+ > debian/tmp/usr/bin/expn
+ chmod 755 debian/tmp/usr/sbin/etrn debian/tmp/usr/bin/expn
+ install checksendmail/checksendmail.perl debian/tmp/usr/sbin/checksendmail
+ for file in debian/tmp/usr/bin/{hoststat,mailq,newaliases,purgestat} \
+ debian/tmp/usr/lib/sendmail; do \
+ rm -f $$file && ln -s ../sbin/sendmail $$file; \
+ done
+
+
+
+hacks:
+ cd debian && uudecode check.tar.uue
+ cd debian/tmp/usr/doc/$(package) && tar -xf ../../../../check.tar
+ cd debian/tmp/usr/doc/$(package)/hack; \
+ for file in *; do \
+ sed "s/dbm /hash /g" < $$file \
+ > ../../../lib/sendmail.cf/hack/$$file; \
+ done
+ sed "s/dbm /hash /g" debian/tmp/usr/doc/$(package)/README.check \
+ > debian/tmp/usr/doc/$(package)/README.Spam
+ rm debian/tmp/usr/doc/$(package)/README.check
+ rm -r debian/tmp/usr/doc/$(package)/hack/
+ cp -p debian/{rbl*,nodns}.m4 debian/tmp/usr/lib/sendmail.cf/hack
+
+
+binary-indep: checkroot
+ $(checkdir)
+
+binary-arch: checkroot build
+ $(checkdir)
+ rm -rf debian/tmp && install -d debian/tmp
+ cd debian/tmp && install -d $$(cat ../dirs)
+ cp debian/{conffiles,control} debian/tmp/DEBIAN
+ install debian/{pre*,post*} debian/tmp/DEBIAN
+
+ $(MAKE) -f debian/rules man
+ cp -p doc/*/{*.ps,*.txt} debian/tmp/usr/doc/$(package)
+ cp -p RELEASE_NOTES debian/tmp/usr/doc/$(package)/changelog
+# cp -p debian/changelog \
+# debian/tmp/usr/doc/$(package)/changelog.Debian
+ cp -p cf/README debian/tmp/usr/doc/$(package)/cf.README
+ cp -p debian/part1 debian/tmp/usr/doc/$(package)/FAQ-1.txt
+ cp -p debian/part2 debian/tmp/usr/doc/$(package)/FAQ-2.txt
+ find debian/tmp/usr/doc/$(package) debian/tmp/usr/man \
+ -type f -exec gzip -v9 {} ";"
+ cd debian/tmp/usr/man/man8 && \
+ ln -s sendmail.8.gz ./purgestat.8.gz && \
+ ln -s sendmail.8.gz ./hoststat.8.gz
+ cp -p debian/{README*,copyright} contrib/passwd-to-alias.pl \
+ KNOWNBUGS debian/tmp/usr/doc/$(package)
+ chmod a-x debian/tmp/usr/doc/$(package)/passwd-to-alias.pl
+ cp debian/debproto.mc debian/tmp/usr/lib/sendmail.cf/cf
+ cp -p debian/debian.m4 cf/ostype/* \
+ debian/tmp/usr/lib/sendmail.cf/ostype
+ cp -p cf/domain/* debian/tmp/usr/lib/sendmail.cf/domain
+ cp -a cf/{feature,m4,mailer,sh} debian/tmp/usr/lib/sendmail.cf
+
+ $(MAKE) -f debian/rules bin
+ $(MAKE) -f debian/rules hacks
+ install debian/init.d debian/tmp/etc/init.d/$(package)
+ #install -m 755 debian/ip-up.d debian/tmp/etc/ppp/ip-up.d/$(package)
+ #install -m 755 debian/ip-down.d debian/tmp/etc/ppp/ip-down.d/$(package)
+ cp -p debian/{aliases,nssnodns.conf} debian/tmp/etc
+
+ chmod -R u=rwX,go=rX debian/tmp
+ chown -R root.root debian/tmp
+ chmod 4755 debian/tmp/usr/sbin/sendmail
+ chmod 700 debian/tmp/var/state/sendmail
+ $(MAKE) -s -f debian/rules buildinfo
+
+# dh_installdocs
+# dh_installexamples
+# dh_installmenu
+# dh_installcron
+# dh_installmanpages
+ dh_installchangelogs
+# dh_movefiles
+ dh_strip
+# dh_compress
+ dh_fixperms
+ dh_suidregister
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+# dh_makeshlibs
+ dh_md5sums
+ dh_builddeb
+
+
+clean:
+ $(checkdir)
+ rm -f build
+ test ! -d debian/tmp || rm -rf debian/tmp
+ $(MAKE) -C smrsh -f Makefile.dist clean
+ $(MAKE) -C praliases -f Makefile.dist clean
+ $(MAKE) -C makemap -f Makefile.dist clean
+ $(MAKE) -C mailstats -f Makefile.dist clean
+ $(MAKE) -C mail.local -f Makefile.dist clean
+ rm -f doc/{changes/changes,intro/intro,op/op,usenix/usenix}.txt
+ rm -rf rmail/rmail stamp-build $$(find . -name "*~") src/obj.*
+ rm -rf $$(find debian/* -type d) $$(find src makemap -type l)
+ rm -rf debian/{files*,*substvars*} debian/{check.tar,sensible-mda}
+ find .. -name $(package)*.asc -size 0 -maxdepth 1 -exec rm {} ";"
+ chmod +x debian/{pre*,post*,runq,sendmailconfig}
+
+
+buildinfo:
+ @echo; dpkg -l gcc "libc6*" binutils ldso make dpkg-dev $(BUILDINFO) \
+ | awk '$$1 == "ii" { printf("%s-%s\n", $$2, $$3) }' \
+ | tee debian/tmp/usr/doc/$(package)/buildinfo.Debian; echo
+ chmod 644 debian/tmp/usr/doc/$(package)/buildinfo.Debian
+# cd debian/tmp && md5sum $$(find * -type f -not -regex "DEBIAN/.*") \
+# > DEBIAN/md5sums
+# rm -f debian/tmp/files.sig
+# -cd debian/tmp && pgp -sat +clearsig=on DEBIAN/md5sums -o files.sig \
+# && chmod 644 files.sig \
+# && mv -v files.sig usr/doc/$(package)/checksums.txt
+
+
+define checkdir
+ test -f debian/rules
+endef
+
+# Below here is fairly generic really
+
+binary: binary-indep binary-arch
+
+source diff:
+ @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
+
+checkroot:
+ $(checkdir)
+ test root = "`whoami`"
+
+.PHONY: binary binary-arch binary-indep clean checkroot