94 lines
3.4 KiB
Ruby
94 lines
3.4 KiB
Ruby
class Newsboat < Formula
|
|
desc "RSS/Atom feed reader for text terminals"
|
|
homepage "https://newsboat.org/"
|
|
url "https://newsboat.org/releases/2.26/newsboat-2.26.tar.xz"
|
|
sha256 "34a4834e00f06c0151c700d6af065f5b8776872227d9d4484d247ae7a4413c18"
|
|
license "MIT"
|
|
head "https://github.com/newsboat/newsboat.git", branch: "master"
|
|
|
|
bottle do
|
|
sha256 arm64_monterey: "8737923b1800dc469b6714edb999e0287fb56a8455cd1e4362fd920e4380c71a"
|
|
sha256 arm64_big_sur: "7438a9a7faf80e156c409a0631e13c5a1ae33ef6003b4cbd4881dd09faaa617f"
|
|
sha256 monterey: "d0813d37c35317a9c454a04098f82d5afd232ce4d30b7e685dce93910f05559c"
|
|
sha256 big_sur: "2ca14c38d9d7f6364429fa19412fba0922cdb270b09f2b7335c1c15ad0eec8a3"
|
|
sha256 catalina: "bcfff7b4f44afa72a3ee645a0a4e11fc212be936c184867abcf5810702d81050"
|
|
sha256 x86_64_linux: "df5b6c0947f0d09ecd72dbe6d95210e3c98ab35bca35de89995613e383cfd397"
|
|
end
|
|
|
|
depends_on "asciidoctor" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "rust" => :build
|
|
depends_on "xz" => :build
|
|
depends_on "gettext"
|
|
depends_on "json-c"
|
|
|
|
uses_from_macos "curl"
|
|
uses_from_macos "libxml2"
|
|
uses_from_macos "libxslt"
|
|
uses_from_macos "ncurses"
|
|
uses_from_macos "sqlite"
|
|
|
|
# Newsboat have their own libstfl fork. Upstream libsftl is gone:
|
|
# https://github.com/Homebrew/homebrew-core/pull/89981
|
|
# They do not want to be the new upstream, but use that fork as a temporary
|
|
# workaround until they migrate to some rust crate
|
|
# https://github.com/newsboat/newsboat/issues/1881
|
|
resource("libstfl") do
|
|
url "https://github.com/newsboat/stfl.git",
|
|
revision: "c2c10b8a50fef613c0aacdc5d06a0fa610bf79e9"
|
|
end
|
|
|
|
def install
|
|
resource("libstfl").stage do
|
|
if OS.mac?
|
|
ENV.append "LDLIBS", "-liconv"
|
|
ENV.append "LIBS", "-lncurses -lruby -liconv"
|
|
|
|
inreplace "stfl_internals.h", "ncursesw/ncurses.h", "ncurses.h"
|
|
inreplace %w[stfl.pc.in ruby/Makefile.snippet], "ncursesw", "ncurses"
|
|
|
|
inreplace "Makefile" do |s|
|
|
s.gsub! "ncursesw", "ncurses"
|
|
s.gsub! "-Wl,-soname,$(SONAME)", "-Wl"
|
|
s.gsub! "libstfl.so.$(VERSION)", "libstfl.$(VERSION).dylib"
|
|
s.gsub! "libstfl.so", "libstfl.dylib"
|
|
end
|
|
|
|
# Fix ncurses linkage for Perl bundle
|
|
inreplace "perl5/Makefile.PL", "-lncursesw", "-L#{MacOS.sdk_path}/usr/lib -lncurses"
|
|
else
|
|
ENV.append "LIBS", "-lncursesw -lruby"
|
|
inreplace "Makefile", "$(LDLIBS) $^", "$^ $(LDLIBS)"
|
|
end
|
|
|
|
# Fails race condition of test:
|
|
# ImportError: dynamic module does not define init function (init_stfl)
|
|
# make: *** [python/_stfl.so] Error 1
|
|
ENV.deparallelize do
|
|
system "make"
|
|
system "make", "install", "prefix=#{libexec}"
|
|
end
|
|
|
|
cp (libexec/"lib/libstfl.so"), (libexec/"lib/libstfl.so.0") if OS.linux?
|
|
end
|
|
|
|
gettext = Formula["gettext"]
|
|
|
|
ENV["GETTEXT_BIN_DIR"] = gettext.opt_bin.to_s
|
|
ENV["GETTEXT_LIB_DIR"] = gettext.lib.to_s
|
|
ENV["GETTEXT_INCLUDE_DIR"] = gettext.include.to_s
|
|
ENV["XML_CATALOG_FILES"] = etc/"xml/catalog"
|
|
|
|
# Remove once libsftl is not used anymore
|
|
ENV.prepend_path "PKG_CONFIG_PATH", libexec/"lib/pkgconfig"
|
|
ENV.append "LDFLAGS", "-Wl,-rpath,#{libexec}/lib"
|
|
|
|
system "make", "install", "prefix=#{prefix}"
|
|
end
|
|
|
|
test do
|
|
(testpath/"urls.txt").write "https://github.com/blog/subscribe"
|
|
assert_match "Newsboat - Exported Feeds", shell_output("LC_ALL=C #{bin}/newsboat -e -u urls.txt")
|
|
end
|
|
end
|