103 lines
3.7 KiB
Ruby
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.1/newsboat-2.30.1.tar.xz"
|
|
sha256 "413ffdb44a2c348eb22491dc85ac73e1ca2489925f7cf59e96c62b1b0755602f"
|
|
license "MIT"
|
|
head "https://github.com/newsboat/newsboat.git", branch: "master"
|
|
|
|
bottle do
|
|
sha256 arm64_ventura: "f68bb7f6d850e20d8411886f0a73b9c3d010d4676037129c07ff3e20c1d6ccf7"
|
|
sha256 arm64_monterey: "2ae3dafc04a261f7690206eaa44fbbae7a2c81a41d80b840df689dd4b399665a"
|
|
sha256 arm64_big_sur: "71df7598b0d1b98cc67de2db2fb3fb1e1c7b987bb0f85ad00233da22c7e8f6ac"
|
|
sha256 ventura: "494bce5b1b367bcf971a38be2b7b715375cfbf50f15f7fdc3b6c2de170982d8e"
|
|
sha256 monterey: "4f1c91e330807fb0122fd2b64cb93fd76bac1b6f8a33e956178ac3df4fc45da8"
|
|
sha256 big_sur: "f96a6a5fe762be8e62c170a3840a7ee2b1be8dac30443a0a1fb07cc2fc7eee73"
|
|
sha256 x86_64_linux: "4735dc6b63c1f8d5e4d741f45aed39aaa04966049dda14d60f9f40f905c8c393"
|
|
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
|