summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/OS/Makefile-Base23
-rwxr-xr-xsrc/scripts/MakeLinks5
-rwxr-xr-xsrc/scripts/reversion61
-rw-r--r--src/src/version.h15
4 files changed, 73 insertions, 31 deletions
diff --git a/src/OS/Makefile-Base b/src/OS/Makefile-Base
index cb2359f28..9723c60cc 100644
--- a/src/OS/Makefile-Base
+++ b/src/OS/Makefile-Base
@@ -32,7 +32,7 @@ FE = $(FULLECHO)
# up-to-date. Then the os-specific source files and the C configuration file
# are set up, and finally it goes to the main Exim target.
-all: $(EDITME) checklocalmake Makefile os.h os.c config.h allexim
+all: $(EDITME) checklocalmake Makefile os.h os.c config.h version.h allexim
checklocalmake:
@if $(SHELL) $(SCRIPTS)/newer $(EDITME)-$(OSTYPE) $(EDITME) || \
@@ -317,13 +317,7 @@ OBJ_EXIM = acl.o child.o crypt16.o daemon.o dbfn.o debug.o deliver.o \
exim: lookups/lookups.a auths/auths.a pdkim/pdkim.a \
routers/routers.a transports/transports.a \
- $(OBJ_EXIM) version.c
- @echo " "
- awk '{ print ($$1+1) }' cnumber.h > cnumber.temp
- rm -f cnumber.h; mv cnumber.temp cnumber.h
- @echo "$(CC) version.c"
- $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) version.c
- rm -f exim
+ $(OBJ_EXIM) version.o
@echo "$(LNCC) -o exim"
$(FE)$(PURIFY) $(LNCC) -o exim $(LFLAGS) $(OBJ_EXIM) version.o \
routers/routers.a transports/transports.a lookups/lookups.a \
@@ -459,6 +453,13 @@ PHDRS = ../config.h ../dbfunctions.h ../dbstuff.h ../exim.h ../functions.h ../gl
.c.o:; @echo "$(CC) $*.c"
$(FE)$(CC) -c $(CFLAGS) -I. $(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $*.c
+# Update Exim's version information and build the version object.
+
+version.h::
+ @../scripts/reversion
+
+version.o: $(HDRS) cnumber.h version.h version.c
+
# This is the dummy module for use by test compiles of individual modules. It
# contains functions such as log_write() that may be called from bits of Exim
# in the tested code.
@@ -637,10 +638,10 @@ $(MONBIN): $(HDRS)
# The lookups library.
-buildlookups lookups/lookups.a: config.h
+buildlookups lookups/lookups.a: config.h version.h
@cd lookups; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
- CFLAGS_DYNAMIC="$(CFLAGS_DYNAMIC)" \
- FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
+ CFLAGS_DYNAMIC="$(CFLAGS_DYNAMIC)" HDRS="../version.h $(PHDRS)" \
+ FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" \
INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $(LOOKUP_INCLUDE)"; \
echo " "
diff --git a/src/scripts/MakeLinks b/src/scripts/MakeLinks
index a4ab31cc8..082659c99 100755
--- a/src/scripts/MakeLinks
+++ b/src/scripts/MakeLinks
@@ -16,10 +16,6 @@ if [ -r pcre/Makefile ] ; then
fi
-# Initialize the file holding the compile number
-
-echo "0" > cnumber.h
-
echo ""
echo ">>> Creating links to source files..."
@@ -183,7 +179,6 @@ ln -s ../src/osfunctions.h osfunctions.h
ln -s ../src/store.h store.h
ln -s ../src/structs.h structs.h
ln -s ../src/lookupapi.h lookupapi.h
-ln -s ../src/version.h version.h
ln -s ../src/acl.c acl.c
ln -s ../src/buildconfig.c buildconfig.c
diff --git a/src/scripts/reversion b/src/scripts/reversion
new file mode 100755
index 000000000..7bc56f620
--- /dev/null
+++ b/src/scripts/reversion
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+# Update Exim's version header file.
+
+# Read version information that was generated by a previous run of
+# this script, or during the release process.
+
+if [ -f version.sh ]
+then . version.sh
+elif [ -f ../src/version.sh ]
+then . ../src/version.sh
+fi
+
+# If this tree is a git working directory, use that to get version information.
+
+if [ -e ../../.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.
+ set $(git describe --dirty=-XX --match 'exim-4*' |
+ sed 's|-| |;s|_|.|;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 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.
+
+case $EXIM_RELEASE_VERSION in
+'') echo "*** Your copy of Exim lacks any version information."
+ exit 1
+esac
+
+EXIM_COMPILE_NUMBER=$(expr "${EXIM_COMPILE_NUMBER:-0}" + 1)
+
+echo "$EXIM_COMPILE_NUMBER" >cnumber.h
+
+( echo '# automatically generated file - see ../scripts/reversion'
+ echo EXIM_RELEASE_VERSION='"'"$EXIM_RELEASE_VERSION"'"'
+ echo EXIM_VARIANT_VERSION='"'"$EXIM_VARIANT_VERSION"'"'
+ echo EXIM_COMPILE_NUMBER='"'"$EXIM_COMPILE_NUMBER"'"'
+) >version.sh
+
+if [ ! -f version.h ]
+then
+( echo '/* automatically generated file - see ../scripts/reversion */'
+ echo '#define EXIM_RELEASE_VERSION "'"$EXIM_RELEASE_VERSION"'"'
+ echo '#define EXIM_VARIANT_VERSION "'"$EXIM_VARIANT_VERSION"'"'
+ echo '#define EXIM_VERSION_STR EXIM_RELEASE_VERSION EXIM_VARIANT_VERSION'
+) >version.h
+fi
+
+echo ">>> version $EXIM_RELEASE_VERSION$EXIM_VARIANT_VERSION #$EXIM_COMPILE_NUMBER"
+echo
diff --git a/src/src/version.h b/src/src/version.h
deleted file mode 100644
index 6c1cc556f..000000000
--- a/src/src/version.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/*************************************************
-* Exim - an Internet mail transport agent *
-*************************************************/
-
-/* Copyright (c) Google, Inc. 2010 */
-/* See the file NOTICE for conditions of use and distribution. */
-
-/* This is bumped by the Exim Maintainers, the release engineer: */
-#define EXIM_RELEASE_VERSION_STR "4.76"
-/* If you apply extensive local patches, consider putting -foo into here */
-#define EXIM_VARIANT_VERSION ""
-
-#define EXIM_VERSION_STR EXIM_RELEASE_VERSION_STR EXIM_VARIANT_VERSION
-
-/* End of version.h */