class Nzbget < Formula desc "Binary newsgrabber for nzb files" homepage "https://nzbget.net/" url "https://github.com/nzbget/nzbget/releases/download/v19.1/nzbget-19.1-src.tar.gz" sha256 "06df42356ac2d63bbc9f7861abe9c3216df56fa06802e09e8a50b05f4ad95ce6" head "https://github.com/nzbget/nzbget.git", :branch => "develop" bottle do sha256 "0f508d759d085ea42af708598eba3d2f589614f6025f8ca160b93c6170d5576b" => :high_sierra sha256 "b2b460f1f4a850d282b3faa56a0cdc66d7d9f2072e34528fe1fc875f615e3705" => :sierra sha256 "3aa8bd8510dbde22143fa6d9637d664951c4a48758c840548dcee0ce48f3b95f" => :el_capitan sha256 "f9731421aa1289d62d9f30691c3e643e8548eb066d55c72511ad74d994e826e7" => :yosemite end depends_on "pkg-config" => :build depends_on "openssl" depends_on "gcc" if MacOS.version <= :mavericks needs :cxx11 fails_with :clang do build 600 cause "No compiler with C++14 support was found" end fails_with :clang do build 500 cause <<~EOS Clang older than 5.1 requires flexible array members to be POD types. More recent versions require only that they be trivially destructible. EOS end def install ENV.cxx11 # Fix "ncurses library not found" # Reported 14 Aug 2016: https://github.com/nzbget/nzbget/issues/264 (buildpath/"brew_include").install_symlink MacOS.sdk_path/"usr/include/ncurses.h" ENV["ncurses_CFLAGS"] = "-I#{buildpath}/brew_include" ENV["ncurses_LIBS"] = "-L/usr/lib -lncurses" # Tell configure to use OpenSSL system "./configure", "--disable-debug", "--disable-dependency-tracking", "--prefix=#{prefix}", "--with-tlslib=OpenSSL" system "make" ENV.deparallelize system "make", "install" pkgshare.install_symlink "nzbget.conf" => "webui/nzbget.conf" # Set upstream's recommended values for file systems without # sparse-file support (e.g., HFS+); see Homebrew/homebrew-core#972 inreplace "nzbget.conf", "DirectWrite=yes", "DirectWrite=no" inreplace "nzbget.conf", "ArticleCache=0", "ArticleCache=700" etc.install "nzbget.conf" end plist_options :manual => "nzbget" def plist; <<~EOS Label #{plist_name} ProgramArguments #{opt_bin}/nzbget -s -o OutputMode=Log RunAtLoad KeepAlive EOS end test do (testpath/"downloads/dst").mkpath # Start nzbget as a server in daemon-mode system "#{bin}/nzbget", "-D" # Query server for version information system "#{bin}/nzbget", "-V" # Shutdown server daemon system "#{bin}/nzbget", "-Q" end end