homebrew-core/Formula/suricata.rb
2017-09-21 08:48:29 +02:00

95 lines
3.3 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-4.0.0.tar.gz"
sha256 "6b8b183a8409829ca92c71854cc1abed45f04ccfb7f14c08211f4edf571fa577"
bottle do
sha256 "900f56e06aef404b4dfa7ad12ddfdbaf286e37e594cb1ef509f55b855cc5d26e" => :high_sierra
sha256 "79a7a7846db0c3aec47923b9aec4748b4e4141a1b0cdb5f253958334c967d54b" => :sierra
sha256 "7cde635c3f02771ba54bbb84b159241b6b943bbca067089612e1f6fac113ccc4" => :el_capitan
sha256 "ea417dd96e5afb175768483229eb101800b67e0825ea899b9e0b66a0c32d4368" => :yosemite
end
depends_on :python if MacOS.version <= :snow_leopard
depends_on "pkg-config" => :build
depends_on "libmagic"
depends_on "libnet"
depends_on "libyaml"
depends_on "pcre"
depends_on "nss"
depends_on "nspr"
depends_on "geoip" => :optional
depends_on "lua" => :optional
depends_on "luajit" => :optional
depends_on "jansson" => :optional
depends_on "hiredis" => :optional
resource "argparse" do
url "https://files.pythonhosted.org/packages/source/a/argparse/argparse-1.4.0.tar.gz"
sha256 "62b089a55be1d8949cd2bc7e0df0bddb9e028faefc8c32038cc84862aefdd6e4"
end
resource "simplejson" do
url "https://files.pythonhosted.org/packages/source/s/simplejson/simplejson-3.11.1.tar.gz"
sha256 "01a22d49ddd9a168b136f26cac87d9a335660ce07aa5c630b8e3607d6f4325e7"
end
def install
libnet = Formula["libnet"]
libmagic = Formula["libmagic"]
ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python2.7/site-packages"
resources.each do |r|
r.stage do
system "python", *Language::Python.setup_install_args(libexec/"vendor")
end
end
args = %W[
--disable-dependency-tracking
--disable-silent-rules
--prefix=#{prefix}
--sysconfdir=#{etc}
--localstatedir=#{var}
--with-libnet-includes=#{libnet.opt_include}
--with-libnet-libs=#{libnet.opt_lib}
--with-libmagic-includes=#{libmagic.opt_include}
--with-libmagic-libraries=#{libmagic.opt_lib}
]
args << "--enable-lua" if build.with? "lua"
args << "--enable-luajit" if build.with? "luajit"
if build.with? "geoip"
geoip = Formula["geoip"]
args << "--enable-geoip"
args << "--with-libgeoip-includes=#{geoip.opt_include}"
args << "--with-libgeoip-libs=#{geoip.opt_lib}"
end
if build.with? "jansson"
jansson = Formula["jansson"]
args << "--with-libjansson-includes=#{jansson.opt_include}"
args << "--with-libjansson-libraries=#{jansson.opt_lib}"
end
if build.with? "hiredis"
hiredis = Formula["hiredis"]
args << "--enable-hiredis"
args << "--with-libjansson-includes=#{hiredis.opt_include}"
args << "--with-libhiredis-libraries=#{hiredis.opt_lib}"
end
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