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.0",
revision: "ce38609161cfd10a67cad301e60b7d96e3333835"
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: "f106f4f5e21f854042c199abc8def48b28c22e5cfc68a829b720daba4ce3b266"
sha256 arm64_big_sur: "9f59e28060a19364c1b339f417943783677e75d8fac88ab4fee173d386073776"
sha256 monterey: "c3a21ae64e28c3001d19e1cf60dca55b11b20535c4597a0c7392cfb3b021e389"
sha256 big_sur: "8862c67438dfdf689575d4ac1a89fd1d866530777946f3f5d82bf16285b5d0f1"
sha256 catalina: "7664242ed065030c455fd9210442e4fdee78a55c45d12391be681ffdf65ee673"
sha256 x86_64_linux: "ed82ade4cda871af176e0656d20a83e5d5e2138981c83d08c641c1b76f70c7ad"
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