homebrew-core/Formula/newsboat.rb

103 lines
3.7 KiB
Ruby

class Newsboat < Formula
desc "RSS/Atom feed reader for text terminals"
homepage "https://newsboat.org/"
url "https://newsboat.org/releases/2.30/newsboat-2.30.tar.xz"
sha256 "e0ac957487d444cc6c4674e0dc82bbc8129b56a43ecd7ea9fc726c65e3b471d5"
license "MIT"
head "https://github.com/newsboat/newsboat.git", branch: "master"
bottle do
sha256 arm64_ventura: "52b95b874acaf2b7ef90489f28d6c255a9c1fdfc58157c1a7a55131b3d4bf539"
sha256 arm64_monterey: "b5b856af27cff916ae18350e0e256f73381a4e14b2af4739626f9174bc63417c"
sha256 arm64_big_sur: "2eb949170fd6923d7b75345abd6014b9806af753b39ca3da7e211fd4e9ea5197"
sha256 ventura: "96747410abb8c614db31f629fe1e53ae812fc045ec61ea23687e080274feea0f"
sha256 monterey: "b7835bbbb2d0fcfe7859c03b4e2573ad13fa5db8deae553f578787910077aa8f"
sha256 big_sur: "7bebbfde85bb81f9ccfcd3c2d8ab567d73057926b3720140b38d8d1b6f471c02"
sha256 x86_64_linux: "5abdfc02ea3996c491bb6f097c413cacae4839dac6cd112c1a17a1ef109ddf25"
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"
on_macos do
depends_on "make" => :build
end
# 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"
if OS.mac?
system Formula["make"].opt_bin/"gmake", "install", "prefix=#{prefix}"
else
system "make", "install", "prefix=#{prefix}"
end
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