homebrew-core/Formula/rsyslog.rb

79 lines
2.8 KiB
Ruby

class Rsyslog < Formula
desc "Enhanced, multi-threaded syslogd"
homepage "https://www.rsyslog.com/"
url "https://www.rsyslog.com/files/download/rsyslog/rsyslog-8.2112.0.tar.gz"
sha256 "6a2a973861e9266db37bd2b7b9f672b6b970bfcd743a397b8eee6b0dc4852c41"
license all_of: ["Apache-2.0", "GPL-3.0-or-later", "LGPL-3.0-or-later"]
livecheck do
url "https://www.rsyslog.com/downloads/download-v8-stable/"
regex(/href=.*?rsyslog[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_monterey: "5b5ad8fe75e4d1c4b4ce173c3cdde2fed8d3b208fa40eceaab622d7288aa0b21"
sha256 arm64_big_sur: "a6510d81d3199a3c0ca3c8b54a2231e90551dd6b31b7e230bc78160949bcd5af"
sha256 monterey: "4fee85d2052620ae51cea97be0d467fc02f3f0445267e3cd5e25ec0dc0d6f569"
sha256 big_sur: "27d2c05b98abe4614b4f191946d4a4420e556504785f7adedd8828cc6a6f4797"
sha256 catalina: "3bffe649152d125520bde16a5f80b00487a2b2dbd4c4bfe058b9211ecbca1cf2"
sha256 x86_64_linux: "148a18a831153087026d22e90cac97f7a9c2c9be8b0ffac67221bc73d3a1c1a9"
end
depends_on "pkg-config" => :build
depends_on "libestr"
uses_from_macos "curl"
uses_from_macos "zlib"
resource "libfastjson" do
url "https://download.rsyslog.com/libfastjson/libfastjson-0.99.9.tar.gz"
sha256 "a330e1bdef3096b7ead53b4bad1a6158f19ba9c9ec7c36eda57de7729d84aaee"
end
def install
resource("libfastjson").stage do
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{libexec}"
system "make", "install"
end
ENV.prepend_path "PKG_CONFIG_PATH", libexec/"lib/pkgconfig"
system "./configure", "--prefix=#{prefix}",
"--disable-dependency-tracking",
"--enable-imfile",
"--enable-usertools",
"--enable-diagtools",
"--disable-uuid",
"--disable-libgcrypt"
system "make"
system "make", "install"
(etc/"rsyslog.conf").write <<~EOS
# minimal config file for receiving logs over UDP port 10514
$ModLoad imudp
$UDPServerRun 10514
*.* /usr/local/var/log/rsyslog-remote.log
EOS
end
def post_install
mkdir_p var/"run"
end
plist_options manual: "rsyslogd -f #{HOMEBREW_PREFIX}/etc/rsyslog.conf -i #{HOMEBREW_PREFIX}/var/run/rsyslogd.pid"
service do
run [opt_sbin/"rsyslogd", "-n", "-f", etc/"rsyslog.conf", "-i", var/"run/rsyslogd.pid"]
keep_alive true
error_log_path var/"log/rsyslogd.log"
log_path var/"log/rsyslogd.log"
end
test do
result = shell_output("#{opt_sbin}/rsyslogd -f #{etc}/rsyslog.conf -N 1 2>&1")
assert_match "End of config validation run", result
end
end