diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 16:16:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 16:16:13 +0000 |
commit | e90fcc54809db2591dc083f43ef54c6ec8c60847 (patch) | |
tree | f20bc206c3c2d5d59d37c46c5cf5d53a20642556 /scripts | |
parent | Initial commit. (diff) | |
download | exim4-e90fcc54809db2591dc083f43ef54c6ec8c60847.tar.xz exim4-e90fcc54809db2591dc083f43ef54c6ec8c60847.zip |
Adding upstream version 4.96.upstream/4.96upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | scripts/Configure | 10 | ||||
-rwxr-xr-x | scripts/Configure-Makefile | 360 | ||||
-rwxr-xr-x | scripts/Configure-config.h | 60 | ||||
-rwxr-xr-x | scripts/Configure-eximon | 51 | ||||
-rwxr-xr-x | scripts/Configure-os.c | 30 | ||||
-rwxr-xr-x | scripts/Configure-os.h | 51 | ||||
-rwxr-xr-x | scripts/MakeLinks | 133 | ||||
-rwxr-xr-x | scripts/arch-type | 74 | ||||
-rwxr-xr-x | scripts/exim_install | 472 | ||||
-rwxr-xr-x | scripts/lookups-Makefile | 194 | ||||
-rwxr-xr-x | scripts/newer | 21 | ||||
-rwxr-xr-x | scripts/os-type | 164 | ||||
-rwxr-xr-x | scripts/reversion | 134 | ||||
-rw-r--r-- | scripts/source_checks | 52 |
14 files changed, 1806 insertions, 0 deletions
diff --git a/scripts/Configure b/scripts/Configure new file mode 100755 index 0000000..6c340ee --- /dev/null +++ b/scripts/Configure @@ -0,0 +1,10 @@ +#! /bin/sh -e + +# A script to be called to run all the other configuring scripts manually. + +scripts/Configure-Makefile +scripts/Configure-os.h +scripts/Configure-os.c +scripts/Configure-config.h + +# End of Configure diff --git a/scripts/Configure-Makefile b/scripts/Configure-Makefile new file mode 100755 index 0000000..ed77b6a --- /dev/null +++ b/scripts/Configure-Makefile @@ -0,0 +1,360 @@ +#! /bin/sh +LC_ALL=C +export LC_ALL + +# Shell script to build Makefile in a build directory. It must be called +# from inside the directory. It does its own checking of when to rebuild; it +# just got too horrendous to get it right in "make", because of the optionally +# existing configuration files. +# +# Copyright (c) The Exim Maintainers 1995 - 2021 + + +# First off, get the OS type, and check that there is a make file for it. + +ostype=`../scripts/os-type -generic` || exit 1 + +if [ ! -r ../OS/Makefile-$ostype ] ; then + echo "" + echo "*** Sorry - operating system $ostype is not supported" + echo "*** See OS/Makefile-* for supported systems" 1>&2 + echo "" + exit 1 +fi + +# We also need the architecture type, in order to test for any architecture- +# specific configuration files. + +archtype=`../scripts/arch-type` || exit 1 + +# Now test for either the non-existence of Makefile, or for any of its +# components being newer. Note that the "newer" script gives the right +# answer (for our purposes) when the first file is non-existent. + +editme=../Local/Makefile +rebuild=yes + +if [ -f Makefile ] ; then + rebuild=no + if ../scripts/newer $editme Makefile || \ + ../scripts/newer $editme-$ostype Makefile || \ + ../scripts/newer $editme-$archtype Makefile || \ + ../scripts/newer $editme-$ostype-$archtype Makefile || \ + ../scripts/newer ../scripts/Configure-Makefile Makefile || \ + ../scripts/newer ../OS/Makefile-Base Makefile || \ + ../scripts/newer ../OS/Makefile-Default Makefile + then + rebuild=yes + fi +fi + +# If the "build" variable is set it means that a build name was explicitly +# given. Arrange to pick up a build-specific configuration file. + +if [ "X$build" != "X" ] ; then + mfb=Local/Makefile-$build + if ../scripts/newer $editme-$build Makefile ; then + rebuild=yes + fi +else + mfb= +fi + + +# If Makefile is up-to-date, no need to rebuild it. + +if [ $rebuild = no ] ; then + echo "\`Makefile' is up to date." + echo " " + exit +fi + +# Makefile needs to be rebuilt in the current directory by joining +# the generic default makefile, the OS base makefile, and then local +# generic, OS-specific, architecture-specific, and OS+architecture-specific +# makefiles, if they exist. These files all contain macro definitions, with +# later definitions overriding earlier ones. Make a temporary file first, in +# case things go wrong. A second temporary is needed for sorting out the +# default Perl stuff. Use short macro names to save typing. + +mf=Makefile +mft=$mf-t +mftt=$mf-tt +mftepcp=$mf-tepcp +mftepcp2=$mf-tepcp2 + +look_mf=lookups/Makefile +look_mf_pre=${look_mf}.predynamic +look_mf_post=${look_mf}.postdynamic + +# Ensure the temporary does not exist and start the new one by setting +# the OSTYPE and ARCHTYPE variables. + +rm -f $mft $mftt $mftepcp $mftepcp2 $look_mf-t +(echo "OSTYPE=$ostype"; echo "ARCHTYPE=$archtype"; echo "") > $mft || exit 1 + +# Now concatenate the files to the temporary file. Copy the files using sed to +# remove comments, blank lines, and trailing white space. + +# BEWARE: a tab character is needed in the sed command below. It has had +# a nasty tendency to get lost in the past, causing a problem if a tab has +# actually been present in one of the files. Use a variable to hold a space +# and a tab to keep the tab in one place. + +st=' ' + +for f in OS/Makefile-Default \ + OS/Makefile-$ostype \ + Local/Makefile \ + Local/Makefile-$ostype \ + Local/Makefile-$archtype \ + Local/Makefile-$ostype-$archtype \ + $mfb +do if test -r ../$f + then echo "# From $f" + sed "/^#/d;/^[$st]*\$/d;s/[$st]*\$//" ../$f || exit 1 + echo "# End of $f" + echo "" + fi +done \ + | sed 's/^TMPDIR=/EXIM_&/' \ + >> $mft || exit 1 + +# handle PKG_CONFIG_PATH because we need it in our env, and we want to handle +# wildcards; note that this logic means all setting _appends_ values, never +# replacing; if that's a problem, we can revisit. +sed -n "s/^[$st]*PKG_CONFIG_PATH[$st]*[+]*=[$st]*//p" $mft | \ + sed "s/[$st]*\$//" >> $mftepcp +if test -s ./$mftepcp +then + # expand any wildcards and strip spaces, to make it a real PATH-like variable + ( IFS=":${IFS-$st}"; for P in `cat ./$mftepcp`; do echo "$P"; done ) | xargs | sed "s/[$st]/:/g" >./$mftepcp2 + sed "s/^/PKG_CONFIG_PATH='/" < ./$mftepcp2 | sed "s/\$/'/" > ./$mftepcp + . ./$mftepcp + export PKG_CONFIG_PATH + egrep -v "^[$st]*PKG_CONFIG_PATH[$st]*=" ./$mft > ./$mftt + rm -f ./$mft + ( + echo "# Collapsed PKG_CONFIG_PATH in build-prep:" + sed "s/'//g" ./$mftepcp + echo "# End of collapsed PKG_CONFIG_PATH" + echo "" + cat ./$mftt + ) > ./$mft + rm -f ./$mftt +fi +rm -f ./$mftepcp ./$mftepcp2 + +# handle pkg-config +# beware portability of extended regexps with sed. +egrep "^[$st]*(AUTH|LOOKUP)_[A-Z0-9_]*[$st]*=[$st]*" $mft | \ + sed "s/[$st]*=/='/" | \ + sed "s/\$/'/" > $mftt +egrep "^[$st]*((USE_(OPENSSL|GNUTLS)_PC)|SUPPORT_TLS|USE_GNUTLS|PCRE2?_CONFIG|AVOID_GNUTLS_PKCS11)[$st]*=[$st]*" $mft | \ + sed "s/[$st]*=/='/" | \ + sed "s/\$/'/" >> $mftt +if test -s $mftt +then + ( + echo "# pkg-config fixups" + . ./$mftt + for var in `cut -d = -f 1 < $mftt`; do + case $var in + + USE_*_PC) + eval "pc_value=\"\$$var\"" + need_this='' + need_core='' + if [ ".$DISABLE_TLS" = .yes ]; then + # no TLS, not referencing + true + elif [ ".$var" = ".USE_GNUTLS_PC" ] && [ ".$USE_GNUTLS" != "." ]; then + need_this=t + need_core="gnutls-special" + elif [ ".$var" = ".USE_OPENSSL_PC" ] && [ ".$USE_GNUTLS" = "." ]; then + need_this=t + need_core=t + fi + if [ ".$need_this" != "." ]; then + tls_include=`pkg-config --cflags $pc_value` + if [ $? -ne 0 ]; then + echo >&2 "*** Missing pkg-config for package $pc_value (for Exim $var build option)" + exit 1 + fi + tls_libs=`pkg-config --libs $pc_value` + echo "TLS_INCLUDE=$tls_include" + echo "TLS_LIBS=$tls_libs" + # With hash.h pulling crypto into the core, we need to also handle that + if [ ".$need_this" = ".t" ]; then + echo "CFLAGS += $tls_include" + echo "LDFLAGS += $tls_libs" + elif [ ".$need_this" = ".gnutls-special" ]; then + if pkg-config --atleast-version=2.10 gnutls ; then + echo "CFLAGS += $tls_include" + echo "LDFLAGS += $tls_libs" + else + echo "CFLAGS += `libgcrypt-config --cflags`" + echo "LDFLAGS += `libgcrypt-config --libs`" + fi + fi + fi + ;; + + *_PC) + eval "pc_value=\"\$$var\"" + base=`echo $var | sed 's/_PC$//'` + eval "basevalue=\"\$$base\"" + if [ ".$basevalue" = "." ]; then + # not pulling in this module, _PC defined as default? Ignore + true + elif [ $basevalue = 2 ]; then + # module; handled in scripts/lookups-Makefile + true + else + # main binary + cflags=`pkg-config --cflags $pc_value` + if [ $? -ne 0 ]; then + echo >&2 "*** Missing pkg-config for package $pc_value (for Exim $var build option)" + exit 1 + fi + libs=`pkg-config --libs $pc_value` + if [ "$var" != "${var#LOOKUP_}" ]; then + echo "LOOKUP_INCLUDE += $cflags" + echo "LOOKUP_LIBS += $libs" + elif [ "$var" != "${var#AUTH_}" ]; then + echo "CFLAGS += $cflags" + echo "AUTH_LIBS += $libs" + else + echo >&2 "Don't know how to handle pkg-config for $var" + fi + fi + ;; + + PCRE_CONFIG) + case $PCRE_CONFIG in + yes|YES|y|Y) + echo >&2 "pcre is no longer supported; migrate to pcre2" + exit 1 + +# cflags=`pcre-config --cflags` +# if [ $? -ne 0 ]; then +# echo >&2 "*** Missing pcre-config for regular expression support" +# exit 1 +# fi +# libs=`pcre-config --libs` +# if [ ".$cflags" != "." ]; then +# echo "INCLUDE += $cflags" +# fi +# echo "PCRE_LIBS=$libs" + ;; + esac + ;; + + PCRE2_CONFIG) + case $PCRE2_CONFIG in + yes|YES|y|Y) + cflags=`pcre2-config --cflags` + if [ $? -ne 0 ]; then + echo >&2 "*** Missing pcre2-config for regular expression support" + exit 1 + fi + libs=`pcre2-config --libs8` + if [ ".$cflags" != "." ]; then + echo "INCLUDE += $cflags" + fi + echo "PCRE_LIBS=$libs" + ;; + esac + ;; + + AVOID_GNUTLS_PKCS11) + echo "$var=yes" + ;; + + esac + done + echo "# End of pkg-config fixups" + echo + ) >> $mft + subexit=$? + if [ $subexit -ne 0 ]; then + exit $subexit + fi +fi +rm -f $mftt + +# make the lookups Makefile with the definitions +# the auxiliary script generates $look_mf_post from $look_mf_pre + +cp ../src/lookups/Makefile $look_mf_pre +../scripts/lookups-Makefile + +# See if there is a definition of EXIM_PERL in what we have built so far. +# If so, run Perl to find the default values for PERL_CC, PERL_CCOPTS, +# and PERL_LIBS. These need to be put at the top of the Makefile, so we rename +# what we have so far and then copy it afterwards. Use the value of PERL_COMMAND +# if it has been defined. + +EXIM_PERL=`grep EXIM_PERL $mft` + +PERL_COMMAND=`grep PERL_COMMAND $mft | sed -e "\\$!d;s/^[$st]*PERL_COMMAND[$st]*=[$st]*//"` +if [ "${PERL_COMMAND}" = "" ] ; then + PERL_COMMAND='perl' +fi + +if [ "${EXIM_PERL}" != "" ] ; then + testperl=`$PERL_COMMAND --version` + if [ "$testperl" = "" ] ; then + echo "*** EXIM_PERL is set, but '$PERL_COMMAND --version' failed" + exit 1 + fi + + EXTUTILS_EMBED_NOT_INSTALLED=`$PERL_COMMAND -MExtUtils::Embed -e ";" 2>&1` + if [ "${EXTUTILS_EMBED_NOT_INSTALLED}" != "" ] ; then + echo "Please install ExtUtils::Embed for $PERL_COMMAND" + exit 1; + fi + + mv $mft $mftt + echo "PERL_CC=`$PERL_COMMAND -MConfig -e 'print $Config{cc}'`" >>$mft + echo "PERL_CCOPTS=`$PERL_COMMAND -MExtUtils::Embed -e ccopts`" >>$mft + echo "PERL_LIBS=`$PERL_COMMAND -MExtUtils::Embed -e ldopts`" >>$mft + echo "" >>$mft + cat $mftt >> $mft + rm -f $mftt +fi + +# Record the build variable in the Makefile. + +echo "build=$build" >>$mft +echo "" >>$mft + +# Finally, join on the generic base make file, which contains the actual +# rules and stuff. + +echo "# From ../OS/Makefile-Base" >> $mft +cat ../OS/Makefile-Base >> $mft || exit 1 + +# If the new makefile is the same as the existing one, say so, and just +# update the timestamp. Otherwise remove the old and install the new. + +if [ -s $mf ] && cmp -s $mft $mf && [ -s $look_mf ] && cmp -s $look_mf_post $look_mf +then echo ">>> rebuilt $mf unchanged" + echo " " + touch $mf || exit + rm -f $mft $look_mf_pre $look_mf_post +elif rm -f $mf $look_mf $look_mf_pre + mv $mft $mf + mv $look_mf_post $look_mf +then echo ">>> New $mf & $look_mf installed" + echo '>>> Use "make makefile" if you need to force rebuilding of the makefile' + echo " " +else echo " " + echo "*** Failed to install $mf - see $mft" + echo " (or $look_mft)" + echo " " + exit 1; +fi + +# vim: set ft=sh : +# End of Configure-Makefile diff --git a/scripts/Configure-config.h b/scripts/Configure-config.h new file mode 100755 index 0000000..75d366f --- /dev/null +++ b/scripts/Configure-config.h @@ -0,0 +1,60 @@ +#! /bin/sh + +# Build the config.h file, using the buildconfig program, first ensuring that +# it exists. + +# 22-May-1996: remove the use of the "-a" flag for /bin/sh because it is not +# implemented in the FreeBSD shell. Sigh. + +# 12-Mar-1997: add s/#.*$// to the sed script to allow for comments on the +# ends of settings - someone got caught. + +# 18-Apr-1997: put the tab character into a variable to stop it getting +# lost by accident (which has happened a couple of times). + +# 19-Jan-1998: indented settings in the makefile weren't being handled +# correctly; added [$st]* before \\([A-Z] in the pattern, to ignore leading +# space. Oddly, the pattern previously read ^\([A-Z which didn't seem to +# cause a problem (but did when the new bit was put in). + +# 04-May-2005: if $1 is set, copy it into $MAKE, and then use $MAKE, if set, +# instead of "make" so that if gmake is used, it is used consistently. + +if [ "$1" != "" ] ; then MAKE=$1 ; fi +if [ "$MAKE" = "" ] ; then MAKE=make ; fi + +$MAKE buildconfig || exit 1 + +# BEWARE: tab characters needed in the following sed command. They have had +# a nasty tendency to get lost in the past, causing a problem if a tab has +# actually been present in makefile. Use a variable to hold a space and a +# tab to keep the tab in one place. This makes the sed option horrendous to +# read, but the whole script is safer. + +st=' ' + +(sed -n \ + "/\\\$/d;s/#.*\$//;s/^[$st]*\\([A-Z][^:!+$st]*\\)[$st]*=[$st]*\\([^$st]*\\)[$st]*\$/\\1=\\2 export \\1/p" \ + < Makefile ; echo "./buildconfig") | /bin/sh + +# If buildconfig ends with an error code, it will have output an error +# message. Ensure that a broken config.h gets deleted. + +if [ $? != 0 ] ; then + rm -f config.h + exit 1 +fi + +# Double-check that config.h is complete. + +if [ "`tail -1 config.h`" != "/* End of config.h */" ] ; then + echo "*** config.h appears to be incomplete" + echo "*** unexpected failure in buildconfig program" + exit 1 +fi + +echo ">>> config.h built" +echo "" + +# vim: set ft=sh : +# End of Configure-config.h diff --git a/scripts/Configure-eximon b/scripts/Configure-eximon new file mode 100755 index 0000000..0aca3b3 --- /dev/null +++ b/scripts/Configure-eximon @@ -0,0 +1,51 @@ +#! /bin/sh + +# Shell script to build the configurable part of the Exim monitor's start-up +# script. This is built from various configuration files. The final part is +# added in the Makefile, using various macros that are available at that stage. + +scripts=../scripts + +# First off, get the OS type, and check that there is a make file for it. + +os=`$scripts/os-type -generic` || exit 1 + +if test ! -r ../OS/Makefile-$os +then echo "" + echo "*** Sorry - operating system $os is not supported" + echo "*** See OS/Makefile-* for supported systems" 1>&2 + echo "" + exit 1; +fi + +# We also need the architecture type, in order to test for any architecture- +# specific configuration files. + +arch=`$scripts/arch-type` || exit 1 + +# Build a file called eximon in the current directory by joining +# the generic default configure file, the OS base configure file, and then +# local generic, OS-specific, architecture-specific, and OS+architecture- +# specific configurationfiles, if they exist. These files all contain variable +# definitions, with later definitions overriding earlier ones. + +echo "#!/bin/sh" > eximon +chmod a+x eximon + +# Concatenate the configuration files that exist + +for f in OS/eximon.conf-Default \ + OS/eximon.conf-$os \ + Local/eximon.conf \ + Local/eximon.conf-$os \ + Local/eximon.conf-$arch \ + Local/eximon.conf-$os-$arch +do if test -r ../$f + then echo "# From $f" + sed '/^#/d;/^[ ]*$/d' ../$f || exit 1 + echo "# End of $f" + echo "" + fi +done >> eximon || exit 1 + +# End of Configure-eximon diff --git a/scripts/Configure-os.c b/scripts/Configure-os.c new file mode 100755 index 0000000..f00a562 --- /dev/null +++ b/scripts/Configure-os.c @@ -0,0 +1,30 @@ +#! /bin/sh + +# Shell script to build os.c. There doesn't have to be an OS-specific os.c +# file, but if there is, it gets copied at the start of os.c. The basic src +# copy of os.c contains generic functions, controlled in some cases by +# macro switches so that where they are common to a number of OS, they can +# just be switched in. + +scripts=../scripts + +# First off, get the OS type, and check that there is a make file for it. + +os=`$scripts/os-type -generic` || exit 1 + +if test ! -r ../OS/Makefile-$os +then echo "" + echo "*** Sorry - operating system $os is not supported" + echo "*** See OS/Makefile-* for supported systems" 1>&2 + echo "" + exit 1; +fi + +# Now build the file + +rm -f os.c +echo '#include "exim.h"' > os.c || exit 1 +test -r ../OS/os.c-$os && cat ../OS/os.c-$os >> os.c +echo '#include "../src/os.c"' >> os.c || exit 1 + +# End of Configure-os.c diff --git a/scripts/Configure-os.h b/scripts/Configure-os.h new file mode 100755 index 0000000..ae1ecf9 --- /dev/null +++ b/scripts/Configure-os.h @@ -0,0 +1,51 @@ +#! /bin/sh + +# Shell script to create a link to the appropriate OS-specific header file. + +scripts=../scripts + +# Get the OS type, and check that there is a make file for it. + +os=`$scripts/os-type -generic` || exit 1 + +if test ! -r ../OS/Makefile-$os +then echo "" + echo "*** Sorry - operating system $os is not supported" + echo "*** See OS/Makefile-* for supported systems" 1>&2 + echo "" + exit 1; +fi + +# Ensure there is an OS-specific header file, and link it to os.h. There should +# always be one if there is a make file for the OS, so its absence is somewhat +# disastrous. + +if test ! -r ../OS/os.h-$os +then echo "" + echo "*** Build error: OS/os.h-$os file is missing" + echo "" + exit 1; +fi +rm -f os.h + +# In order to accommodate for the fudge below, copy the file instead of +# symlinking it. Otherwise we pollute the clean copy with the fudge. +cp -p ../OS/os.h-$os os.h || exit 1 + +# Special-purpose fudge for older versions of Linux (pre 2.1.15) that +# use the structure name "options" instead of "ip_options". + +if [ "$os" != "Linux" -a "$os" != "Linux-libc5" ] ; then exit 0; fi + +grep ip_options /usr/include/linux/ip.h >/dev/null +if [ $? = 0 ] ; then exit 0; fi + +cat >>os.h <<End + +/* Fudge added because this Linux doesn't appear to have a definition +for ip_options in /usr/include/linux/ip.h. */ + +#define ip_options options +End + +# End of Configure-os.h diff --git a/scripts/MakeLinks b/scripts/MakeLinks new file mode 100755 index 0000000..9cdb931 --- /dev/null +++ b/scripts/MakeLinks @@ -0,0 +1,133 @@ +#!/bin/sh + +# Script to build links for all the exim source files from the system- +# specific build directory. It should be run from within that directory. +# +# Copyright (c) The Exim Maintainers 1995 - 2022 + +test ! -d ../src && \ + echo "*** $0 should be run in a system-specific subdirectory." && \ + exit 1 +test -r version.c && \ + echo "*** It appears that $0 has already been run." && \ + exit 1 +if [ -r pcre/Makefile ] ; then + echo "*** It appears that $0 was previously interrupted." + echo "*** You need to remove the build directory, and then run 'make' again." + exit 1 +fi + + +echo "" +echo ">>> Creating links to source files..." + + +# The sources for modular parts of Exim have to be linked independently +# in their own sub-directories, since their .o files are built using +# their own Makefile in their sub-directory. + +# Firstly the lookups +mkdir lookups +cd lookups +# Makefile is generated +for f in README cdb.c dbmdb.c dnsdb.c dsearch.c ibase.c json.c ldap.h ldap.c \ + lmdb.c lsearch.c mysql.c nis.c nisplus.c oracle.c passwd.c \ + pgsql.c readsock.c redis.c spf.c sqlite.c testdb.c whoson.c \ + lf_functions.h lf_check_file.c lf_quote.c lf_sqlperform.c +do + ln -s ../../src/lookups/$f $f +done + +cd .. + +# Likewise for the code for the routers +mkdir routers +cd routers +for f in README Makefile accept.h accept.c dnslookup.h dnslookup.c \ + ipliteral.h ipliteral.c iplookup.h iplookup.c manualroute.h \ + manualroute.c queryprogram.h queryprogram.c redirect.h redirect.c \ + rf_functions.h rf_change_domain.c rf_expand_data.c rf_get_errors_address.c \ + rf_get_munge_headers.c rf_get_transport.c rf_get_ugid.c rf_queue_add.c \ + rf_lookup_hostlist.c rf_self_action.c rf_set_ugid.c +do + ln -s ../../src/routers/$f $f +done + +cd .. + +# Likewise for the code for the transports +mkdir transports +cd transports +for f in README Makefile appendfile.h appendfile.c autoreply.h \ + autoreply.c lmtp.h lmtp.c pipe.h pipe.c queuefile.c queuefile.h \ + smtp.h smtp.c smtp_socks.c tf_maildir.c tf_maildir.h +do + ln -s ../../src/transports/$f $f +done + +cd .. + +# Likewise for the code for the authentication drivers +mkdir auths +cd auths +for f in README Makefile call_pam.c call_pwcheck.c \ + call_radius.c check_serv_cond.c cyrus_sasl.c cyrus_sasl.h gsasl_exim.c \ + gsasl_exim.h get_data.c get_no64_data.c heimdal_gssapi.c heimdal_gssapi.h \ + xtextencode.c xtextdecode.c cram_md5.c cram_md5.h plaintext.c plaintext.h \ + pwcheck.c pwcheck.h auth-spa.c auth-spa.h dovecot.c dovecot.h sha1.c spa.c \ + spa.h tls.c tls.h external.c external.h +do + ln -s ../../src/auths/$f $f +done +cd .. + +# Likewise for the code for the PDKIM library +mkdir pdkim +cd pdkim +for f in README Makefile crypt_ver.h pdkim.c \ + pdkim.h hash.c hash.h signing.c signing.h blob.h +do + ln -s ../../src/pdkim/$f $f +done +cd .. + +# The basic source files for Exim and utilities. NB local_scan.h gets linked, +# but local_scan.c does not, because its location is taken from the build-time +# configuration. Likewise for the os.c file, which gets build dynamically. + +for f in blob.h dbfunctions.h exim.h functions.h globals.h \ + hash.h hintsdb.h hintsdb_structs.h local_scan.h \ + macros.h mytypes.h osfunctions.h store.h structs.h lookupapi.h sha_ver.h \ + \ + acl.c buildconfig.c base64.c child.c crypt16.c daemon.c dbfn.c debug.c \ + deliver.c directory.c dns.c dnsbl.c drtables.c dummies.c enq.c exim.c \ + exim_dbmbuild.c exim_dbutil.c exim_lock.c expand.c filter.c filtertest.c \ + globals.c hash.c header.c host.c ip.c log.c lss.c match.c md5.c moan.c \ + parse.c perl.c priv.c queue.c rda.c readconf.c receive.c retry.c rewrite.c \ + rfc2047.c route.c search.c setenv.c environment.c \ + sieve.c smtp_in.c smtp_out.c spool_in.c spool_out.c std-crypto.c store.c \ + string.c tls.c tlscert-gnu.c tlscert-openssl.c tls-cipher-stdname.c \ + tls-gnu.c tls-openssl.c \ + tod.c transport.c tree.c verify.c version.c \ + dkim.c dkim.h dkim_transport.c dmarc.c dmarc.h \ + valgrind.h memcheck.h \ + macro_predef.c macro_predef.h +do + ln -s ../src/$f $f +done + +# WITH_CONTENT_SCAN +for f in spam.c spam.h spool_mbox.c regex.c mime.c mime.h malware.c +do + ln -s ../src/$f $f +done + +# EXPERIMENTAL_* +for f in arc.c bmi_spam.c bmi_spam.h dcc.c dcc.h dane.c dane-openssl.c \ + danessl.h imap_utf7.c spf.c spf.h srs.c srs.h utf8.c +do + ln -s ../src/$f $f +done + + +# End of MakeLinks diff --git a/scripts/arch-type b/scripts/arch-type new file mode 100755 index 0000000..f5fe8eb --- /dev/null +++ b/scripts/arch-type @@ -0,0 +1,74 @@ +#! /bin/sh + +# Shell script to determine the architecture type. + +# If EXIM_ARCHTYPE is set, use it. This allows a manual override. + +case "$EXIM_ARCHTYPE" in ?*) arch="$EXIM_ARCHTYPE";; esac + +# Otherwise, try to get a value from the uname command. When uname -p gives +# "unknown" or something containing spaces, try -m. + +case "$arch" in '') arch=`uname -p 2> /dev/null`;; esac +case "$arch" in ''|unknown|*\ *) arch=`uname -m 2> /dev/null`;; esac + +# Otherwise, see if ARCHTYPE is set. Some versions of NetBSD set it to +# "NetBSD", which isn't very helpful. However, we expect uname to have +# worked under NetBSD, so this shouldn't matter. + +case "$arch" in '') arch="$ARCHTYPE";; esac + +# Otherwise, as a cheap test, try shell's HOSTTYPE, but as tcsh sometimes sets +# it to the OS name, ignore it if running with tcsh. + +case "$SHELL" in ?*tcsh) HOSTTYPE="";; esac + +case "$arch++$HOSTTYPE" in +++?*) arch="$HOSTTYPE" + # Fix up disagreements :-) + case "$arch" in + sun4*) arch=sparc;; + +# Comment by Vadim Vygonets: +# Maybe sun4/sun4c/sun4m and sun4u (or whatever else they call the +# Ultras, sparc64?) should be different platforms. Maybe not. +# NetBSD and OpenBSD (the latter is not supported) think about them +# as different platforms. Solaris doesn't seem to. I have no idea +# about Linux. + + sgi) arch=mips;; + MIPSEL) arch=mips;; + esac + ;; +esac + +# Give up if failed. + +case "$arch" in +'') echo "" 1>&2 + echo "*** Failed to determine the machine architecture type." 1>&2 + echo "" 1>&2 + echo UnKnown + exit 1;; +esac + +# Get rid of any gash characters in the string + +arch=`echo $arch | sed 's,[^-+_.a-zA-Z0-9],,g'` + +# Some further fixups needed + +case "$arch" in +i[3456]86*) arch=i386;; +RISC) arch=mips;; # MIPS Ultrix +IP22) arch=mips;; +9000[78][0-9][0-9]) arch=hp9000s700;; +9000[34][0-9][0-9]) arch=hp9000s400;; +3050R) arch=3050;; +esac + +# OK, the script seems to have worked. Pass the value back. + +echo "$arch" + +# End of arch-type diff --git a/scripts/exim_install b/scripts/exim_install new file mode 100755 index 0000000..1e88050 --- /dev/null +++ b/scripts/exim_install @@ -0,0 +1,472 @@ +#! /bin/sh + +# Script to install Exim binaries in BIN_DIRECTORY, which is defined in +# the local Makefile. It expects to be run in a build directory. It needs +# to be run as root in order to make exim setuid to root. If exim runs setuid +# to (e.g.) exim, this script should be run as that user or root. + +# This script also installs a default configuration file in CONFIGURE_FILE +# if there is no configuration file there, but only if CONFIGURE_FILE specifies +# single file. If it specifies a list, no action is taken. + +# If a default configuration file is installed, the existence of the system +# aliases file is tested. A default, containing only comments, is installed if +# necessary. + +# If INFO_DIRECTORY is defined in any of the local Makefiles, and the Exim doc +# directory contains the Texinfo documentation, this script also installs a +# the info files in INFO_DIRECTORY. + +# If DESTDIR is defined, all file paths are prefixed with ${DESTDIR}, with the +# sole exception of the reference to the system aliases file in the default +# configuration, because it is assumed that Exim is not actually going to be +# run from this position. For backward compatibility, if DESTDIR is not +# defined, ROOT is used instead. + +# The script can be made to output what it would do, without actually doing +# anything, by giving it the option "-n" (cf make). Arguments are the names +# of things to install. No arguments installs everything. + +do_chown=yes +do_symlink=yes + +while [ $# -gt 0 ] ; do + case "$1" in + -n) + real="true || " + ver="verification " + com=": " + echo $com "" + echo $com "*** Verification mode only: no commands will actually be obeyed" + echo $com "*** You can cut and paste the bits you want to a shell, etc" + echo $com "" + echo cd `pwd` + ;; + + -no_chown) + do_chown=no + ;; + + -no_symlink) + do_symlink=no + ;; + + *) + break + ;; + esac + shift +done + +# Get the values of BIN_DIRECTORY, CONFIGURE_FILE, INFO_DIRECTORY, NO_SYMLINK, +# SYSTEM_ALIASES_FILE, and EXE from the global Makefile (in the build +# directory). EXE is empty except in the Cygwin environment. In each case, keep +# the latest definition, thus respecting the Makefiles precedence. The sed +# sequences here are messy, but have to be very "basic" in order to work on +# Solaris, where the regular expressions in sed are primitive indeed. Modify at +# your peril. + +BIN_DIRECTORY=`sed -n -e '/^ *BIN_DIRECTORY *=/{s/^[^=]*= *//; s/ \{1,\}#.*//;s/ *$//;h;}' -e '${g;p;}' Makefile` +CONFIGURE_FILE=`sed -n -e '/^ *CONFIGURE_FILE *=/{s/^[^=]*= *//; s/ \{1,\}#.*//;s/ *$//;h;}' -e '${g;p;}' Makefile` +INFO_DIRECTORY=`sed -n -e '/^ *INFO_DIRECTORY *=/{s/^[^=]*= *//; s/ \{1,\}#.*//;s/ *$//;h;}' -e '${g;p;}' Makefile` +NO_SYMLINK=`sed -n -e '/^ *NO_SYMLINK *=/{s/^[^=]*= *//; s/ \{1,\}#.*//;s/ *$//;h;}' -e '${g;p;}' Makefile` + +CHOWN=`sed -n -e '/^ *CHOWN_COMMAND *=/{s/^[^=]*= *//; s/ \{1,\}#.*//;s/ *$//;h;}' -e '${g;p;}' Makefile` +MV=`sed -n -e '/^ *MV_COMMAND *=/{s/^[^=]*= *//; s/ \{1,\}#.*//;s/ *$//;h;}' -e '${g;p;}' Makefile` + +SYSTEM_ALIASES_FILE=`sed -n -e '/^ *SYSTEM_ALIASES_FILE *=/{s/^[^=]*= *//; s/ \{1,\}#.*//;s/ *$//;h;}' -e '${g;p;}' Makefile` +EXE=`sed -n -e '/^ *EXE *=/{s/^[^=]*= *//; s/ \{1,\}#.*//;s/ *$//;h;}' -e '${g;p;}' Makefile` + +# Set a default for SYSTEM_ALIASES_FILE + +if [ "${SYSTEM_ALIASES_FILE}" = "" ] ; then + SYSTEM_ALIASES_FILE=/etc/aliases +fi + +# Allow INST_xx to over-ride xx +case "$INST_BIN_DIRECTORY" in ?*) BIN_DIRECTORY="$INST_BIN_DIRECTORY";; esac +case "$INST_CONFIGURE_FILE" in ?*) CONFIGURE_FILE="$INST_CONFIGURE_FILE";; esac +case "$INST_INFO_DIRECTORY" in ?*) INFO_DIRECTORY="$INST_INFO_DIRECTORY";; esac +case "$INST_SYSTEM_ALIASES_FILE" in ?*) SYSTEM_ALIASES_FILE="$INST_SYSTEM_ALIASES_FILE";; esac + +case "$INST_CHOWN" in ?*) CHOWN="$INST_CHOWN";; esac +case "$INST_MV" in ?*) MV="$INST_MV";; esac + +case "$INST_UID" in '') INST_UID=root;; *) INST_UID="$INST_UID";; esac +case "$INST_CP" in '') CP=cp;; *) CP="$INST_CP";; esac +case "$INST_LN" in '') LN=ln;; *) LN="$INST_LN";; esac +case "$INST_CHMOD" in '') CHMOD=chmod;; *) CHMOD="$INST_CHMOD";; esac +case "$INST_DIRNAME" in '') DIRNAME=dirname;; *) DIRNAME="$INST_DIRNAME";; esac +case "$INST_MKDIR" in '') MKDIR=mkdir;; *) MKDIR="$INST_MKDIR";; esac + +# Allow the user to over-ride xx +case "$inst_dest" in ?*) BIN_DIRECTORY="$inst_dest";; esac +case "$inst_conf" in ?*) CONFIGURE_FILE="$inst_conf";; esac +case "$inst_info" in ?*) INFO_DIRECTORY="$inst_info";; esac +case "$inst_aliases" in ?*) SYSTEM_ALIASES_FILE="$inst_aliases";; esac + +# Insert ${DESTDIR} at the start of all paths so that the whole thing can be +# installed under a different file root. For backwards compatibility, use +# ${ROOT} if ${DESTDIR} is not set. However, we need to save the value of +# the real system aliases file, and use that in the default configuration. + +ACTUAL_SYSTEM_ALIASES_FILE=${SYSTEM_ALIASES_FILE} +DESTDIR=${DESTDIR:-${ROOT}} + +BIN_DIRECTORY=${DESTDIR}${BIN_DIRECTORY} +CONFIGURE_FILE=${DESTDIR}${CONFIGURE_FILE} +SYSTEM_ALIASES_FILE=${DESTDIR}${SYSTEM_ALIASES_FILE} + +if [ "${INFO_DIRECTORY}" != "" ] ; then + INFO_DIRECTORY=${DESTDIR}${INFO_DIRECTORY} +fi + +# Overrides of other things +case "$inst_uid" in ?*) INST_UID="$inst_uid";; esac +case "$inst_cp" in ?*) CP="$inst_cp";; esac +case "$inst_mv" in ?*) MV="$inst_mv";; esac +case "$inst_ln" in ?*) LN="$inst_ln";; esac +case "$inst_chown" in ?*) CHOWN="$inst_chown";; esac +case "$inst_chmod" in ?*) CHMOD="$inst_chmod";; esac +case "$inst_dirname" in ?*) DIRNAME="$inst_dirname";; esac +case "$inst_mkdir" in ?*) MKDIR="$inst_mkdir";; esac + +# chown is a special case; in at least one OS it is in /usr/etc instead +# of in /usr/bin, and therefore not likely to be on the path. Another OS +# has it in /usr/sbin. This fudge tries to cope with these variations. + +# Otherwise, and for other commands, we assume that the normal PATH will +# give access to where they are on your operating system (normally /usr/bin +# or /bin). + +if [ "${CHOWN}" = "chown" -a -x /usr/sbin/chown ] ; then + CHOWN=/usr/sbin/chown +fi + +if [ "${CHOWN}" = "chown" -a ! -f /usr/bin/chown -a -f /usr/etc/chown ] ; then + CHOWN=/usr/etc/chown +fi + +# The values of CHOWN and MV taken from the Makefile are sometimes set to +# "look_for_it", which causes a search of the usual suspects. This code is +# similar to that in exicyclog, but has to be fudged for upper/lower case +# distinctions. + +for cmd in CHOWN MV ; do + eval "oldcmd=\$$cmd" + if [ "$oldcmd" != "look_for_it" ] ; then continue ; fi + if [ "$cmd" = "CHOWN" ] ; then cmdlc="chown" ; fi + if [ "$cmd" = "MV" ] ; then cmdlc="mv" ; fi + newcmd=$cmdlc + for dir in /bin /usr/bin /usr/sbin /usr/etc ; do + if [ -f $dir/$cmdlc ] ; then + newcmd=$dir/$cmdlc + break + fi + done + eval $cmd=$newcmd +done + +# See if the exim monitor has been built + +if [ -f eximon -a -f eximon.bin ]; then + exim_monitor="eximon eximon.bin" +fi + +# If bin directory doesn't exist, try to create it + +if [ ! -d "${BIN_DIRECTORY}" ]; then + echo mkdir -p ${BIN_DIRECTORY} + ${real} mkdir -p ${BIN_DIRECTORY} + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + else + ${real} echo $com ${BIN_DIRECTORY} created + fi +fi + +# If no arguments, install everything + +if [ $# -gt 0 ]; then + set $@ +else + set exim${EXE} ${exim_monitor} exim_dumpdb${EXE} exim_fixdb${EXE} \ + exim_tidydb${EXE} exinext exiwhat exim_dbmbuild${EXE} exicyclog \ + exigrep eximstats exipick exiqgrep exiqsumm exim_lock${EXE} \ + exim_checkaccess +fi + +echo $com "" +echo $com Installation directory is ${BIN_DIRECTORY} +echo $com "" + +while [ $# -gt 0 ]; do + name=$1 + shift + + if [ ! -s ${name} ]; then + echo $com "" + echo $com "*** `pwd`/${name} does not exist or is empty" + echo $com "*** Have you built Exim successfully?" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + + # The exim binary is handled specially + + if [ $name = exim${EXE} ]; then + exim="./exim -bV -C /dev/null" + version=exim-`$exim 2>/dev/null | \ + awk '/Exim version/ { OFS=""; print $3,"-",substr($4,2,length($4)-1) }'`${EXE} + + if [ "${version}" = "exim-${EXE}" ]; then + echo $com "" + echo $com "*** Could not run $exim to find version number ***" + echo $com "*** Exim installation ${ver}failed ***" + $exim + exit 1 + fi + + # Do something only if newer than existing file, or no existing file + + if ../scripts/newer ${name} ${BIN_DIRECTORY}/${version}; then + echo ${CP} ${name} ${BIN_DIRECTORY}/${version} + ${real} ${CP} ${name} ${BIN_DIRECTORY}/${version} + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + + # After copy, set ownership and permissions, unless disabled + + if [ "$do_chown" != "no" ]; then + echo ${CHOWN} ${INST_UID} ${BIN_DIRECTORY}/${version} + ${real} ${CHOWN} ${INST_UID} ${BIN_DIRECTORY}/${version} + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** You must be ${INST_UID} to install exim ***" + exit 1 + fi + echo ${CHMOD} a+x ${BIN_DIRECTORY}/${version} + ${real} ${CHMOD} a+x ${BIN_DIRECTORY}/${version} + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + echo ${CHMOD} u+s ${BIN_DIRECTORY}/${version} + ${real} ${CHMOD} u+s ${BIN_DIRECTORY}/${version} + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + else + echo $com "$CHOWN $INST_UID omitted: -no_chown was specified" + echo $com "$CHMOD u+s omitted: -no_chown was specified" + fi + + # Now sort out the "exim" alias, unless NO_SYMLINK is set. + + if [ "X$NO_SYMLINK" = "X" ] && [ "$do_symlink" != "no" ] ; then + + # First check whether "exim" exists in the directory. + if [ -f ${BIN_DIRECTORY}/exim ]; then + + # If it's not a symbolic link, make a copy with the old version number + if [ `ls -l ${BIN_DIRECTORY}/exim | cut -c1-1` != 'l' ]; then + oldversion=exim-`${BIN_DIRECTORY}/exim -bV -C /dev/null | \ + awk '/Exim version/ { OFS=""; print $3,"-",substr($4,2,length($4)-1) }'`${EXE} + if [ "${version}" = "${oldversion}" ] ; then + echo $com "" + echo $com "*** Existing file called exim has the same version and compile number ***" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + echo ${CP} ${BIN_DIRECTORY}/exim ${BIN_DIRECTORY}/${oldversion} + ${real} ${CP} ${BIN_DIRECTORY}/exim ${BIN_DIRECTORY}/${oldversion} + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + fi + + # Now we can move the name "exim" to be a symbolic link to the new + # version, atomically. + + echo \(cd ${BIN_DIRECTORY}\; ${LN} -s ${version} temporary_exim\) + (${real} cd ${BIN_DIRECTORY}; ${real} ${LN} -s ${version} temporary_exim) + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + + echo ${MV} -f ${BIN_DIRECTORY}/temporary_exim ${BIN_DIRECTORY}/exim + ${real} ${MV} -f ${BIN_DIRECTORY}/temporary_exim ${BIN_DIRECTORY}/exim + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + + # If "exim" does not already exist just create a symbolic link. + + else + echo \(cd ${BIN_DIRECTORY}\; ${LN} -s ${version} exim\) + (${real} cd ${BIN_DIRECTORY}; ${real} ${LN} -s ${version} exim) + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + fi + + else + echo $com "creation of symlink omitted" + if [ "X$NO_SYMLINK" != "X" ] ; then + echo $com "(NO_SYMLINK is specified in Local/Makefile)" + else + echo $com "(-no_symlink was specified)" + fi + fi + + # New binary is not newer than the installed file + + else + echo $com ${name} is not newer than ${BIN_DIRECTORY}/${version} + fi + + # Handle everything other than the exim binary itself + + else + if ../scripts/newer ${name} ${BIN_DIRECTORY}/${name}; then + if [ -f ${BIN_DIRECTORY}/${name} ]; then + echo ${CP} ${BIN_DIRECTORY}/${name} ${BIN_DIRECTORY}/${name}.O + ${real} ${CP} ${BIN_DIRECTORY}/${name} ${BIN_DIRECTORY}/${name}.O + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + fi + echo ${CP} ${name} ${BIN_DIRECTORY} + ${real} ${CP} ${name} ${BIN_DIRECTORY} + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + else + echo $com ${name} is not newer than ${BIN_DIRECTORY}/${name} + fi + fi + +done + + + +# If there is no configuration file, install the default, modifying it to refer +# to the configured system aliases file. If there is no setting for +# SYSTEM_ALIASES_FILE, use the traditional /etc/aliases. If the file does not +# exist, install a default (dummy) for that too. + +# However, if CONFIGURE_FILE specifies a list of files, skip this code. + +echo $com "" + +if [ `expr -- "${CONFIGURE_FILE}" : ".*:"` -ne 0 ] ; then + echo $com Runtime configuration is specified as the following list: + echo $com ' ' ${CONFIGURE_FILE} + echo $com Therefore, skipping automatic installation. + +elif [ ! -f ${CONFIGURE_FILE} ]; then + echo $com Installing default configuration in ${CONFIGURE_FILE} + echo $com because there is no existing configuration file. + if [ "${SYSTEM_ALIASES_FILE}" = "" ] ; then + SYSTEM_ALIASES_FILE=/etc/aliases + echo $com This configuration has system aliases in ${SYSTEM_ALIASES_FILE}. + fi + + echo ${MKDIR} -p `${DIRNAME} ${CONFIGURE_FILE}` + ${real} ${MKDIR} -p `${DIRNAME} ${CONFIGURE_FILE}` + + echo sed -e '\\' + echo " \"/SYSTEM_ALIASES_FILE/ s'SYSTEM_ALIASES_FILE'${ACTUAL_SYSTEM_ALIASES_FILE}'\"" '\\' + echo " ../src/configure.default > \${CONFIGURE_FILE}" + + # I can't find a way of writing this using the ${real} feature because + # it seems that the output redirection always happens, even when -n was + # specified. So control it the hard way. + + if [ "$real" = "" ] ; then + sed -e \ + "/SYSTEM_ALIASES_FILE/ s'SYSTEM_ALIASES_FILE'${ACTUAL_SYSTEM_ALIASES_FILE}'" \ + ../src/configure.default > ${CONFIGURE_FILE} + else + true + fi + + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + fi + if [ ! -f ${SYSTEM_ALIASES_FILE} ]; then + echo $com '****' + echo $com Installing a dummy ${SYSTEM_ALIASES_FILE} file because you do not have + echo $com one, and the default configuration requires it. You should + echo $com edit ${SYSTEM_ALIASES_FILE} and at least create an alias for postmaster. + echo $com '***' + echo ${CP} ../src/aliases.default ${SYSTEM_ALIASES_FILE} + ${real} ${CP} ../src/aliases.default ${SYSTEM_ALIASES_FILE} + fi + +else + echo $com Configuration file ${CONFIGURE_FILE} already exists +fi + +# Install info files if the directory is defined and the Texinfo +# source documentation is present. + +if [ "${INFO_DIRECTORY}" != "" -a -f ../doc/spec.texinfo ] ; then + echo $com "" + if [ ! -d "${INFO_DIRECTORY}" ] ; then + echo mkdir -p ${INFO_DIRECTORY} + ${real} mkdir -p ${INFO_DIRECTORY} + if [ $? -ne 0 ]; then + echo $com "" + echo $com "*** Exim installation ${ver}failed ***" + exit 1 + else + echo $com ${INFO_DIRECTORY} created + fi + fi + + echo $com Info installation directory is ${INFO_DIRECTORY} + echo $com "" + + ${real} makeinfo --no-split --output exim.info ../doc/spec.texinfo + echo ${CP} exim.info ${INFO_DIRECTORY} + ${real} ${CP} exim.info ${INFO_DIRECTORY} + ${real} install-info --section="Exim" \ + --entry "* User guide: (exim). Exim manual" \ + ${INFO_DIRECTORY}/exim.info ${INFO_DIRECTORY}/dir + ${real} makeinfo --no-split --output exim_filter.info ../doc/filter.texinfo + echo ${CP} exim_filter.info ${INFO_DIRECTORY} + ${real} ${CP} exim_filter.info ${INFO_DIRECTORY} + ${real} install-info --section="Exim" \ + --entry "* Filtering: (exim_filter). Filtering mail with Exim" \ + ${INFO_DIRECTORY}/exim_filter.info ${INFO_DIRECTORY}/dir +fi + +# Everything OK + +echo $com "" +echo $com Exim installation ${ver}complete + +# End of exim_install diff --git a/scripts/lookups-Makefile b/scripts/lookups-Makefile new file mode 100755 index 0000000..ed8b0cb --- /dev/null +++ b/scripts/lookups-Makefile @@ -0,0 +1,194 @@ +#! /bin/sh + +# Copyright (c) The Exim Maintainers 1995 - 2021 + +# We turn the configure-built build-$foo/lookups/Makefile.predynamic into Makefile + +# We always re-exec ourselves at least once, because it's the cleanest and +# most portable way to turn on various features we expect of POSIX sh. +if [ -z "$EXIM_LOOKUP_MAKEFILE_ADJUSTED" ] +then + SHELL=/bin/sh + EXIM_LOOKUP_MAKEFILE_ADJUSTED=yes + export EXIM_LOOKUP_MAKEFILE_ADJUSTED + + # Solaris sh and tr are problematic until we get xpg4 variants + if [ -x /usr/xpg4/bin/sh ] + then + PATH="/usr/xpg4/bin:$PATH" + export PATH + SHELL=/usr/xpg4/bin/sh + export SHELL + fi + + # IRIX uses /bin/ksh for sh but in a compatibility mode unless $_XPG == 1, + # where said compatibility mode disables $(...) + _XPG=1 + export _XPG + + # We need the _right_ tr, so must do that first; but if a shell which + # we're more confident is sane is available, let's try that. Mostly, + # the problem is that "local" is not actually in "the" standard, it's + # just in every not-insane shell. Though arguably, there are no shells + # with POSIX-ish syntax which qualify as "not insane". + for b in /bin/dash /bin/bash /usr/local/bin/bash + do + if [ -x "$b" ] + then + SHELL="$b" + break + fi + done + # if we get a report of a system with zsh but not bash, we can add that + # to the list, but be sure to enable sh_word_split in that case. + + exec "$SHELL" "$0" "$@" +fi + +input=lookups/Makefile.predynamic +target=lookups/Makefile.postdynamic +defs_source=Makefile-t +tag_marker='MAGIC-TAG-MODS-OBJ-RULES-GO-HERE' + +tab=' ' + +# We rely on tr(1) for translating case below. Some people export +# values of LC_CTYPE and LC_COLLATE which apparently break our assumptions. +# We're a script expecting certain output based on known inputs and not dealing +# with UTF8, so we should be safe doingthis: +LC_ALL=C +export LC_ALL + +if [ -f "$defs_source" ] +then + : + # we are happy +else + echo >&2 "$0: ERROR: MISSING FILE '${defs_source}'" + echo >&2 "$0: SHOULD HAVE BEEN CALLED FROM scripts/Configure-Makefile" + exit 1 +fi + +# nb: do not permit leading whitespace for this, as CFLAGS_DYNAMIC is exported +# to the lookups subdir via a line with leading whitespace which otherwise +# matches +if grep -q "^CFLAGS_DYNAMIC[ $tab?:]*=" "$defs_source" +then + # we have a definition, we're good to go + echo >&2 ">>> Creating lookups/Makefile for building dynamic modules" + enable_dynamic=yes +else + echo >&2 ">>> Creating lookups/Makefile without dynamic module support" + enable_dynamic='' + # We always do something now, since there should always be a lookup, + # and now we need to run in order to put the OBJ=$(OBJ)+ rules in. So we + # continue on. +fi + +# For the want_ checks, we need to let the user override values from the make +# command-line, not just check the Makefile. + +want_dynamic() { + local dyn_name="$1" + local re="LOOKUP_${dyn_name}[ $tab]*=[ $tab]*2" + env | grep -q "^$re" + if [ $? -eq 0 ]; then return 0; fi + grep -q "^[ $tab]*$re" "$defs_source" +} + +want_at_all() { + local want_name="$1" + local re="LOOKUP_${want_name}[ $tab]*=[ $tab]*." + env | grep -q "^$re" + if [ $? -eq 0 ]; then return 0; fi + grep -q "^[ $tab]*$re" "$defs_source" +} + +# Adapted want_at_all above to work for EXPERIMENTAL features +want_experimental() { + local want_name="$1" + local re="EXPERIMENTAL_${want_name}[ $tab]*=[ $tab]*." + env | grep -q "^$re" + if [ $? -eq 0 ]; then return 0; fi + grep -q "^[ $tab]*$re" "$defs_source" +} + +# The values of these variables will be emitted into the Makefile. + +MODS="" +OBJ="" + +emit_module_rule() { + local lookup_name="$1" + local mod_name pkgconf + if [ "${lookup_name%:*}" = "$lookup_name" ] + then + # Square brackets are redundant but benign for POSIX compliant tr, + # however Solaris /usr/bin/tr requires them. Sometimes Solaris + # gets installed without a complete set of xpg4 tools, sigh. + mod_name=$(echo $lookup_name | tr [A-Z] [a-z]) + else + mod_name="${lookup_name#*:}" + lookup_name="${lookup_name%:*}" + fi + + if want_dynamic "$lookup_name" + then + if [ -z "$enable_dynamic" ]; then + echo >&2 "Missing CFLAGS_DYNAMIC prevents building dynamic $lookup_name" + exit 1 + fi + MODS="${MODS} ${mod_name}.so" + pkgconf=$(grep "^LOOKUP_${lookup_name}_PC" "$defs_source") + if [ $? -eq 0 ]; then + pkgconf=$(echo $pkgconf | sed 's/^.*= *//') + echo "LOOKUP_${mod_name}_INCLUDE = $(pkg-config --cflags $pkgconf)" + echo "LOOKUP_${mod_name}_LIBS = $(pkg-config --libs $pkgconf)" + else + grep "^LOOKUP_${lookup_name}_" "$defs_source" + echo "LOOKUP_${mod_name}_INCLUDE = \$(LOOKUP_${lookup_name}_INCLUDE)" + echo "LOOKUP_${mod_name}_LIBS = \$(LOOKUP_${lookup_name}_LIBS)" + fi + elif want_at_all "$lookup_name" + then + OBJ="${OBJ} ${mod_name}.o" + fi +} + +rm -f "$target" +exec 5>&1 +exec > "$target" + +sed -n "1,/$tag_marker/p" < "$input" + +for name_mod in \ + CDB DBM:dbmdb DNSDB DSEARCH IBASE JSON LMDB LSEARCH MYSQL NIS NISPLUS ORACLE \ + PASSWD PGSQL REDIS SQLITE TESTDB WHOSON +do + emit_module_rule $name_mod +done + +if want_at_all LDAP +then + OBJ="${OBJ} ldap.o" +fi + +# Because the variable is EXPERIMENTAL_SPF and not LOOKUP_SPF we +# always include spf.o and compile a dummy if EXPERIMENTAL_SPF is not +# defined. + +OBJ="${OBJ} spf.o" + +# readsock is always wanted as it implements the ${readsock } expansion +OBJ="${OBJ} readsock.o" + +echo "MODS = $MODS" +echo "OBJ = $OBJ" + +sed -n "/$tag_marker/,\$p" < "$input" + +exec >&5 + +# Configure-Makefile will move $target into place + +# vim: set ft=sh sw=2 : diff --git a/scripts/newer b/scripts/newer new file mode 100755 index 0000000..24c09e8 --- /dev/null +++ b/scripts/newer @@ -0,0 +1,21 @@ +#! /bin/sh + +# Script to determine whether the first file is newer than the second. +# If the first does not exist, the answer is "no"; +# if the second does not exist, the answer is "yes"; +# otherwise their ages are compared using "find". + +if [ $# -ne 2 ]; then + echo "*** Two file names needed for 'newer' ***" + exit 2; +fi + +if [ ! -f $1 ]; then exit 1; fi +if [ ! -f $2 ]; then exit 0; fi + +case `find $1 -newer $2 -print` in +'') exit 1;; +*) exit 0;; +esac + +# End diff --git a/scripts/os-type b/scripts/os-type new file mode 100755 index 0000000..a188c4a --- /dev/null +++ b/scripts/os-type @@ -0,0 +1,164 @@ +#! /bin/sh + +# Shell script to determine the operating system type. Some of the heuristics +# herein have accumulated over the years and may not strictly be needed now, +# but they are left in under the principle of "If it ain't broke, don't fix +# it." + +# For some OS there are two variants: a full name, which is used for the +# build directory, and a generic name, which is used to identify the OS- +# specific scripts, and which can be the same for different versions of +# the OS. Solaris 2 is one such OS. The option -generic specifies the +# latter type of output. + +# If EXIM_OSTYPE is set, use it. This allows a manual override. + +case "$EXIM_OSTYPE" in ?*) os="$EXIM_OSTYPE";; esac + +# Otherwise, try to get a value from the uname command. Use an explicit +# option just in case there are any systems where -s is not the default. + +case "$os" in '') os=`uname -s`;; esac + +# Identify Glibc systems under different names. + +case "$os" in GNU) os=GNU;; esac +case "$os" in GNU/*|Linux) os=Linux;; esac + +# It is believed that all systems respond to uname -s, but just in case +# there is one that doesn't, use the shell's $OSTYPE variable. It is known +# to be unhelpful for some systems (under IRIX is it "irix" and under BSDI +# 3.0 it may be "386BSD") but those systems respond to uname -s, so this +# doesn't matter. + +case "$os" in '') os="$OSTYPE";; esac + +# Failed to find OS type. + +case "$os" in +'') echo "" 1>&2 + echo "*** Failed to determine the operating system type." 1>&2 + echo "" 1>&2 + echo UnKnown + exit 1;; +esac + +# Clean out gash characters + +os=`echo $os | sed 's,[^-+_.a-zA-Z0-9],,g'` + +# A value has been obtained for the os. Some massaging may be needed in +# some cases to get a uniform set of values. In earlier versions of this +# script, $OSTYPE was looked at before uname -s, and various shells set it +# to things that are subtly different. It is possible that some of this may +# no longer be needed. + +case "$os" in +aix*) os=AIX;; +AIX*) os=AIX;; +bsdi*) os=BSDI;; +BSDOS) os=BSDI;; +BSD_OS) os=BSDI;; +CYGWIN*) os=CYGWIN;; +dgux) os=DGUX;; +freebsd*) os=FreeBSD;; +gnu) os=GNU;; +Irix5) os=IRIX;; +Irix6) os=IRIX6;; +IRIX64) os=IRIX6;; +irix6.5) os=IRIX65;; +IRIX) version=`uname -r` + case "$version" in + 5*) os=IRIX;; + 6.5) version=`uname -R | awk '{print $NF}'` + version=`echo $version | sed 's,[^-+_a-zA-Z0-9],,g'` + os=IRIX$version;; + 6*) os=IRIX632;; + esac;; +HI-OSF1-MJ) os=HI-OSF;; +HI-UXMPP) os=HI-OSF;; +hpux*) os=HP-UX;; +linux) os=Linux;; +linux-*) os=Linux;; +Linux-*) os=Linux;; +netbsd*) os=NetBSD;; +NetBSD*) os=NetBSD;; +openbsd*) os=OpenBSD;; +osf1) os=OSF1;; +qnx*) os=QNX;; +solaris*) os=SunOS5;; +sunos4*) os=SunOS4;; +UnixWare) os=Unixware7;; +Ultrix) os=ULTRIX;; +ultrix*) os=ULTRIX;; +esac + +# In the case of SunOS we need to distinguish between SunOS4 and Solaris (aka +# SunOS5); in the case of BSDI we need to distinguish between versions 3 and 4; +# in the case of HP-UX we need to distinguish between version 9 and later. + +case "$os" in +SunOS) case `uname -r` in + 5*) os="${os}5";; + 4*) os="${os}4";; + esac;; + +BSDI) case `uname -r` in + 3*) os="${os}3";; + 4.2*) os="${os}4.2";; + 4*) os="${os}4";; + esac;; + +HP-UX) case `uname -r` in + A.09*) os="${os}-9";; + esac;; +esac + +# Need to distinguish Solaris from the version on the HAL (64bit sparc, +# CC=hcc -DV7). Also need to distinguish different versions of the OS +# for building different binaries. + +case "$os" in +SunOS5) case `uname -m` in + sun4H) os="${os}-hal";; + *) os="${os}-`uname -r`";; + esac + ;; + +# In the case of Linux we used to distinguish which libc was used so that +# the old libc5 was supported as well as the current glibc. This support +# was giving some people problems, so it was removed in June 2005, under +# the assumption that nobody would be using libc5 any more (it is over seven +# years old). + +# In the case of NetBSD we need to distinguish between a.out, ELF +# and COFF binary formats. However, a.out and COFF are the same +# for our purposes, so both of them are defined as "a.out". +# Todd Vierling of Wasabi Systems reported that NetBSD/sh3 (the +# only NetBSD port that uses COFF binary format) will switch to +# ELF soon. + +NetBSD) if echo __ELF__ | ${CC-cc} -E - | grep -q __ELF__ ; then + # Non-ELF system + os="NetBSD-a.out" + fi + ;; + +esac + +# If a generic OS name is requested, some further massaging is needed +# for some systems. + +if [ "$1" = '-generic' ]; then + case "$os" in + SunOS5*) os=SunOS5;; + BSDI*) os=BSDI;; + IRIX65*) os=IRIX65;; + esac +fi + +# OK, the script seems to have worked. Pass the value back. + +echo "$os" + +# End of os-type diff --git a/scripts/reversion b/scripts/reversion new file mode 100755 index 0000000..b932224 --- /dev/null +++ b/scripts/reversion @@ -0,0 +1,134 @@ +#!/bin/sh +# Copyright (c) The Exim Maintainers 1995 - 2021 + +set -e +LC_ALL=C +export LC_ALL + +# Update Exim's version header file. + +# Compatibility gross-ness for non-POSIX systems +if [ -z "$EXIM_REVERSION_ADJUSTED" ] +then + SHELL=/bin/sh + EXIM_REVERSION_ADJUSTED=yes + export SHELL EXIM_REVERSION_ADJUSTED + # Solaris: + if [ -x /usr/xpg4/bin/sh ] + then + PATH="/usr/xpg4/bin:$PATH" + SHELL=/usr/xpg4/bin/sh + export PATH SHELL + fi + # Irix: + _XPG=1 ; export _XPG + # + exec "$SHELL" "$0" "$@" +fi + +# Read version information that was generated by a previous run of +# this script, or during the release process. + +# Override, used for automated testing w/o access to the +# .git directory (w.g. inside a git worktree) +if [ -n "$EXIM_RELEASE_VERSION" ]; then + : +elif [ -f ./version.sh ]; then + . ./version.sh +elif [ -f ../src/version.sh ]; then + . ../src/version.sh +elif [ -d ../../.git ] || [ -f ../../.git ] || [ "$1" = release ]; then + # Modify the output of git describe into separate parts for + # the name "exim" and the release and variant versions. + # Put a dot in the version number and remove a spurious g. + if [ "$2" ] + then + description=$(git describe "$2") + else + description=$(git describe --dirty=-XX --match 'exim-4*') + fi + set $(echo "$description" | sed 's/-/ /; s/-g/-/') + # Only update if we need to + if [ "$2 $3" != "$EXIM_RELEASE_VERSION $EXIM_VARIANT_VERSION" ] + then + EXIM_RELEASE_VERSION="$2" + EXIM_VARIANT_VERSION="$3" + rm -f version.h + fi +fi + +if [ -z "$EXIM_RELEASE_VERSION" ]; then + echo "Cannot determine the release number" >&2 + echo "You may want to override it with EXIM_RELEASE_VERSION" >&2 + exit 1 +fi + +# If you are maintaining a patched version of Exim, you can either +# create your own version.sh as part of your release process, or you +# can modify EXIM_VARIANT_VERSION at this point in this script. + +if test -z "$EXIM_RELEASE_VERSION"; then + echo "$0: Your copy of Exim lacks any version information." >&2 + exit 1 +fi + +EXIM_COMPILE_NUMBER=$(expr "${EXIM_COMPILE_NUMBER:-0}" + 1) + +echo "$EXIM_COMPILE_NUMBER" >cnumber.h + +# Reproducible builds, accept a build timestamp override from environ per +# <https://reproducible-builds.org/specs/source-date-epoch/>. +# We require a fairly modern date(1) command here, which is not portable +# to some of the systems Exim is built on. That's okay, because the scenarios +# are: +# 1) Local postmaster building, not using $SOURCE_DATE_EPOCH, doesn't matter +# 2) Packaging folks who don't care about reproducible builds +# 3) Packaging folks who care but are using systems where date Just Works +# 3) Packaging folks who care and can put a modern date(1) in $PATH +# 4) Packaging folks who care and can supply us with a clean patch to support +# their requirements +# 5) Packaging folks who care but won't do any work to support their strange +# old systems and want us to do the work for them. We don't care either, +# they're SOL and have to live without reproducible builds. +# +exim_build_date_override='' +if [ ".${SOURCE_DATE_EPOCH:-}" != "." ]; then + fmt='+%d-%b-%Y %H:%M:%S' + # Non-reproducible, we use __DATE__ and __TIME__ in C, which respect timezone + # (think localtime, not gmtime); for reproduction between systems, UTC makes + # more sense and the examples available use UTC without explicitly mandating + # it. I think that we can switch behavior and use UTC for reproducible + # builds without it causing any problems: nothing really cares about timezone. + # GNU date: "date -d @TS" + # BSD date: "date -r TS" + exim_build_date_override="$(date -u -d "@${SOURCE_DATE_EPOCH}" "$fmt" 2>/dev/null || date -u -r "${SOURCE_DATE_EPOCH}" "$fmt" 2>/dev/null)" +fi + +( echo '# automatically generated file - see ../scripts/reversion' + echo EXIM_RELEASE_VERSION='"'"$EXIM_RELEASE_VERSION"'"' + test -n "$EXIM_VARIANT_VERSION" && \ + echo EXIM_VARIANT_VERSION='"'"$EXIM_VARIANT_VERSION"'"' + echo EXIM_COMPILE_NUMBER='"'"$EXIM_COMPILE_NUMBER"'"' + if [ ".${exim_build_date_override:-}" != "." ]; then + echo EXIM_BUILD_DATE_OVERRIDE='"'"${exim_build_date_override}"'"' + fi +) >version.sh + +if [ ! -f version.h ] +then +( echo '/* automatically generated file - see ../scripts/reversion */' + echo '#define EXIM_RELEASE_VERSION "'"$EXIM_RELEASE_VERSION"'"' + test -n "$EXIM_VARIANT_VERSION" && \ + echo '#define EXIM_VARIANT_VERSION "'"$EXIM_VARIANT_VERSION"'"' + echo '#ifdef EXIM_VARIANT_VERSION' + echo '#define EXIM_VERSION_STR EXIM_RELEASE_VERSION "-" EXIM_VARIANT_VERSION' + echo '#else' + echo '#define EXIM_VERSION_STR EXIM_RELEASE_VERSION' + echo '#endif' + if [ ".${exim_build_date_override:-}" != "." ]; then + echo '#define EXIM_BUILD_DATE_OVERRIDE "'"${exim_build_date_override}"'"' + fi +) >version.h +fi + +#test -t 1 && echo ">>> version $EXIM_RELEASE_VERSION $EXIM_VARIANT_VERSION #$EXIM_COMPILE_NUMBER" diff --git a/scripts/source_checks b/scripts/source_checks new file mode 100644 index 0000000..918a6f8 --- /dev/null +++ b/scripts/source_checks @@ -0,0 +1,52 @@ +#!/bin/sh + +cd src; + +# Tables with struct items +while read file table +do + : $file $table + < $file \ + perl -e '$/= undef; while (<>) { print $1 if /(?<='$table'\[\])\s*=\s*{\n(([^}].*\n)+)/m }' \ + | awk '/{ (US)?"/ {print $2}' \ + | awk -F\" '{print $2}' \ + | LC_ALL=C sort -c \ + || exit 1 +done <<-END + readconf.c optionlist_config + globals.c optionlist_auths + globals.c debug_options + globals.c header_names + globals.c log_options + expand.c item_table + std-crypto.c dh_constants + transport.c optionlist_transports + route.c optionlist_routers + transports/appendfile.c appendfile_transport_options + transports/autoreply.c autoreply_transport_options + transports/lmtp.c lmtp_transport_options + transports/pipe.c pipe_transport_options + transports/smtp.c smtp_transport_options + expand.c var_table + acl.c conditions + acl.c controls_list +END + +# Tables with just string items +while read file table +do + : $file $table + < $file \ + perl -e '$/= undef; while (<>) { print $1 if /(?<='$table'\[\])\s*=\s*{\s?(([^}]*)+)}/m }' \ + | awk -F\" '/"/ {print $2}' \ + | LC_ALL=C sort -c \ + || exit 1 + +done <<-END + expand.c item_table + expand.c op_table_underscore + expand.c op_table_main + expand.c cond_table + acl.c verbs +END + |