homebrew-core/Formula/zeek.rb

79 lines
3.0 KiB
Ruby

class Zeek < Formula
desc "Network security monitor"
homepage "https://www.zeek.org"
url "https://github.com/zeek/zeek.git",
tag: "v4.2.2",
revision: "40eb7f80378284202e52e6c45299cac10abf07ab"
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
rebuild 1
sha256 arm64_ventura: "c7ed92fb064de3aafc5c56d17e9f998916a8b0fd97e59c51e5820b2ebdb7e98a"
sha256 arm64_monterey: "79cff929180fbf3e76c1b263a96cf16db2b7ae8ebbc48b7e7c19f7edb6b3deb7"
sha256 arm64_big_sur: "1dbab06ef418f7be7a2af05e74a8397ad8da0e62bf48ac9a5b9c80ce18128fd5"
sha256 ventura: "f3893d1d6a127fc1082252aa56e6f456ca7e40d24764935cb3a6f28ec5f513e2"
sha256 monterey: "9f0c7484c6c89089e496da6a82126f1ad6150a091ec7ac1e3365123bc9e73ae3"
sha256 big_sur: "eb6cec7c6008e645889203c0f9160a23e4bd747cb45df1b6f44070c9b45e3679"
sha256 catalina: "77328d64c938ee428b22d21937902848b52c098760cd63d3049ec43fae211982"
sha256 x86_64_linux: "9f3b8561dcb40db17c4ac25ac2e5ac9269c24294b065287402d1de475439491b"
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 "libxcrypt"
uses_from_macos "zlib"
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