homebrew-core/Formula/zeek.rb

66 lines
2.5 KiB
Ruby

class Zeek < Formula
desc "Network security monitor"
homepage "https://www.zeek.org"
url "https://github.com/zeek/zeek.git",
tag: "v4.0.1",
revision: "54e03d7f0e06e40f3064107debf64769a6bd5216"
license "BSD-3-Clause"
head "https://github.com/zeek/zeek.git"
bottle do
sha256 arm64_big_sur: "90b0127aa4f76de5d9b892496e7e133fb155b9701dbfaa329a83b4f1381364a5"
sha256 big_sur: "b42c2af18a8fecf4d0c15313864e30e8718c507f4012a811d02695eaf0710650"
sha256 catalina: "c2a598db6bc6144d143efc7c8f5d9bce480f87a98cd97818b191952a770baad2"
sha256 mojave: "1e7588e78c991e402020a8060f603be317e55e04fa6c3348cd0eec17189f72ff"
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.9"
uses_from_macos "flex"
uses_from_macos "libpcap"
uses_from_macos "zlib"
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