homebrew-core/Formula/guile@2.rb

70 lines
2.4 KiB
Ruby

class GuileAT2 < 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.7.tar.xz"
mirror "https://ftpmirror.gnu.org/guile/guile-2.2.7.tar.xz"
sha256 "cdf776ea5f29430b1258209630555beea6d2be5481f9da4d64986b077ff37504"
bottle do
sha256 "2821f055df7815abc7467a42f1bd90a09672261a9aad4ce994111a59a2ce6dbe" => :catalina
sha256 "78e5fd69581a54b8d7c701e1fc03d96660b80a2699d7dad701cdd2865a5f2442" => :mojave
sha256 "2832668210b0ef94ae0596c7e27aca846f76453719df6a9103e34af9e885d031" => :high_sierra
end
keg_only :versioned_formula
deprecate!
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
# Avoid superenv shim
inreplace "meta/guile-config.in", "@PKG_CONFIG@", Formula["pkg-config"].opt_bin/"pkg-config"
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