projects/guix·blob javascript-team · refs

193 lines · 8.0 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2016, 2017, 2018, 2019, 2020 Eric Bavier <[email protected]>
3;;; Copyright © 2018 Christopher Baines <[email protected]>
4;;; Copyright © 2023 Jakob Kirsch <[email protected]>
5;;; Copyright © 2019–2021 Tobias Geerinckx-Rice <[email protected]>
6;;; Copyright © 2024 Nicolas Graves <[email protected]>
7;;;
8;;; This file is part of GNU Guix.
9;;;
10;;; GNU Guix is free software; you can redistribute it and/or modify it
11;;; under the terms of the GNU General Public License as published by
12;;; the Free Software Foundation; either version 3 of the License, or (at
13;;; your option) any later version.
14;;;
15;;; GNU Guix is distributed in the hope that it will be useful, but
16;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;;; GNU General Public License for more details.
19;;;
20;;; You should have received a copy of the GNU General Public License
21;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23(define-module (gnu packages antivirus)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (guix build-system cargo)
26 #:use-module (guix build-system cmake)
27 #:use-module (guix build-system gnu)
28 #:use-module (guix gexp)
29 #:use-module (guix packages)
30 #:use-module (guix download)
31 #:use-module (guix git-download)
32 #:use-module (guix utils)
33 #:use-module (gnu packages)
34 #:use-module (gnu packages autotools)
35 #:use-module (gnu packages bash)
36 #:use-module (gnu packages check)
37 #:use-module (gnu packages compression)
38 #:use-module (gnu packages cmake)
39 #:use-module (gnu packages curl)
40 #:use-module (gnu packages ncurses)
41 #:use-module (gnu packages pcre)
42 #:use-module (gnu packages pkg-config)
43 #:use-module (gnu packages protobuf)
44 #:use-module (gnu packages python)
45 #:use-module (gnu packages python-check)
46 #:use-module (gnu packages rust)
47 #:use-module (gnu packages rust-apps)
48 #:use-module (gnu packages rust)
49 #:use-module (gnu packages tls)
50 #:use-module (gnu packages web)
51 #:use-module (gnu packages xml))
52
53(define-public clamav
54 (package
55 (name "clamav")
56 (version "1.4.3")
57 (source (origin
58 (method url-fetch)
59 (uri
60 (list
61 (string-append "https://www.clamav.net/downloads/production/"
62 "clamav-" version ".tar.gz")
63 (string-append "https://github.com/Cisco-Talos/clamav/"
64 "releases/download/clamav-" version
65 "/clamav-" version ".tar.gz")))
66 (sha256
67 (base32
68 "041j6jhll4lz7xhissh0094cfvhyi9jkbxcfa5dv6ra77nzwlx6q"))
69 (modules '((guix build utils)))
70 (snippet
71 '(begin
72 (for-each delete-file-recursively
73 '(".cargo" ; vendored rust inputs
74 "win32" ; unnecessary
75 "libclamunrar")))))) ; non-free license
76 (build-system cmake-build-system)
77 (arguments
78 (list
79 #:configure-flags ''("-DENABLE_MILTER=OFF" "-DENABLE_UNRAR=OFF")
80 #:imported-modules `(,@%cmake-build-system-modules
81 ,@%cargo-build-system-modules)
82 #:modules '(((guix build cargo-build-system) #:prefix cargo:)
83 (guix build cmake-build-system)
84 (guix build utils))
85 #:phases
86 #~(modify-phases %standard-phases
87 (add-after 'unpack 'prepare-cargo-build-system
88 (lambda args
89 (for-each
90 (lambda (phase)
91 (format #t "Running cargo phase: ~a~%" phase)
92 (apply (assoc-ref cargo:%standard-phases phase)
93 #:vendor-dir ".cargo/vendor"
94 #:cargo-target #$(cargo-triplet)
95 args))
96 '(unpack-rust-crates
97 configure
98 check-for-pregenerated-files
99 patch-cargo-checksums))))
100 (add-after 'prepare-cargo-build-system 'patch-rust-requirements
101 (lambda _
102 (substitute* "libclamav_rust/Cargo.toml"
103 ;; We make sure we use their fork.
104 (("onenote_parser = .*")
105 "onenote_parser = \"*\"\n"))))
106 (add-after 'unpack 'skip-clamd-tests
107 ;; XXX: The check?_clamd tests fail inside the build
108 ;; chroot, but pass outside.
109 (lambda* (#:key tests? #:allow-other-keys)
110 (when tests?
111 (substitute* "unit_tests/CMakeLists.txt"
112 (("clamd_test\\.py" test)
113 (string-append
114 test " -k \"not test_clamd_08_VirusEvent\"")))))))))
115 (native-inputs
116 (append
117 (list pkg-config
118 python-minimal
119 python-pytest
120 rust
121 `(,rust "cargo"))
122 (or (and=> (%current-target-system)
123 (compose list make-rust-sysroot))
124 '())))
125 (inputs
126 (cons* bzip2
127 check ;For tests.
128 curl
129 json-c
130 libressl
131 libxml2
132 ncurses
133 pcre2
134 zlib
135 (cargo-inputs 'clamav)))
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
140scanning on mail gateways. It provides a number of utilities including a
141flexible and scalable multi-threaded daemon, a command line scanner, and
142advanced tool for automatic database updates. The core of the package is an
143anti-virus engine available in the form of a shared library.")
144 (properties `((release-monitoring-url
145 . "https://github.com/Cisco-Talos/clamav/releases")))
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]
158
159(define-public yara
160 (package
161 (name "yara")
162 (version "4.5.2")
163 (source
164 (origin
165 (method git-fetch)
166 (uri (git-reference
167 (url "https://github.com/VirusTotal/yara")
168 (commit (string-append "v" version))))
169 (file-name (git-file-name name version))
170 (sha256
171 (base32 "1qaw1zv618jkqa5g39p1sdv8s6a7q23ayqfrqv0bj2z1g4nmn95g"))))
172 (build-system gnu-build-system)
173 (arguments
174 (list
175 #:phases
176 #~(modify-phases %standard-phases
177 (add-after 'unpack 'patch-tests
178 (lambda _
179 (substitute* "tests/test-rules.c"
180 (("/bin/sh")
181 (string-append #$(this-package-input "bash-minimal")
182 "/bin/sh"))))))))
183 (inputs (list openssl bash-minimal))
184 (native-inputs (list autoconf automake libtool protobuf pkg-config))
185 (home-page "https://github.com/VirusTotal/yara")
186 (synopsis "Pattern matching swiss knife")
187 (description
188 "YARA is a tool aimed at helping malware researchers to identify and
189classify malware samples. With YARA you can create rules that evaluate
190conditions based on textual and binary patterns. This package also provides
191an executable to scan files, folders, and running processes and report those
192that match said rules.")
193 (license license:bsd-3)))