class Newt < Formula desc "Library for color text mode, widget based user interfaces" homepage "https://pagure.io/newt" url "https://pagure.io/releases/newt/newt-0.52.20.tar.gz" sha256 "8d66ba6beffc3f786d4ccfee9d2b43d93484680ef8db9397a4fb70b5adbb6dbc" revision 1 bottle do cellar :any sha256 "5affacd83b0c8584976235ae16a96c5264db5fbe45ed15f618f1da2562a9eb6c" => :mojave sha256 "ec087d9023c820072ed8ecd769304ae66d993b9c445949feb020446cee6b3fe2" => :high_sierra sha256 "9c5c1376d3346f0417303d9af608c1f2dbded3dd43fe9cc2405117cb412de567" => :sierra end depends_on "gettext" depends_on "popt" depends_on "s-lang" def install args = ["--prefix=#{prefix}", "--without-tcl"] inreplace "Makefile.in" do |s| # name libraries correctly # https://bugzilla.redhat.com/show_bug.cgi?id=1192285 s.gsub! "libnewt.$(SOEXT).$(SONAME)", "libnewt.$(SONAME).dylib" s.gsub! "libnewt.$(SOEXT).$(VERSION)", "libnewt.$(VERSION).dylib" # don't link to libpython.dylib # causes https://github.com/Homebrew/homebrew/issues/30252 # https://bugzilla.redhat.com/show_bug.cgi?id=1192286 s.gsub! "`$$pyconfig --ldflags`", '"-undefined dynamic_lookup"' s.gsub! "`$$pyconfig --libs`", '""' end system "./configure", *args system "make", "install" end test do ENV["TERM"] = "xterm" system "python2.7", "-c", "import snack" (testpath/"test.c").write <<~EOS #import int main() { newtInit(); newtFinished(); } EOS system ENV.cc, "test.c", "-o", "test", "-L#{lib}", "-lnewt" system "./test" end end