Created
October 2, 2019 19:18
-
-
Save krzysdb/9dbb9ab0e6a4eddbd9725ccf6c99aa78 to your computer and use it in GitHub Desktop.
Legacy configuration for homebrew readline 7.0 package
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-7.0.tar.gz" | |
mirror "https://ftpmirror.gnu.org/readline/readline-7.0.tar.gz" | |
version "7.0.1" | |
sha256 "750d437185286f40a369e1e4f4764eda932b9459b5ec9a731628393dd3d32334" | |
%w[ | |
001 9ac1b3ac2ec7b1bf0709af047f2d7d2a34ccde353684e57c6b47ebca77d7a376 | |
002 8747c92c35d5db32eae99af66f17b384abaca961653e185677f9c9a571ed2d58 | |
003 9e43aa93378c7e9f7001d8174b1beb948deefa6799b6f581673f465b7d9d4780 | |
004 f925683429f20973c552bff6702c74c58c2a38ff6e5cf305a8e847119c5a6b64 | |
005 ca159c83706541c6bbe39129a33d63bbd76ac594303f67e4d35678711c51b753 | |
].each_slice(2) do |p, checksum| | |
patch :p0 do | |
url "https://ftp.gnu.org/gnu/readline/readline-7.0-patches/readline70-#{p}" | |
mirror "https://ftpmirror.gnu.org/readline/readline-7.0-patches/readline70-#{p}" | |
sha256 checksum | |
end | |
end | |
bottle do | |
cellar :any | |
sha256 "ab3c966f4cae7d0f3ecc5688bb989820c3261f5ed547a08c84186ba7f53bdd9c" => :catalina | |
sha256 "3c754391e9d243835811d128771ca0f1a565024100fd2c2871534353d46aaf0e" => :mojave | |
sha256 "ae341a036139a92a47396aabc773ffcf40a17fc388aaadf0147f688c72ece987" => :high_sierra | |
sha256 "f234d1ff8148bf08b0ac31e661f2e96b5c6e64df26a45d2392056c9077f964af" => :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}" | |
# There is no termcap.pc in the base system, so we have to comment out | |
# the corresponding Requires.private line otherwise pkg-config will | |
# consider the readline module unusable | |
inreplace "readline.pc", /^(Requires.private: .*)$/, "# \\1" | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment