2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv, fetchurl, pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
, zlib, bzip2, libiconv, libxml2, openssl, ncurses, curl, libmilter, pcre2
|
2020-12-09 12:39:15 +00:00
|
|
|
, libmspack, systemd, Foundation, json_c, check
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "clamav";
|
2021-06-28 23:13:55 +00:00
|
|
|
version = "0.103.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://www.clamav.net/downloads/production/${pname}-${version}.tar.gz";
|
2021-06-28 23:13:55 +00:00
|
|
|
sha256 = "sha256-n249GESfPRo5kncdaWaFJJ36EnNv4rKSmFjyx9gnauk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# don't install sample config files into the absolute sysconfdir folder
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace Makefile.in --replace ' etc ' ' '
|
|
|
|
'';
|
|
|
|
|
2020-12-09 12:39:15 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [
|
2020-12-09 12:39:15 +00:00
|
|
|
zlib bzip2 libxml2 openssl ncurses curl libiconv libmilter pcre2 libmspack json_c check
|
2021-01-15 22:18:51 +00:00
|
|
|
] ++ lib.optional stdenv.isLinux systemd
|
|
|
|
++ lib.optional stdenv.isDarwin Foundation;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--libdir=$(out)/lib"
|
|
|
|
"--sysconfdir=/etc/clamav"
|
|
|
|
"--disable-llvm" # enabling breaks the build at the moment
|
|
|
|
"--with-zlib=${zlib.dev}"
|
|
|
|
"--with-xml=${libxml2.dev}"
|
|
|
|
"--with-openssl=${openssl.dev}"
|
|
|
|
"--with-libcurl=${curl.dev}"
|
2020-12-09 12:39:15 +00:00
|
|
|
"--with-libjson=${json_c.dev}"
|
2020-04-24 23:36:52 +00:00
|
|
|
"--with-system-libmspack"
|
|
|
|
"--enable-milter"
|
2020-12-09 12:39:15 +00:00
|
|
|
"--disable-unrar" # disable unrar because it's non-free and requires some extra patching to work properly
|
|
|
|
"--enable-check"
|
2021-01-15 22:18:51 +00:00
|
|
|
] ++ lib.optional stdenv.isLinux
|
2020-07-18 16:06:22 +00:00
|
|
|
"--with-systemdsystemunitdir=$(out)/lib/systemd";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir $out/etc
|
|
|
|
cp etc/*.sample $out/etc
|
|
|
|
'';
|
|
|
|
|
2020-12-09 12:39:15 +00:00
|
|
|
# Only required for the unit tests
|
|
|
|
hardeningDisable = [ "format" ];
|
|
|
|
doCheck = true;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://www.clamav.net";
|
|
|
|
description = "Antivirus engine designed for detecting Trojans, viruses, malware and other malicious threats";
|
|
|
|
license = licenses.gpl2;
|
|
|
|
maintainers = with maintainers; [ phreedom robberer qknight fpletz globin ];
|
2020-07-18 16:06:22 +00:00
|
|
|
platforms = platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|