Commit | Line | Data |
---|---|---|
059ec3d9 PH |
1 | /************************************************* |
2 | * Exim - an Internet mail transport agent * | |
3 | *************************************************/ | |
4 | ||
0a49a7a4 | 5 | /* Copyright (c) University of Cambridge 1995 - 2009 */ |
059ec3d9 PH |
6 | /* See the file NOTICE for conditions of use and distribution. */ |
7 | ||
8 | /* Function for setting up the version string. */ | |
9 | ||
10 | #include "exim.h" | |
11 | ||
6545de78 | 12 | #include "version.h" |
059ec3d9 PH |
13 | |
14 | ||
15 | /* The header file cnumber.h contains a single line containing the | |
16 | compilation number, making it easy to have it updated automatically. | |
17 | Hence the fudgery below to get the number turned into a string, since | |
18 | we can't use #include inside a macro argument list */ | |
19 | ||
20 | void | |
21 | version_init(void) | |
22 | { | |
23 | static uschar cnumber_buffer[24]; | |
24 | static uschar date_buffer[32]; | |
25 | ||
26 | uschar today[20]; | |
27 | uschar *version_cnumber_format; | |
28 | ||
29 | int cnumber = | |
30 | #include "cnumber.h" | |
31 | ; | |
32 | ||
33 | /* The odd magic after each of these is so they can be easily found | |
34 | for automatic patching to standard values when running regression tests. | |
35 | The reason that version_cnumber_format isn't just written inline in the | |
36 | sprintf() call is the gcc -Wall warns about a \0 in a format string. */ | |
37 | ||
38 | version_cnumber = cnumber_buffer; | |
39 | version_cnumber_format = US"%d\0<<eximcnumber>>"; | |
40 | sprintf(CS version_cnumber, CS version_cnumber_format, cnumber); | |
6545de78 | 41 | version_string = US EXIM_VERSION_STR "\0<<eximversion>>"; |
059ec3d9 | 42 | |
6e411084 PP |
43 | #ifdef EXIM_BUILD_DATE_OVERRIDE |
44 | /* Reproducible build support; build tooling should have given us something looking like | |
45 | * "25-Feb-2017 20:15:40" in EXIM_BUILD_DATE_OVERRIDE based on $SOURCE_DATE_EPOCH in environ | |
46 | * per <https://reproducible-builds.org/specs/source-date-epoch/> | |
47 | */ | |
48 | version_date = date_buffer; | |
49 | version_date[0] = 0; | |
50 | Ustrncat(version_date, EXIM_BUILD_DATE_OVERRIDE, sizeof(date_buffer)); | |
51 | ||
52 | #else | |
059ec3d9 PH |
53 | Ustrcpy(today, __DATE__); |
54 | if (today[4] == ' ') today[4] = '0'; | |
55 | today[3] = today[6] = '-'; | |
56 | ||
57 | version_date = date_buffer; | |
58 | version_date[0] = 0; | |
59 | Ustrncat(version_date, today+4, 3); | |
60 | Ustrncat(version_date, today, 4); | |
61 | Ustrncat(version_date, today+7, 4); | |
62 | Ustrcat(version_date, " "); | |
63 | Ustrcat(version_date, __TIME__); | |
6e411084 | 64 | #endif |
059ec3d9 PH |
65 | } |
66 | ||
67 | /* End of version.c */ |