homebrew-core/Formula/suricata.rb

81 lines
2.9 KiB
Ruby

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.2.tar.gz"
sha256 "7f30cac92feeab2a9281b6059b96f9f163dce9aadcc959a6c0b9a2f6d750cee7"
bottle do
sha256 "c53984e39929bf1649a63c44ed33ca04d669a9e4214637d4ade862331f004315" => :catalina
sha256 "4db4344400d879ec86f10a381b507ef16a6fd41f83ec7aa009c10d3cb82d60d0" => :mojave
sha256 "4ad2a8c5dee845881c60942cf7118ed083516a9d8d630d67b046f57a462a23ec" => :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/8d/c9/e5be955a117a1ac548cdd31e37e8fd7b02ce987f9655f5c7563c656d5dcb/PyYAML-5.2.tar.gz"
sha256 "c0ee8eca2c582d29c3c2ec6e2c4f703d1b7f1fb10bc72317355a746057e7346c"
end
resource "simplejson" do
url "https://files.pythonhosted.org/packages/98/87/a7b98aa9256c8843f92878966dc3d8d914c14aad97e2c5ce4798d5743e07/simplejson-3.17.0.tar.gz"
sha256 "2b4b2b738b3b99819a17feaf118265d0753d5536049ea570b3c43b51c4701e81"
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