homebrew-core/Formula/zeek.rb

80 lines
2.9 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
sha256 arm64_monterey: "46ced01bacc4f82b9122ebaceb6f800e704f99f3be4109f4a1acd537bfa4815b"
sha256 arm64_big_sur: "caf2f0fe2bed3f277d656dd8177ad37a41854113e5fc279c8be59dabbf6d9d5a"
sha256 monterey: "10e46a4560e844abf4541fc75f8d40d012514c78ed19a30950b49b96dfee0b7f"
sha256 big_sur: "aa399a38142bd865a731288010db4e519450695fbadc608992a03ac50b66a84f"
sha256 catalina: "f71f4c6d8735cd80e135e0c41c73f2c35a797e483f999074e400ce3b1a62fa6f"
sha256 x86_64_linux: "82b22596007b90674142d6dd107d6a264a0d379a9e600c17b5637a4faca07680"
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"
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