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

This commit is contained in:
Micah Snyder 2019-08-21 17:08:25 -04:00
parent ff31e5b486
commit d45d16b27e
5 changed files with 85 additions and 1 deletions

View file

@ -40,7 +40,7 @@ endif
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libclamav.pc pkgconfig_DATA = libclamav.pc
nodist_include_HEADERS = clamav-types.h nodist_include_HEADERS = clamav-types.h clamav-version.h
# don't complain that configuration files and databases are not removed, this is intended # don't complain that configuration files and databases are not removed, this is intended
distuninstallcheck_listfiles = find . -type f ! -name clamd.conf ! -name freshclam.conf ! -name daily.cvd ! -name main.cvd -print distuninstallcheck_listfiles = find . -type f ! -name clamd.conf ! -name freshclam.conf ! -name daily.cvd ! -name main.cvd -print

View file

@ -96,6 +96,8 @@ changes.
assurance test suites and enables automatic testing of all proposed changes assurance test suites and enables automatic testing of all proposed changes
to ClamAV, with customizable parameters to suit the testing needs of any to ClamAV, with customizable parameters to suit the testing needs of any
given code change. given code change.
- Added a new `clamav-version.h` generated header to provide version number
macros in text and numerical format for ClamAV, libclamav, and libfreshclam.
### Bug fixes ### Bug fixes

68
clamav-version.h.in Normal file
View file

@ -0,0 +1,68 @@
/*
* Copyright (C) 2019 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
*
* Authors: Micah Snyder
*
* @GENERATE_WARNING@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#ifndef CLAMAV_VER_H
#define CLAMAV_VER_H
/**
* @macro
* Version number of the clamav package release
*/
#define CLAMAV_VERSION "@PACKAGE_VERSION@"
/**
* @macro
* Numerical representation of the version number of the clamav package
* release. This is a 24 bit number with 8 bits for major number, 8 bits
* for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
*/
#define CLAMAV_VERSION_NUM @PACKAGE_VERSION_NUM@
/**
* @macro
* Version number of the clamav library release
*/
#define LIBCLAMAV_VERSION "@LIBCLAMAV_VERSION@"
/**
* @macro
* Numerical representation of the version number of the libclamav library
* release. This is a 24 bit number with 8 bits for major number, 8 bits
* for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
*/
#define LIBCLAMAV_VERSION_NUM @LIBCLAMAV_VERSION_NUM@
/**
* @macro
* Version number of the clamav library release
*/
#define LIBFRESHCLAM_VERSION "@LIBFRESHCLAM_VERSION@"
/**
* @macro
* Numerical representation of the version number of the libfreshclam library
* release. This is a 24 bit number with 8 bits for major number, 8 bits
* for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
*/
#define LIBFRESHCLAM_VERSION_NUM @LIBFRESHCLAM_VERSION_NUM@
#endif /* CLAMAV_VER_H */

View file

@ -223,6 +223,7 @@ docs/man/sigtool.1
docs/man/clamdtop.1 docs/man/clamdtop.1
docs/man/clamsubmit.1 docs/man/clamsubmit.1
clamav-types.h clamav-types.h
clamav-version.h
]) ])
AM_COND_IF([BUILD_CLAMONACC], AM_COND_IF([BUILD_CLAMONACC],

View file

@ -2,6 +2,13 @@ dnl change this on a release
dnl VERSION="devel-`date +%Y%m%d`" dnl VERSION="devel-`date +%Y%m%d`"
VERSION="0.102.0-beta" VERSION="0.102.0-beta"
major=`echo $PACKAGE_VERSION |cut -d. -f1 | sed -e "s/[^0-9]//g"`
minor=`echo $PACKAGE_VERSION |cut -d. -f2 | sed -e "s/[^0-9]//g"`
patch=`echo $PACKAGE_VERSION |cut -d. -f3 | cut -d- -f1 | sed -e "s/[^0-9]//g"`
PACKAGE_VERSION_NUM=`printf "0x%02x%02x%02x" "$major" "$minor" "$patch"`
AC_SUBST(PACKAGE_VERSION_NUM)
dnl libclamav version info dnl libclamav version info
LC_CURRENT=9 LC_CURRENT=9
LC_REVISION=4 LC_REVISION=4
@ -9,6 +16,9 @@ LC_AGE=0
LIBCLAMAV_VERSION="$LC_CURRENT":"$LC_REVISION":"$LC_AGE" LIBCLAMAV_VERSION="$LC_CURRENT":"$LC_REVISION":"$LC_AGE"
AC_SUBST([LIBCLAMAV_VERSION]) AC_SUBST([LIBCLAMAV_VERSION])
LIBCLAMAV_VERSION_NUM=`printf "0x%02x%02x%02x" "$LC_CURRENT" "$LC_REVISION" "$LC_AGE"`
AC_SUBST(LIBCLAMAV_VERSION_NUM)
LC_MAJOR=`expr $LC_CURRENT - $LC_AGE` LC_MAJOR=`expr $LC_CURRENT - $LC_AGE`
AC_DEFINE_UNQUOTED([LIBCLAMAV_FULLVER], "$LC_MAJOR.$LC_AGE.$LC_REVISION", ["Full clamav library version number"]) AC_DEFINE_UNQUOTED([LIBCLAMAV_FULLVER], "$LC_MAJOR.$LC_AGE.$LC_REVISION", ["Full clamav library version number"])
AC_DEFINE_UNQUOTED([LIBCLAMAV_MAJORVER], $LC_MAJOR, ["Major clamav library version number"]) AC_DEFINE_UNQUOTED([LIBCLAMAV_MAJORVER], $LC_MAJOR, ["Major clamav library version number"])
@ -20,6 +30,9 @@ LFC_AGE=0
LIBFRESHCLAM_VERSION="$LFC_CURRENT":"$LFC_REVISION":"$LFC_AGE" LIBFRESHCLAM_VERSION="$LFC_CURRENT":"$LFC_REVISION":"$LFC_AGE"
AC_SUBST([LIBFRESHCLAM_VERSION]) AC_SUBST([LIBFRESHCLAM_VERSION])
LIBFRESHCLAM_VERSION_NUM=`printf "0x%02x%02x%02x" "$LFC_CURRENT" "$LFC_REVISION" "$LFC_AGE"`
AC_SUBST(LIBFRESHCLAM_VERSION_NUM)
LFC_MAJOR=`expr $LFC_CURRENT - $LFC_AGE` LFC_MAJOR=`expr $LFC_CURRENT - $LFC_AGE`
AC_DEFINE_UNQUOTED([LIBFRESHCLAM_FULLVER], "$LFC_MAJOR.$LFC_AGE.$LFC_REVISION", ["Full freshclam library version number"]) AC_DEFINE_UNQUOTED([LIBFRESHCLAM_FULLVER], "$LFC_MAJOR.$LFC_AGE.$LFC_REVISION", ["Full freshclam library version number"])
AC_DEFINE_UNQUOTED([LIBFRESHCLAM_MAJORVER], $LFC_MAJOR, ["Major freshclam library version number"]) AC_DEFINE_UNQUOTED([LIBFRESHCLAM_MAJORVER], $LFC_MAJOR, ["Major freshclam library version number"])