homebrew-core/Formula/minimal-racket.rb

72 lines
2.2 KiB
Ruby

class MinimalRacket < Formula
desc "Modern programming language in the Lisp/Scheme family"
homepage "https://racket-lang.org/"
url "https://mirror.racket-lang.org/installers/7.7/racket-minimal-7.7-src-builtpkgs.tgz"
sha256 "65712392a334f9a091a6090345d4d392165d9b897e8d918e8aefdcfb0e59a4f8"
bottle do
cellar :any
sha256 "c16ada1784dafe74e56c4a860f310752060fb161a4acce72bd9f3ac9f85897f3" => :catalina
sha256 "7b32a64228abada82c29a05e5bac3fc172b49adb2d86fa27f46665b416f1825b" => :mojave
sha256 "a8d174fecc59249af342499b0a174d78f07bd4ea037cd71a177487b980579d7b" => :high_sierra
end
uses_from_macos "libffi"
# these two files are amended when (un)installing packages
skip_clean "lib/racket/launchers.rktd", "lib/racket/mans.rktd"
def install
# configure racket's package tool (raco) to do the Right Thing
# see: https://docs.racket-lang.org/raco/config-file.html
inreplace "etc/config.rktd", /\)\)\n$/, ") (default-scope . \"installation\"))\n"
cd "src" do
args = %W[
--disable-debug
--disable-dependency-tracking
--enable-origtree=no
--enable-macprefix
--prefix=#{prefix}
--mandir=#{man}
--sysconfdir=#{etc}
--enable-useprefix
]
system "./configure", *args
system "make"
system "make", "install"
end
end
def caveats
<<~EOS
This is a minimal Racket distribution.
If you want to build the DrRacket IDE, you may run:
raco pkg install --auto drracket
The full Racket distribution is available as a cask:
brew cask install racket
EOS
end
test do
output = shell_output("#{bin}/racket -e '(displayln \"Hello Homebrew\")'")
assert_match /Hello Homebrew/, output
# show that the config file isn't malformed
output = shell_output("'#{bin}/raco' pkg config")
assert $CHILD_STATUS.success?
assert_match Regexp.new(<<~EOS), output
^name:
#{version}
catalogs:
https://download.racket-lang.org/releases/#{version}/catalog/
https://pkgs.racket-lang.org
https://planet-compats.racket-lang.org
default-scope:
installation
EOS
end
end