homebrew-core/Formula/znc.rb

84 lines
2.6 KiB
Ruby

class Znc < Formula
desc "Advanced IRC bouncer"
homepage "https://wiki.znc.in/ZNC"
url "https://znc.in/releases/archive/znc-1.8.2.tar.gz"
sha256 "ff238aae3f2ae0e44e683c4aee17dc8e4fdd261ca9379d83b48a7d422488de0d"
license "Apache-2.0"
revision 3
bottle do
sha256 arm64_big_sur: "e3aae77ed8c97b6495e5f04fabe977206239ee83d3b8cb96b20e3618364b2e18"
sha256 big_sur: "37a5eaf20286fab88bd11f0f6f44ebf5bd2bb787deac43529d01cde28ef94188"
sha256 catalina: "dc2145a17c2d550c367c1de12ab1e8c20bfc273cd92fe02da55678892b75a29c"
sha256 mojave: "85a43a2796ec9d97fbe224a09501b82ae5495202dfffcc1ce8f9515a399076a5"
sha256 x86_64_linux: "c8705bab2cbf518a0f7a6abbbc6a40881f19b65073f3649df32e1dfd9962b040"
end
head do
url "https://github.com/znc/znc.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
depends_on "pkg-config" => :build
depends_on "icu4c"
depends_on "openssl@1.1"
depends_on "python@3.9"
uses_from_macos "zlib"
def install
ENV.cxx11
# These need to be set in CXXFLAGS, because ZNC will embed them in its
# znc-buildmod script; ZNC's configure script won't add the appropriate
# flags itself if they're set in superenv and not in the environment.
ENV.append "CXXFLAGS", "-std=c++11"
ENV.append "CXXFLAGS", "-stdlib=libc++" if ENV.compiler == :clang
if OS.linux?
ENV.append "CXXFLAGS", "-I#{Formula["zlib"].opt_include}"
ENV.append "LIBS", "-L#{Formula["zlib"].opt_lib}"
end
system "./autogen.sh" if build.head?
system "./configure", "--prefix=#{prefix}", "--enable-python"
system "make", "install"
end
plist_options manual: "znc --foreground"
def plist
<<~EOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/znc</string>
<string>--foreground</string>
</array>
<key>StandardErrorPath</key>
<string>#{var}/log/znc.log</string>
<key>StandardOutPath</key>
<string>#{var}/log/znc.log</string>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>300</integer>
</dict>
</plist>
EOS
end
test do
mkdir ".znc"
system bin/"znc", "--makepem"
assert_predicate testpath/".znc/znc.pem", :exist?
end
end