Commit | Line | Data |
---|---|---|
5901f0ab TF |
1 | #!/bin/sh |
2 | ||
3 | # Update Exim's version header file. | |
4 | ||
5 | # Read version information that was generated by a previous run of | |
6 | # this script, or during the release process. | |
7 | ||
c6554334 PP |
8 | if [ -f ./version.sh ] |
9 | then . ./version.sh | |
5901f0ab TF |
10 | elif [ -f ../src/version.sh ] |
11 | then . ../src/version.sh | |
12 | fi | |
13 | ||
14 | # If this tree is a git working directory, use that to get version information. | |
15 | ||
16 | if [ -e ../../.git ] || [ "$1" = "release" ] | |
17 | then | |
18 | # Modify the output of git describe into separate parts for | |
19 | # the name "exim" and the release and variant versions. | |
20 | # Put a dot in the version number and remove a spurious g. | |
21 | set $(git describe --dirty=-XX --match 'exim-4*' | | |
22 | sed 's|-| |;s|_|.|;s|[-_]| _|;s|-g|-|') | |
23 | # Only update if we need to | |
24 | if [ "$2 $3" != "$EXIM_RELEASE_VERSION $EXIM_VARIANT_VERSION" ] | |
25 | then | |
26 | EXIM_RELEASE_VERSION="$2" | |
27 | EXIM_VARIANT_VERSION="$3" | |
28 | rm -f version.h | |
29 | fi | |
30 | fi | |
31 | ||
32 | # If you are maintaining a patched version of Exim, you can either | |
33 | # create your own version.sh as part of your release process, or you | |
34 | # can modify EXIM_VARIANT_VERSION at this point in this script. | |
35 | ||
36 | case $EXIM_RELEASE_VERSION in | |
37 | '') echo "*** Your copy of Exim lacks any version information." | |
38 | exit 1 | |
39 | esac | |
40 | ||
41 | EXIM_COMPILE_NUMBER=$(expr "${EXIM_COMPILE_NUMBER:-0}" + 1) | |
42 | ||
43 | echo "$EXIM_COMPILE_NUMBER" >cnumber.h | |
44 | ||
45 | ( echo '# automatically generated file - see ../scripts/reversion' | |
46 | echo EXIM_RELEASE_VERSION='"'"$EXIM_RELEASE_VERSION"'"' | |
47 | echo EXIM_VARIANT_VERSION='"'"$EXIM_VARIANT_VERSION"'"' | |
48 | echo EXIM_COMPILE_NUMBER='"'"$EXIM_COMPILE_NUMBER"'"' | |
49 | ) >version.sh | |
50 | ||
51 | if [ ! -f version.h ] | |
52 | then | |
53 | ( echo '/* automatically generated file - see ../scripts/reversion */' | |
54 | echo '#define EXIM_RELEASE_VERSION "'"$EXIM_RELEASE_VERSION"'"' | |
55 | echo '#define EXIM_VARIANT_VERSION "'"$EXIM_VARIANT_VERSION"'"' | |
56 | echo '#define EXIM_VERSION_STR EXIM_RELEASE_VERSION EXIM_VARIANT_VERSION' | |
57 | ) >version.h | |
58 | fi | |
59 | ||
60 | echo ">>> version $EXIM_RELEASE_VERSION$EXIM_VARIANT_VERSION #$EXIM_COMPILE_NUMBER" | |
61 | echo |