homebrew-core/Formula/readline.rb
2016-10-15 12:16:06 +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://ftpmirror.gnu.org/readline/readline-7.0.tar.gz"
mirror "https://ftp.gnu.org/gnu/readline/readline-7.0.tar.gz"
sha256 "750d437185286f40a369e1e4f4764eda932b9459b5ec9a731628393dd3d32334"
bottle do
cellar :any
sha256 "9bc3671fa05a042e8de11d5fd7769e45f5bfa674d4cb48c52720c7a3e7a521c6" => :sierra
sha256 "35451200004c16ac49b5a990f9c0ed88a29eea8627c26db4ddf48020c9a73ec2" => :el_capitan
sha256 "492648ce1c152c73c32c625926cc7ea6c9c56333a2dfa1f2e235d83ca3d9ee10" => :yosemite
end
keg_only :shadowed_by_osx, <<-EOS.undent
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
ENV.universal_binary
system "./configure", "--prefix=#{prefix}", "--enable-multibyte"
system "make", "install"
end
test do
(testpath/"test.c").write <<-EOS.undent
#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", "-lreadline", "-o", "test"
assert_equal "test> Hello, World!\nHello, World!",
pipe_output("./test", "Hello, World!\n").strip
end
end