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