gnu: Add cl-ana.statistical-learning.
[jackhill/guix/guix.git] / gnu / packages / antivirus.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016, 2017, 2018, 2019 Eric Bavier <bavier@member.fsf.org>
3 ;;; Copyright © 2018 Christopher Baines <mail@cbaines.net>
4 ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
5 ;;;
6 ;;; This file is part of GNU Guix.
7 ;;;
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
12 ;;;
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
17 ;;;
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21 (define-module (gnu packages antivirus)
22 #:use-module ((guix licenses) #:prefix license:)
23 #:use-module (guix build-system gnu)
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix utils)
27 #:use-module (gnu packages)
28 #:use-module (gnu packages autotools)
29 #:use-module (gnu packages bison)
30 #:use-module (gnu packages check)
31 #:use-module (gnu packages compression)
32 #:use-module (gnu packages curl)
33 #:use-module (gnu packages cyrus-sasl)
34 #:use-module (gnu packages flex)
35 #:use-module (gnu packages llvm)
36 #:use-module (gnu packages multiprecision)
37 #:use-module (gnu packages ncurses)
38 #:use-module (gnu packages pcre)
39 #:use-module (gnu packages pkg-config)
40 #:use-module (gnu packages tls)
41 #:use-module (gnu packages web)
42 #:use-module (gnu packages xml))
43
44 (define-public clamav
45 (package
46 (name "clamav")
47 (version "0.102.1")
48 (source (origin
49 (method url-fetch)
50 (uri (string-append "https://www.clamav.net/downloads/production/"
51 "clamav-" version ".tar.gz"))
52 (sha256
53 (base32
54 "1mpdgn3isz26hd1j6p8lcb76v8hjs54k1wb655rnil4hv78aig8d"))
55 (modules '((guix build utils)))
56 (snippet
57 '(begin
58 (for-each delete-file-recursively
59 '("win32" ; unnecessary
60 "libclamav/c++/llvm" ; use system llvm
61 "libclamav/tomsfastmath" ; use system tomsfastmath
62 "libclamunrar")))) ; non-free license
63 (patches
64 (search-patches "clamav-system-tomsfastmath.patch"
65 "clamav-config-llvm-libs.patch"))))
66 (build-system gnu-build-system)
67 (native-inputs
68 `(("autoconf" ,autoconf)
69 ("automake" ,automake)
70 ("check" ,check) ; for tests
71 ("libtool" ,libtool)
72 ("pkg-config" ,pkg-config)))
73 (inputs
74 `(("bzip2" ,bzip2)
75 ("libcurl" ,curl)
76 ("libjson" ,json-c)
77 ("libltdl" ,libltdl)
78 ("libmspack" ,libmspack)
79 ("llvm" ,llvm-3.6) ; requires <3.7, for JIT/verifier
80 ("ncurses" ,ncurses)
81 ("openssl" ,libressl)
82 ("pcre2" ,pcre2)
83 ("sasl" ,cyrus-sasl) ; for linking curl with libtool
84 ("tomsfastmath" ,tomsfastmath)
85 ("xml" ,libxml2)
86 ("zlib" ,zlib)))
87 (arguments
88 `(#:configure-flags
89 (let-syntax ((with (syntax-rules ()
90 ((_ name)
91 (string-append "--with-" name "="
92 (assoc-ref %build-inputs name))))))
93 (list "--disable-unrar"
94 "--enable-llvm"
95 "--with-system-llvm"
96 "--with-system-libmspack"
97 "--without-included-ltdl"
98 (with "xml")
99 (with "openssl")
100 (with "libjson")
101 (with "pcre2")
102 (with "zlib")
103 (with "libcurl")
104 ;; For sanity, specifying --enable-* flags turns
105 ;; "support unavailable" warnings into errors.
106 "--enable-bzip2"
107 "--enable-check"
108 "--sysconfdir=/etc/clamav"
109 ;; Default database directory needs to be writeable
110 "--with-dbdir=/var/db/clamav"))
111 ;; install sample .conf files to %output/etc rather than /etc/clamav
112 #:make-flags (list (string-append "sysconfdir=" %output "/etc"))
113 #:phases (modify-phases %standard-phases
114 ;; Regenerate configure script. Without this we don't get
115 ;; the correct value for LLVM linker variables.
116 (add-after 'unpack 'reconf
117 (lambda _ (invoke "autoreconf" "-vfi")))
118 (add-before 'configure 'patch-llvm-config
119 (lambda _
120 (substitute* '("libclamav/c++/detect.cpp"
121 "libclamav/c++/ClamBCRTChecks.cpp"
122 "libclamav/c++/bytecode2llvm.cpp")
123 (("llvm/Config/config.h") "llvm/Config/llvm-config.h"))
124 ;; `llvm-config --libfiles` inappropriately lists lib*.a
125 ;; libraries, rather than the lib*.so's that our llvm
126 ;; contains. They're used only for listing extra build
127 ;; dependencies, so ignore them until that's fixed.
128 (substitute* "libclamav/c++/Makefile.in"
129 (("@LLVMCONFIG_LIBFILES@") ""))
130 #t))
131 (add-before 'check 'skip-clamd-tests
132 ;; XXX: The check?_clamd tests fail inside the build
133 ;; chroot, but pass outside.
134 (lambda _
135 (substitute* "unit_tests/Makefile"
136 (("check2_clamd.sh.*check4_clamd.sh") ""))
137 #t)))))
138 (home-page "https://www.clamav.net")
139 (synopsis "Antivirus engine")
140 (description
141 "Clam AntiVirus is an anti-virus toolkit, designed especially for e-mail
142 scanning on mail gateways. It provides a number of utilities including a
143 flexible and scalable multi-threaded daemon, a command line scanner, and
144 advanced tool for automatic database updates. The core of the package is an
145 anti-virus engine available in the form of a shared library.")
146 (license (list license:gpl2+ ;ClamAV itself
147 license:lgpl2.1 ;libclamav/mspack.[ch]
148 license:public-domain ;libclamav/7z/*, libclamav/rijndael.[ch], etc...
149 (package-license bzip2) ;modified bzip2 source in libclamav/nsis
150 license:bsd-2 ;several files in libclamav
151 license:bsd-3 ;libclamav/{regex,qsort.c,swf.[ch]
152 license:ncsa ;libclamav/c++/PointerTracking.cpp
153 license:zlib ;libclamav/inf*.h
154 license:x11 ;libclamav/lzw
155 (license:non-copyleft "libclamav/strlcat.c") ;"OpenBSD" license
156 license:asl2.0 ;libclamav/yara*
157 license:expat)))) ;shared/getopt.[ch]