homebrew-core/Formula/guile.rb

98 lines
3.3 KiB
Ruby

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-3.0.4.tar.xz"
mirror "https://ftpmirror.gnu.org/guile/guile-3.0.4.tar.xz"
sha256 "6b7947dc2e3d115983846a268b8f5753c12fd5547e42fbf2b97d75a3b79f0d31"
bottle do
sha256 "ebc624a09a10ff033ac3027a44e39b6794f5c45fd3098dc7d1d7e991392474db" => :catalina
sha256 "ee6ba8b247f3db6e463da22a828a599adacefe987cac32377e279c508418be83" => :mojave
sha256 "b60e3ffe45ac702a4d02edcf85a878ec88ead3a059e0db9c56cbd7e07152a550" => :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
uses_from_macos "flex" => :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"
on_linux do
depends_on "gperf"
end
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 "./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-3.0.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
def post_install
# Create directories so installed modules can create links inside.
(HOMEBREW_PREFIX/"lib/guile/3.0/site-ccache").mkpath
(HOMEBREW_PREFIX/"share/guile/site/3.0").mkpath
end
def caveats
<<~EOS
Guile libraries can now be installed here:
Source files: #{HOMEBREW_PREFIX}/share/guile/site/3.0
Compiled files: #{HOMEBREW_PREFIX}/lib/guile/3.0/site-ccache
Add the following to your .bashrc or equivalent:
export GUILE_LOAD_PATH="#{HOMEBREW_PREFIX}/share/guile/site/3.0"
export GUILE_LOAD_COMPILED_PATH="#{HOMEBREW_PREFIX}/lib/guile/3.0/site-ccache"
EOS
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