1
# no shebang line here, we want explicit $(SHELL) from make!
5
# create version.c to define BOGOFILTER_VERSION
7
# if VERSION in config.h does not contain 'cvs', use its value.
8
# if it does contain 'cvs', append a date to it.
10
# We'll first try to find CVS/Entries files and use the most
11
# current date from the files. To parse, we need Perl 5 and
12
# the HTTP::Date module.
14
# If that fails, either because HTTP::Date is missing, Perl is
15
# missing or we're building outside the CVS working directory,
16
# we'll fall back to use the current date (GMT time zone) with
19
# On FreeBSD, HTTP::Date is part of the p5-libwww port.
21
VERSION=$(grep define.VERSION config.h | awk '{print $3}' | tr -d '"')
23
SUFFIX=$(echo $VERSION | egrep "\.cvs$")
30
if [ ! -z "$SUFFIX" ]; then
31
FILES=$(find $srcdir -name CVS -type d -print | while read a ; do find "$a" -name Entries -type f -print ; done)
33
DATE=CVStime_`perl -MHTTP::Date -e '
37
$a=str2time($_[3], "GMT");
38
$max=$a if $a and $a > $max;
40
$date=HTTP::Date::time2isoz($max);
43
' </dev/null $FILES` || DATE=
44
if [ "x$FILES" = "x" ] || [ "x$DATE" = "x" ] ; then
45
DATE=$(env TZ=GMT date "+build_date_%Y%m%d_%Hh")
47
# VERSION="$VERSION.$DATE"
50
echo "#include \"globals.h\""
51
echo "const char * const version = \"$VERSION\";"