Browse code

Adds clamav-version.h generated header files to provide a hex-based numerical macro for evaluating the ClamAV, libclamav, and libfreshclam versions.

Micah Snyder authored on 2019/08/22 06:08:25
Showing 5 changed files
... ...
@@ -40,7 +40,7 @@ endif
40 40
 pkgconfigdir = $(libdir)/pkgconfig
41 41
 pkgconfig_DATA = libclamav.pc
42 42
 
43
-nodist_include_HEADERS = clamav-types.h
43
+nodist_include_HEADERS = clamav-types.h clamav-version.h
44 44
 
45 45
 # don't complain that configuration files and databases are not removed, this is intended
46 46
 distuninstallcheck_listfiles = find . -type f ! -name clamd.conf ! -name freshclam.conf ! -name daily.cvd ! -name main.cvd -print
... ...
@@ -96,6 +96,8 @@ changes.
96 96
   assurance test suites and enables automatic testing of all proposed changes
97 97
   to ClamAV, with customizable parameters to suit the testing needs of any
98 98
   given code change.
99
+- Added a new `clamav-version.h` generated header to provide  version number
100
+  macros in text and numerical format for ClamAV, libclamav, and libfreshclam.
99 101
 
100 102
 ### Bug fixes
101 103
 
102 104
new file mode 100644
... ...
@@ -0,0 +1,68 @@
0
+/*
1
+ *  Copyright (C) 2019 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
2
+ *
3
+ *  Authors: Micah Snyder
4
+ *
5
+ *  @GENERATE_WARNING@
6
+ *
7
+ *  This program is free software; you can redistribute it and/or modify
8
+ *  it under the terms of the GNU General Public License version 2 as
9
+ *  published by the Free Software Foundation.
10
+ *
11
+ *  This program is distributed in the hope that it will be useful,
12
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
+ *  GNU General Public License for more details.
15
+ *
16
+ *  You should have received a copy of the GNU General Public License
17
+ *  along with this program; if not, write to the Free Software
18
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ *  MA 02110-1301, USA.
20
+ */
21
+
22
+#ifndef CLAMAV_VER_H
23
+#define CLAMAV_VER_H
24
+
25
+/**
26
+ * @macro
27
+ * Version number of the clamav package release
28
+ */
29
+#define CLAMAV_VERSION "@PACKAGE_VERSION@"
30
+
31
+/**
32
+ * @macro
33
+ * Numerical representation of the version number of the clamav package
34
+ * release. This is a 24 bit number with 8 bits for major number, 8 bits
35
+ * for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
36
+ */
37
+#define CLAMAV_VERSION_NUM @PACKAGE_VERSION_NUM@
38
+
39
+/**
40
+ * @macro
41
+ * Version number of the clamav library release
42
+ */
43
+#define LIBCLAMAV_VERSION "@LIBCLAMAV_VERSION@"
44
+
45
+/**
46
+ * @macro
47
+ * Numerical representation of the version number of the libclamav library
48
+ * release. This is a 24 bit number with 8 bits for major number, 8 bits
49
+ * for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
50
+ */
51
+#define LIBCLAMAV_VERSION_NUM @LIBCLAMAV_VERSION_NUM@
52
+
53
+/**
54
+ * @macro
55
+ * Version number of the clamav library release
56
+ */
57
+#define LIBFRESHCLAM_VERSION "@LIBFRESHCLAM_VERSION@"
58
+
59
+/**
60
+ * @macro
61
+ * Numerical representation of the version number of the libfreshclam library
62
+ * release. This is a 24 bit number with 8 bits for major number, 8 bits
63
+ * for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
64
+ */
65
+#define LIBFRESHCLAM_VERSION_NUM @LIBFRESHCLAM_VERSION_NUM@
66
+
67
+#endif /* CLAMAV_VER_H */
... ...
@@ -223,6 +223,7 @@ docs/man/sigtool.1
223 223
 docs/man/clamdtop.1
224 224
 docs/man/clamsubmit.1
225 225
 clamav-types.h
226
+clamav-version.h
226 227
 ])
227 228
 
228 229
 AM_COND_IF([BUILD_CLAMONACC],
... ...
@@ -2,6 +2,13 @@ dnl change this on a release
2 2
 dnl VERSION="devel-`date +%Y%m%d`"
3 3
 VERSION="0.102.0-beta"
4 4
 
5
+major=`echo $PACKAGE_VERSION |cut -d. -f1 | sed -e "s/[^0-9]//g"`
6
+minor=`echo $PACKAGE_VERSION |cut -d. -f2 | sed -e "s/[^0-9]//g"`
7
+patch=`echo $PACKAGE_VERSION |cut -d. -f3 | cut -d- -f1 | sed -e "s/[^0-9]//g"`
8
+
9
+PACKAGE_VERSION_NUM=`printf "0x%02x%02x%02x" "$major" "$minor" "$patch"`
10
+AC_SUBST(PACKAGE_VERSION_NUM)
11
+
5 12
 dnl libclamav version info
6 13
 LC_CURRENT=9
7 14
 LC_REVISION=4
... ...
@@ -9,6 +16,9 @@ LC_AGE=0
9 9
 LIBCLAMAV_VERSION="$LC_CURRENT":"$LC_REVISION":"$LC_AGE"
10 10
 AC_SUBST([LIBCLAMAV_VERSION])
11 11
 
12
+LIBCLAMAV_VERSION_NUM=`printf "0x%02x%02x%02x" "$LC_CURRENT" "$LC_REVISION" "$LC_AGE"`
13
+AC_SUBST(LIBCLAMAV_VERSION_NUM)
14
+
12 15
 LC_MAJOR=`expr $LC_CURRENT - $LC_AGE`
13 16
 AC_DEFINE_UNQUOTED([LIBCLAMAV_FULLVER], "$LC_MAJOR.$LC_AGE.$LC_REVISION", ["Full clamav library version number"])
14 17
 AC_DEFINE_UNQUOTED([LIBCLAMAV_MAJORVER], $LC_MAJOR, ["Major clamav library version number"])
... ...
@@ -20,6 +30,9 @@ LFC_AGE=0
20 20
 LIBFRESHCLAM_VERSION="$LFC_CURRENT":"$LFC_REVISION":"$LFC_AGE"
21 21
 AC_SUBST([LIBFRESHCLAM_VERSION])
22 22
 
23
+LIBFRESHCLAM_VERSION_NUM=`printf "0x%02x%02x%02x" "$LFC_CURRENT" "$LFC_REVISION" "$LFC_AGE"`
24
+AC_SUBST(LIBFRESHCLAM_VERSION_NUM)
25
+
23 26
 LFC_MAJOR=`expr $LFC_CURRENT - $LFC_AGE`
24 27
 AC_DEFINE_UNQUOTED([LIBFRESHCLAM_FULLVER], "$LFC_MAJOR.$LFC_AGE.$LFC_REVISION", ["Full freshclam library version number"])
25 28
 AC_DEFINE_UNQUOTED([LIBFRESHCLAM_MAJORVER], $LFC_MAJOR, ["Major freshclam library version number"])