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 rebuild 1 sha256 "7bfe0c8f0f0ccbd3efa21dc515c149492d900e68e6bf6a802d4f9295c8bcf9e9" => :catalina sha256 "b4c73a4155900d19f6b2a6255ff5b0ae454d3663eac004e16fb79fd4f69ec9c5" => :mojave sha256 "f90ffabcd109edc74afe9b8c07c6f166207011d6dff277e626360b9d6b5a2db3" => :high_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 # Work around Xcode 11 clang bug # https://bitbucket.org/multicoreware/x265/issues/514/wrong-code-generated-on-macos-1015 ENV.append_to_cflags "-fno-stack-check" if DevelopmentTools.clang_build_version >= 1010 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