homebrew-core/Formula/minimal-racket.rb
2019-01-26 17:59:17 +08:00

75 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.1/racket-minimal-7.1-src-builtpkgs.tgz"
sha256 "efa918564e9e74a4019dcd6408f0873a4e0835dd77d09109dff2c6512aefb4b8"
bottle do
cellar :any
sha256 "e71c7b62a02120db3e02666b069585ecf6e144a02730d4f480fe6de59ee4628c" => :mojave
sha256 "485e5964015df87542f80859794f59829a2f4b0ca738c31ce0323699258dca8d" => :high_sierra
sha256 "74e5b14760d7a6b3f47a714213ec4153413399b66abc259ebc59006c4deb694a" => :sierra
end
# these two files are amended when (un)installing packages
skip_clean "lib/racket/launchers.rktd", "lib/racket/mans.rktd"
def install
cd "src" do
args = %W[
--disable-debug
--disable-dependency-tracking
--enable-macprefix
--prefix=#{prefix}
--man=#{man}
--sysconfdir=#{etc}
]
system "./configure", *args
system "make"
system "make", "install"
end
# configure racket's package tool (raco) to do the Right Thing
# see: https://docs.racket-lang.org/raco/config-file.html
inreplace etc/"racket/config.rktd" do |s|
s.gsub!(
/\(bin-dir\s+\.\s+"#{Regexp.quote(bin)}"\)/,
"(bin-dir . \"#{HOMEBREW_PREFIX}/bin\")",
)
s.gsub!(
/\n\)$/,
"\n (default-scope . \"installation\")\n)",
)
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