93 lines
2.9 KiB
Ruby
93 lines
2.9 KiB
Ruby
class Nzbget < Formula
|
|
desc "Binary newsgrabber for nzb files"
|
|
homepage "http://nzbget.net/"
|
|
url "https://github.com/nzbget/nzbget/releases/download/v18.1/nzbget-18.1-src.tar.gz"
|
|
sha256 "ddf7f9eda1cc4d6f01cd28a5ee4362ef7a399085cda45a82ffdf250d56393819"
|
|
head "https://github.com/nzbget/nzbget.git"
|
|
|
|
bottle do
|
|
sha256 "cbe259fd1797cbc7d3ed37fbeb039633f20e1b3dfd25c5f319b45d4b7472c6ed" => :sierra
|
|
sha256 "34b1ec57b94619f6cf72a868339faf8fa8f27ad96ec5b7d771ff5a7351c5c23b" => :el_capitan
|
|
sha256 "c011158f5c16c10c6906f95a18a50b993c3f0dbf8d37e697c378d55de13cab62" => :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.undent
|
|
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.undent
|
|
<?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}/nzbget</string>
|
|
<string>-s</string>
|
|
<string>-o</string>
|
|
<string>OutputMode=Log</string>
|
|
</array>
|
|
<key>RunAtLoad</key>
|
|
<true/>
|
|
<key>KeepAlive</key>
|
|
<true/>
|
|
</dict>
|
|
</plist>
|
|
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
|