homebrew-core/Formula/readline.rb
2019-01-13 12:22:56 +01:00

43 lines
1.4 KiB
Ruby

class Readline < Formula
desc "Library for command-line editing"
homepage "https://tiswww.case.edu/php/chet/readline/rltop.html"
url "https://ftp.gnu.org/gnu/readline/readline-8.0.tar.gz"
mirror "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz"
version "8.0.0"
sha256 "e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461"
bottle do
cellar :any
sha256 "9b698b215a371ae394a4fa9137b019472c649c77ea389b6bdf2d9104cfe4a56c" => :mojave
sha256 "9f5c4da065626612770b0176f5eca537b4443cfb004c12e08a5b421f755e3c64" => :high_sierra
sha256 "8cd1c5d78f8731f935f38b15c95ab714c3ef9c1c2268239743e406230fd73d0e" => :sierra
end
keg_only :shadowed_by_macos, <<~EOS
macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only
EOS
def install
system "./configure", "--prefix=#{prefix}"
system "make", "install"
end
test do
(testpath/"test.c").write <<~EOS
#include <stdio.h>
#include <stdlib.h>
#include <readline/readline.h>
int main()
{
printf("%s\\n", readline("test> "));
return 0;
}
EOS
system ENV.cc, "-L", lib, "test.c", "-L#{lib}", "-lreadline", "-o", "test"
assert_equal "test> Hello, World!\nHello, World!",
pipe_output("./test", "Hello, World!\n").strip
end
end