class Guile < Formula desc "GNU Ubiquitous Intelligent Language for Extensions" homepage "https://www.gnu.org/software/guile/" url "https://ftp.gnu.org/gnu/guile/guile-2.2.4.tar.xz" mirror "https://ftpmirror.gnu.org/guile/guile-2.2.4.tar.xz" sha256 "d9e8b94af7b206fcf52bec6501b921bd7d0bd7a31fb7e896a35ba8253678e31e" revision 1 bottle do sha256 "a5916710ddddf9ab79f368008fddfc708fd50ae86fc5b894a7d70cb3cebfb326" => :mojave sha256 "fe1d3822f7bb1a18b3fa73907db89ba7654a85c3cae4f572eb3257a4b2e148d0" => :high_sierra sha256 "a1bf9796750403fc459f8393144ac7589474f97ba4ce3a0d732fdab7aa3f3df1" => :sierra end head do url "https://git.savannah.gnu.org/git/guile.git" depends_on "autoconf" => :build depends_on "automake" => :build depends_on "gettext" => :build end depends_on "gnu-sed" => :build depends_on "bdw-gc" depends_on "gmp" depends_on "libffi" depends_on "libtool" depends_on "libunistring" depends_on "pkg-config" # guile-config is a wrapper around pkg-config. depends_on "readline" def install system "./autogen.sh" unless build.stable? system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}", "--with-libreadline-prefix=#{Formula["readline"].opt_prefix}", "--with-libgmp-prefix=#{Formula["gmp"].opt_prefix}" system "make", "install" # A really messed up workaround required on macOS --mkhl Pathname.glob("#{lib}/*.dylib") do |dylib| lib.install_symlink dylib.basename => "#{dylib.basename(".dylib")}.so" end # This is either a solid argument for guile including options for # --with-xyz-prefix= for libffi and bdw-gc or a solid argument for # Homebrew automatically removing Cellar paths from .pc files in favour # of opt_prefix usage everywhere. inreplace lib/"pkgconfig/guile-2.2.pc" do |s| s.gsub! Formula["bdw-gc"].prefix.realpath, Formula["bdw-gc"].opt_prefix s.gsub! Formula["libffi"].prefix.realpath, Formula["libffi"].opt_prefix end (share/"gdb/auto-load").install Dir["#{lib}/*-gdb.scm"] end test do hello = testpath/"hello.scm" hello.write <<~EOS (display "Hello World") (newline) EOS ENV["GUILE_AUTO_COMPILE"] = "0" system bin/"guile", hello end end