class Suricata < Formula desc "Network IDS, IPS, and security monitoring engine" homepage "https://suricata-ids.org/" url "https://www.openinfosecfoundation.org/download/suricata-5.0.0.tar.gz" sha256 "6a3dcc427196927a5cdefd32c290fa352d6405e9bb6d3fe12c71f47d31d98a63" bottle do sha256 "bb6b21d3beb37cfa2ceaf5f524daf6bd5a8f48c8a2f3203f2bab9a203424aa0f" => :catalina sha256 "2d5a85985c0bba470ab19fcb85516983c455f6515966b7f2320d4e75dd7e89cc" => :mojave sha256 "a5251c6b0ac12117237d04252339ef60886bc5e038052310bb4b917e8864d778" => :high_sierra end depends_on "pkg-config" => :build depends_on "rust" => :build depends_on "jansson" depends_on "libmagic" depends_on "libnet" depends_on "libyaml" depends_on "lz4" depends_on "nspr" depends_on "nss" depends_on "pcre" depends_on "python" resource "argparse" do url "https://files.pythonhosted.org/packages/18/dd/e617cfc3f6210ae183374cd9f6a26b20514bbb5a792af97949c5aacddf0f/argparse-1.4.0.tar.gz" sha256 "62b089a55be1d8949cd2bc7e0df0bddb9e028faefc8c32038cc84862aefdd6e4" end resource "PyYAML" do url "https://files.pythonhosted.org/packages/e3/e8/b3212641ee2718d556df0f23f78de8303f068fe29cdaa7a91018849582fe/PyYAML-5.1.2.tar.gz" sha256 "01adf0b6c6f61bd11af6e10ca52b7d4057dd0be0343eb9283c878cf3af56aee4" end resource "simplejson" do url "https://files.pythonhosted.org/packages/e3/24/c35fb1c1c315fc0fffe61ea00d3f88e85469004713dab488dee4f35b0aff/simplejson-3.16.0.tar.gz" sha256 "b1f329139ba647a9548aa05fb95d046b4a677643070dc2afc05fa2e975d09ca5" end def install xy = Language::Python.major_minor_version "python3" ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python#{xy}/site-packages" resources.each do |r| r.stage do system "python3", *Language::Python.setup_install_args(libexec/"vendor") end end jansson = Formula["jansson"] libmagic = Formula["libmagic"] libnet = Formula["libnet"] args = %W[ --disable-dependency-tracking --disable-silent-rules --prefix=#{prefix} --sysconfdir=#{etc} --localstatedir=#{var} --with-libjansson-includes=#{jansson.opt_include} --with-libjansson-libraries=#{jansson.opt_lib} --with-libmagic-includes=#{libmagic.opt_include} --with-libmagic-libraries=#{libmagic.opt_lib} --with-libnet-includes=#{libnet.opt_include} --with-libnet-libraries=#{libnet.opt_lib} --enable-ipfw ] system "./configure", *args system "make", "install-full" bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"]) # Leave the magic-file: prefix in otherwise it overrides a commented out line rather than intended line. inreplace etc/"suricata/suricata.yaml", %r{magic-file: /.+/magic}, "magic-file: #{libmagic.opt_share}/misc/magic" end test do assert_match(/#{version}/, shell_output("#{bin}/suricata --build-info")) end end