antivirus.scm 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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. ;;; 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. (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. (define-public clamav
  43. (package
  44. (name "clamav")
  45. (version "0.101.1")
  46. (source (origin
  47. (method url-fetch)
  48. (uri (string-append "https://www.clamav.net/downloads/production/"
  49. "clamav-" version ".tar.gz"))
  50. (sha256
  51. (base32
  52. "01mq3z04fjbq5iq8wfwfim72iv3dn04d3ishc5lkhxpmnalqydps"))
  53. (modules '((guix build utils)))
  54. (snippet
  55. '(begin
  56. (for-each delete-file-recursively
  57. '("win32" ; unnecessary
  58. "libclamav/c++/llvm" ; use system llvm
  59. "libclamav/tomsfastmath" ; use system tomsfastmath
  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. `(("autoconf" ,autoconf)
  67. ("automake" ,automake)
  68. ("check" ,check) ; for tests
  69. ("libtool" ,libtool)
  70. ("pkg-config" ,pkg-config)))
  71. (inputs
  72. `(("bzip2" ,bzip2)
  73. ("libcurl" ,curl)
  74. ("libjson" ,json-c)
  75. ("libltdl" ,libltdl)
  76. ("libmspack" ,libmspack)
  77. ("llvm" ,llvm-3.6) ; requires <3.7, for JIT/verifier
  78. ("ncurses" ,ncurses)
  79. ("openssl" ,libressl)
  80. ("pcre2" ,pcre2)
  81. ("sasl" ,cyrus-sasl) ; for linking curl with libtool
  82. ("tomsfastmath" ,tomsfastmath)
  83. ("xml" ,libxml2)
  84. ("zlib" ,zlib)))
  85. (arguments
  86. `(#:configure-flags
  87. (let-syntax ((with (syntax-rules ()
  88. ((_ name)
  89. (string-append "--with-" name "="
  90. (assoc-ref %build-inputs name))))))
  91. (list "--disable-unrar"
  92. "--enable-llvm"
  93. "--with-system-llvm"
  94. "--with-system-libmspack"
  95. "--without-included-ltdl"
  96. (with "xml")
  97. (with "openssl")
  98. (with "libjson")
  99. (with "pcre2")
  100. (with "zlib")
  101. (with "libcurl")
  102. ;; For sanity, specifying --enable-* flags turns
  103. ;; "support unavailable" warnings into errors.
  104. "--enable-bzip2"
  105. "--enable-check"
  106. "--sysconfdir=/etc/clamav"
  107. ;; Default database directory needs to be writeable
  108. "--with-dbdir=/var/db/clamav"))
  109. ;; install sample .conf files to %output/etc rather than /etc/clamav
  110. #:make-flags (list (string-append "sysconfdir=" %output "/etc"))
  111. #:phases (modify-phases %standard-phases
  112. ;; Regenerate configure script. Without this we don't get
  113. ;; the correct value for LLVM linker variables.
  114. (add-after 'unpack 'reconf
  115. (lambda _ (invoke "autoreconf" "-vfi")))
  116. (add-before 'configure 'patch-llvm-config
  117. (lambda _
  118. (substitute* '("libclamav/c++/detect.cpp"
  119. "libclamav/c++/ClamBCRTChecks.cpp"
  120. "libclamav/c++/bytecode2llvm.cpp")
  121. (("llvm/Config/config.h") "llvm/Config/llvm-config.h"))
  122. ;; `llvm-config --libfiles` inappropriately lists lib*.a
  123. ;; libraries, rather than the lib*.so's that our llvm
  124. ;; contains. They're used only for listing extra build
  125. ;; dependencies, so ignore them until that's fixed.
  126. (substitute* "libclamav/c++/Makefile.in"
  127. (("@LLVMCONFIG_LIBFILES@") ""))
  128. #t))
  129. (add-before 'check 'skip-clamd-tests
  130. ;; XXX: The check?_clamd tests fail inside the build
  131. ;; chroot, but pass outside.
  132. (lambda _
  133. (substitute* "unit_tests/Makefile"
  134. (("check2_clamd.sh.*check4_clamd.sh") ""))
  135. #t)))))
  136. (home-page "https://www.clamav.net")
  137. (synopsis "Antivirus engine")
  138. (description
  139. "Clam AntiVirus is an anti-virus toolkit, designed especially for e-mail
  140. scanning on mail gateways. It provides a number of utilities including a
  141. flexible and scalable multi-threaded daemon, a command line scanner, and
  142. advanced tool for automatic database updates. The core of the package is an
  143. anti-virus engine available in the form of a shared library.")
  144. (license (list license:gpl2+ ;ClamAV itself
  145. license:lgpl2.1 ;libclamav/mspack.[ch]
  146. license:public-domain ;libclamav/7z/*, libclamav/rijndael.[ch], etc...
  147. (package-license bzip2) ;modified bzip2 source in libclamav/nsis
  148. license:bsd-2 ;several files in libclamav
  149. license:bsd-3 ;libclamav/{regex,qsort.c,swf.[ch]
  150. license:ncsa ;libclamav/c++/PointerTracking.cpp
  151. license:zlib ;libclamav/inf*.h
  152. license:x11 ;libclamav/lzw
  153. (license:non-copyleft "libclamav/strlcat.c") ;"OpenBSD" license
  154. license:asl2.0 ;libclamav/yara*
  155. license:expat)))) ;shared/getopt.[ch]