From 0a41123f01d5d2466d6f533be3644ac8c9a2bdf9 Mon Sep 17 00:00:00 2001 From: Eric Bavier Date: Fri, 28 Oct 2016 22:42:59 -0500 Subject: gnu: Add ClamAV. * gnu/packages/antivirus.scm: New file. * gnu/packages/patches/clamav-system-tomsfastmath.patch, gnu/packages/patches/clamav-config-llvm-libs.patch: New files. * gnu/local.mk (GNU_SYSTEM_MODULES): Add new module. (dist_patch_DATA): Add patches. Co-authored-by: Christopher Baines --- gnu/packages/patches/clamav-config-llvm-libs.patch | 14 +++ .../patches/clamav-system-tomsfastmath.patch | 102 +++++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 gnu/packages/patches/clamav-config-llvm-libs.patch create mode 100644 gnu/packages/patches/clamav-system-tomsfastmath.patch (limited to 'gnu/packages/patches') diff --git a/gnu/packages/patches/clamav-config-llvm-libs.patch b/gnu/packages/patches/clamav-config-llvm-libs.patch new file mode 100644 index 0000000000..054264ee2e --- /dev/null +++ b/gnu/packages/patches/clamav-config-llvm-libs.patch @@ -0,0 +1,14 @@ +Our llvm does not contain a single top-level library, so consult llvm-config +for the libraries that need to be linked against. + +--- clamav-0.100.2/libclamav/c++/configure.ac 2018-09-19 14:29:07.000000000 -0500 ++++ clamav-0.100.2/libclamav/c++/configure.ac 2018-10-06 21:45:09.377249158 -0500 +@@ -105,7 +105,7 @@ + + if test "x$llvm_linking" = "xdynamic"; then + AC_SUBST(LLVMCONFIG_LDFLAGS, [`$llvmconfig --ldflags`]) +- AC_SUBST(LLVMCONFIG_LIBS, [-lLLVM-$llvmver]) ++ AC_SUBST(LLVMCONFIG_LIBS, [`$llvmconfig --libs $llvmcomp`]) + AC_SUBST(LLVMCONFIG_LIBFILES, []) + else + if test $llvmver_test -ge 350; then diff --git a/gnu/packages/patches/clamav-system-tomsfastmath.patch b/gnu/packages/patches/clamav-system-tomsfastmath.patch new file mode 100644 index 0000000000..07ab79f3f7 --- /dev/null +++ b/gnu/packages/patches/clamav-system-tomsfastmath.patch @@ -0,0 +1,102 @@ +From 756ff89526b5ffaa7a4f49b1bbecf2ecbd6f85f9 Mon Sep 17 00:00:00 2001 +From: Andreas Cadhalpun +Date: Wed, 11 Mar 2015 20:03:15 +0100 +Subject: add support for system tomsfastmath + +Patch-Name: add-support-for-system-tomsfastmath.patch +--- + configure.ac | 2 ++ + libclamav/Makefile.am | 10 ++++++++-- + libclamav/bignum.h | 6 +++++- + libclamav/xdp.c | 2 +- + m4/reorganization/libs/tomsfastmath.m4 | 12 ++++++++++++ + 5 files changed, 28 insertions(+), 4 deletions(-) + create mode 100644 m4/reorganization/libs/tomsfastmath.m4 + +--- a/configure.ac ++++ b/configure.ac +@@ -82,6 +82,7 @@ m4_include([m4/reorganization/libs/xml.m + m4_include([m4/reorganization/libs/openssl.m4]) + m4_include([m4/reorganization/libs/json.m4]) + m4_include([m4/reorganization/libs/pcre.m4]) ++m4_include([m4/reorganization/libs/tomsfastmath.m4]) + + AM_MAINTAINER_MODE + m4_include([m4/reorganization/libs/libz.m4]) +@@ -285,6 +286,7 @@ else + fi + CL_MSG_STATUS([yara ],[$enable_yara],[$enable_yara]) + CL_MSG_STATUS([fts ],[yes],[$lfs_fts_msg]) ++CL_MSG_STATUS([tomsfastmath],[yes],[$tomsfastmath_msg]) + + + # Yep, downgrading the compiler avoids the bug too: +--- a/libclamav/Makefile.am ++++ b/libclamav/Makefile.am +@@ -496,8 +496,10 @@ libclamav_la_SOURCES += yara_arena.c \ + yara_clam.h + endif + +-libclamav_la_SOURCES += bignum.h\ +- bignum_fast.h\ ++libclamav_la_SOURCES += bignum.h ++ ++if !SYSTEM_TOMSFASTMATH ++libclamav_la_SOURCES += bignum_fast.h\ + tomsfastmath/addsub/fp_add.c\ + tomsfastmath/addsub/fp_add_d.c\ + tomsfastmath/addsub/fp_addmod.c\ +@@ -579,6 +581,10 @@ libclamav_la_SOURCES += bignum.h\ + tomsfastmath/sqr/fp_sqr_comba_generic.c\ + tomsfastmath/sqr/fp_sqr_comba_small_set.c\ + tomsfastmath/sqr/fp_sqrmod.c ++else ++libclamav_la_CFLAGS += $(TOMSFASTMATH_CFLAGS) ++libclamav_la_LIBADD += $(TOMSFASTMATH_LIBS) ++endif + + .PHONY: version.h.tmp + version.c: version.h +--- a/libclamav/bignum.h ++++ b/libclamav/bignum.h +@@ -1,9 +1,13 @@ + #ifndef BIGNUM_H_ + #define BIGNUM_H_ + ++#if HAVE_SYSTEM_TOMSFASTMATH ++#include ++#else + #define TFM_CHECK +- + #include "bignum_fast.h" ++#endif ++ + typedef fp_int mp_int; + #define mp_cmp fp_cmp + #define mp_toradix_n(a,b,c,d) fp_toradix_n(a,b,c,d) +--- a/libclamav/xdp.c ++++ b/libclamav/xdp.c +@@ -57,7 +57,7 @@ + #include "scanners.h" + #include "conv.h" + #include "xdp.h" +-#include "bignum_fast.h" ++#include "bignum.h" + #include "filetypes.h" + + static char *dump_xdp(cli_ctx *ctx, const char *start, size_t sz); +--- /dev/null ++++ b/m4/reorganization/libs/tomsfastmath.m4 +@@ -0,0 +1,12 @@ ++dnl Check for system tomsfastmath ++PKG_CHECK_MODULES([TOMSFASTMATH], [tomsfastmath], [have_system_tomsfastmath=yes], [have_system_tomsfastmath=no]) ++ ++AM_CONDITIONAL([SYSTEM_TOMSFASTMATH], [test "x$have_system_tomsfastmath" = "xyes"]) ++ ++if test "x$have_system_tomsfastmath" = "xyes"; then ++ AC_DEFINE([HAVE_SYSTEM_TOMSFASTMATH], [1], [link against system-wide tomsfastmath library]) ++ tomsfastmath_msg="External, $TOMSFASTMATH_CFLAGS $TOMSFASTMATH_LIBS" ++else ++ AC_DEFINE([HAVE_SYSTEM_TOMSFASTMATH], [0], [don't link against system-wide tomsfastmath library]) ++ tomsfastmath_msg="Internal" ++fi -- cgit v1.2.3