homebrew-core/Formula/clamav.rb

99 lines
3.0 KiB
Ruby

class Clamav < Formula
desc "Anti-virus software"
homepage "https://www.clamav.net/"
url "https://www.clamav.net/downloads/production/clamav-0.103.3.tar.gz"
mirror "https://fossies.org/linux/misc/clamav-0.103.3.tar.gz"
sha256 "9f6e3d18449f3d1a3992771d696685249dfa12736fe2b2929858f2c7d8276ae9"
license "GPL-2.0-or-later"
livecheck do
url "https://www.clamav.net/downloads"
regex(/href=.*?clamav[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_big_sur: "de0e15a9827c466360b9cd0f2d3f193134834032998448d7981ac4a8f74b85b5"
sha256 big_sur: "0336a74d46b95394919ed3de66e3fe02a1e58993892f3e5221dea29ad56c301b"
sha256 catalina: "5b0e6cc76e434d7ebfb9301f4b6de21b647f7c0cb3a89d7ca7d6d92c37c34600"
sha256 mojave: "a7ebd59427dddd39419a5dceb5f6c85f55d6040d41878e4fca931e384f906fe2"
sha256 x86_64_linux: "f921185f5319873958091bd65bd535d33cb9230a3a9a94fd73041b42d7ed4074"
end
head do
url "https://github.com/Cisco-Talos/clamav-devel.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
depends_on "pkg-config" => :build
depends_on "json-c"
depends_on "libtool"
depends_on "openssl@1.1"
depends_on "pcre2"
depends_on "yara"
uses_from_macos "bzip2"
uses_from_macos "curl"
uses_from_macos "libxml2"
uses_from_macos "zlib"
on_macos do
depends_on "libiconv"
end
skip_clean "share/clamav"
def install
args = %W[
--disable-dependency-tracking
--disable-silent-rules
--prefix=#{prefix}
--libdir=#{lib}
--sysconfdir=#{etc}/clamav
--disable-zlib-vcheck
--with-llvm=no
--with-libjson=#{Formula["json-c"].opt_prefix}
--with-openssl=#{Formula["openssl@1.1"].opt_prefix}
--with-pcre=#{Formula["pcre2"].opt_prefix}
]
on_macos do
args << "--with-libiconv-prefix=#{Formula["libiconv"].opt_prefix}"
args << "--with-iconv=#{Formula["libiconv"].opt_prefix}"
args << "--with-zlib=#{MacOS.sdk_path_if_needed}/usr"
args << "--with-libbz2-prefix=#{MacOS.sdk_path_if_needed}/usr"
args << "--with-xml=#{MacOS.sdk_path_if_needed}/usr"
end
on_linux do
args << "--with-zlib=#{Formula["zlib"].opt_prefix}"
args << "--with-libbz2-prefix=#{Formula["bzip2"].opt_prefix}"
args << "--with-xml=#{Formula["libxml2"].opt_prefix}"
args << "--with-libcurl=#{Formula["curl"].opt_prefix}"
end
pkgshare.mkpath
system "autoreconf", "-fvi" if build.head?
system "./configure", *args
system "make", "install"
end
def caveats
<<~EOS
To finish installation & run clamav you will need to edit
the example conf files at #{etc}/clamav/
EOS
end
test do
system "#{bin}/clamav-config", "--version"
(testpath/"freshclam.conf").write <<~EOS
DNSDatabaseInfo current.cvd.clamav.net
DatabaseMirror database.clamav.net
EOS
system "#{bin}/freshclam", "--datadir=#{testpath}", "--config-file=#{testpath}/freshclam.conf"
system "#{bin}/clamscan", "--database=#{testpath}", testpath
end
end