105 lines
3.8 KiB
Ruby
105 lines
3.8 KiB
Ruby
class Newsboat < Formula
|
|
desc "RSS/Atom feed reader for text terminals"
|
|
homepage "https://newsboat.org/"
|
|
url "https://newsboat.org/releases/2.29/newsboat-2.29.tar.xz"
|
|
sha256 "18b9801e0c2948f29248bfd8f319a9f9f670993fdbd494c6464aaab9e325fd6b"
|
|
license "MIT"
|
|
head "https://github.com/newsboat/newsboat.git", branch: "master"
|
|
|
|
bottle do
|
|
rebuild 1
|
|
sha256 arm64_ventura: "4572f464d84476820672597e8d31aeec42d5f750aab80b71d52366a684099e78"
|
|
sha256 arm64_monterey: "4f45d5031a1b35c8f1af8c5bb07027138917f1bbff3776c8c84fe6baeb557d58"
|
|
sha256 arm64_big_sur: "20ef886e95efb1637d3deb6719ccb405217ed15a83b0453e876df725c0e42d2d"
|
|
sha256 ventura: "8c94abd3c9075cea1ce8adacb29ec005b2583b2af5e31757bf7b1f41e86f53fa"
|
|
sha256 monterey: "dec76d61b81b46ee592ffeb0450511ce83697d2520475a5e602f4a72cd6a58f4"
|
|
sha256 big_sur: "cc9a51a1570108b42532e01e5d472df61d718a54e5c54d278b929ebed9227572"
|
|
sha256 catalina: "e507eff899abd94dfe8540208cecbeb0d22011ae05db06dd7efa4ab30f5a7c6f"
|
|
sha256 x86_64_linux: "670add945234d73782e48d2c052785a2e87dd06db93af6be3dac580c62030f33"
|
|
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
|