homebrew-core/Formula/zeek.rb

79 lines
2.8 KiB
Ruby

class Zeek < Formula
desc "Network security monitor"
homepage "https://www.zeek.org"
url "https://github.com/zeek/zeek.git",
tag: "v4.2.1",
revision: "45491fc4e19ef15428db3ccdc5e1c55130f79131"
license "BSD-3-Clause"
head "https://github.com/zeek/zeek.git", branch: "master"
livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)$/i)
end
bottle do
sha256 arm64_monterey: "5005d30962982766efe8af9b13499089adae2d7c8ba0b2dc3acaee46f1fcf9d3"
sha256 arm64_big_sur: "d0c7d6589300b591bc6c9fcb90056e01d505ec91bca6b2473f8d8771adee32ad"
sha256 monterey: "991b9a377ef8192946de126d612ce8aa3cbf48e19ed652ca3a2c582d704d5d98"
sha256 big_sur: "040b280ab1df2c7696e9ebb3f90354a2a7f3ffd5a1eec561d2668effb0334ae1"
sha256 catalina: "58fc46d06e986c504a1dfc4486f54fa8f63ce811e7c98cdb2fb191c2a69e0028"
sha256 x86_64_linux: "538b2c9d090421142e65c71f6656b10e5e3b6106d687ea546ad80ae12c30e626"
end
depends_on "bison" => :build
depends_on "cmake" => :build
depends_on "swig" => :build
depends_on "caf"
depends_on "geoip"
depends_on "libmaxminddb"
depends_on macos: :mojave
depends_on "openssl@1.1"
depends_on "python@3.10"
uses_from_macos "flex"
uses_from_macos "libpcap"
uses_from_macos "zlib"
on_linux do
depends_on "gcc" # For C++17
end
fails_with gcc: "5"
def install
# Remove SDK paths from zeek-config. This breaks usage with other SDKs.
# https://github.com/corelight/zeek-community-id/issues/15
inreplace "zeek-config.in" do |s|
s.gsub! "@ZEEK_CONFIG_PCAP_INCLUDE_DIR@", ""
s.gsub! "@ZEEK_CONFIG_ZLIB_INCLUDE_DIR@", ""
end
mkdir "build" do
system "cmake", "..", *std_cmake_args,
"-DBROKER_DISABLE_TESTS=on",
"-DBUILD_SHARED_LIBS=on",
"-DINSTALL_AUX_TOOLS=on",
"-DINSTALL_ZEEKCTL=on",
"-DUSE_GEOIP=on",
"-DCAF_ROOT=#{Formula["caf"].opt_prefix}",
"-DOPENSSL_ROOT_DIR=#{Formula["openssl@1.1"].opt_prefix}",
"-DZEEK_ETC_INSTALL_DIR=#{etc}",
"-DZEEK_LOCAL_STATE_DIR=#{var}"
system "make", "install"
end
end
test do
assert_match "version #{version}", shell_output("#{bin}/zeek --version")
assert_match "ARP packet analyzer", shell_output("#{bin}/zeek --print-plugins")
system bin/"zeek", "-C", "-r", test_fixtures("test.pcap")
assert_predicate testpath/"conn.log", :exist?
refute_predicate testpath/"conn.log", :empty?
assert_predicate testpath/"http.log", :exist?
refute_predicate testpath/"http.log", :empty?
# For bottling MacOS SDK paths must not be part of the public include directories, see zeek/zeek#1468.
refute_includes shell_output("#{bin}/zeek-config --include_dir").chomp, "MacOSX"
end
end