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.6.tar.xz" mirror "https://ftpmirror.gnu.org/guile/guile-2.2.6.tar.xz" sha256 "b33576331465a60b003573541bf3b1c205936a16c407bc69f8419a527bf5c988" bottle do sha256 "17506d92107d7209955da7c2adf9ab324d41b9667557a9b1fa81d6f6813149f3" => :mojave sha256 "093fc2760544ffff7c69ec0e0767b586e206ca67cf909b51211f7eea368ef9ea" => :high_sierra sha256 "32e167bfe1de00fdd3c64e5785edbf5d90b3c8621e3699fd287cb6b09a377d7f" => :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